nmrium 0.43.0 → 0.43.1-pre.1692874523
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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
- package/lib/component/2d/Viewer2D.js +1 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -2
- package/lib/component/context/DispatchContext.d.ts +3 -1
- package/lib/component/elements/CounterLabel.d.ts +7 -0
- package/lib/component/elements/CounterLabel.js +12 -0
- package/lib/component/elements/EditableColumn.js +12 -6
- package/lib/component/elements/Input.d.ts +3 -12
- package/lib/component/elements/Input.js +24 -76
- package/lib/component/elements/Message.js +0 -1
- package/lib/component/elements/PreferencesButton.d.ts +4 -0
- package/lib/component/elements/PreferencesButton.js +6 -0
- package/lib/component/elements/formik/FormikInput.d.ts +2 -2
- package/lib/component/elements/formik/FormikInput.js +3 -6
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/ZeroFillingOptionsPanel.js +4 -4
- package/lib/component/main/InnerNMRiumContents.js +1 -2
- package/lib/component/modal/AlignSpectraModal.js +78 -29
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
- package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
- package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +5 -1
- package/lib/component/panels/InformationPanel.js +9 -100
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +10 -6
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
- package/lib/component/panels/Panels.js +6 -7
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
- package/lib/component/panels/header/DefaultPanelHeader.js +4 -10
- package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +2 -2
- package/lib/component/reducer/Reducer.js +4 -2
- package/lib/component/reducer/actions/DomainActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +3 -3
- package/lib/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib/component/reducer/actions/ToolsActions.js +10 -10
- package/lib/component/reducer/core/Constants.d.ts +0 -4
- package/lib/component/reducer/core/Constants.js +0 -5
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib/component/toolbar/ToolTypes.d.ts +2 -2
- package/lib/component/toolbar/ToolTypes.js +23 -24
- package/lib/data/constants/References.d.ts +5 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
- package/lib-cjs/component/2d/Viewer2D.js +1 -3
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +1 -2
- package/lib-cjs/component/elements/CounterLabel.js +16 -0
- package/lib-cjs/component/elements/EditableColumn.js +12 -6
- package/lib-cjs/component/elements/Input.js +23 -75
- package/lib-cjs/component/elements/Message.js +0 -1
- package/lib-cjs/component/elements/PreferencesButton.js +13 -0
- package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
- package/lib-cjs/component/header/Header.js +1 -1
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +4 -4
- package/lib-cjs/component/main/InnerNMRiumContents.js +1 -2
- package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
- package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
- package/lib-cjs/component/panels/InformationPanel.js +7 -98
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib-cjs/component/panels/Panels.js +6 -7
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
- package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -9
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +4 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
- package/lib-cjs/component/reducer/core/Constants.js +1 -6
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
- package/lib-cjs/component/toolbar/ToolTypes.js +23 -24
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +3 -3
- /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
|
@@ -4,7 +4,6 @@ import { memo } from 'react';
|
|
|
4
4
|
import { useChartData } from '../context/ChartContext';
|
|
5
5
|
import { useScale } from '../context/ScaleContext';
|
|
6
6
|
import useSpectraByActiveNucleus from '../hooks/useSpectraPerNucleus';
|
|
7
|
-
import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
8
7
|
import ExclusionZoneAnnotation from './ExclusionZoneAnnotation';
|
|
9
8
|
function ExclusionZonesAnnotationsInner({ displayerKey, xDomains, spectra, shiftY, }) {
|
|
10
9
|
return (_jsx("g", { className: "spectrum-exclusion-zones-group", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: spectra
|
|
@@ -20,7 +19,7 @@ function ExclusionZonesAnnotations() {
|
|
|
20
19
|
const { displayerKey, xDomains, displayerMode } = useChartData();
|
|
21
20
|
const { shiftY } = useScale();
|
|
22
21
|
const spectra = useSpectraByActiveNucleus();
|
|
23
|
-
if (displayerMode !==
|
|
22
|
+
if (displayerMode !== '1D')
|
|
24
23
|
return null;
|
|
25
24
|
return (_jsx(MemoizedPeakAnnotations, { spectra: spectra, displayerKey: displayerKey, xDomains: xDomains, shiftY: shiftY }));
|
|
26
25
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Ranges, Zones } from 'nmr-processing';
|
|
2
2
|
import { MoleculeView, StateMoleculeExtended } from '../../../../data/molecules/Molecule';
|
|
3
|
-
import {
|
|
3
|
+
import { DisplayerMode } from '../../../reducer/Reducer';
|
|
4
4
|
interface DraggableStructureProps {
|
|
5
5
|
zones: Zones;
|
|
6
6
|
ranges: Ranges;
|
|
7
7
|
molecule: StateMoleculeExtended;
|
|
8
8
|
moleculeView: MoleculeView;
|
|
9
9
|
activeTab: string;
|
|
10
|
-
displayerMode:
|
|
10
|
+
displayerMode: DisplayerMode;
|
|
11
11
|
index?: number;
|
|
12
12
|
}
|
|
13
13
|
export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
@@ -36,7 +36,7 @@ export function DraggableStructure(props) {
|
|
|
36
36
|
const { zones, ranges, molecule, activeTab, displayerMode, index, moleculeView, } = props;
|
|
37
37
|
const { viewerRef } = useGlobal();
|
|
38
38
|
const dispatch = useDispatch();
|
|
39
|
-
const openMoleculeEditor = useMoleculeEditor();
|
|
39
|
+
const { modal, openMoleculeEditor } = useMoleculeEditor();
|
|
40
40
|
const { currentDiaIDsToHighlight, handleOnAtomHover, handleOnClickAtom, assignedDiaIDsMerged, } = useAtomAssignment({ zones, ranges, activeTab, displayerMode });
|
|
41
41
|
function floatMoleculeHandler() {
|
|
42
42
|
dispatch({
|
|
@@ -58,20 +58,20 @@ export function DraggableStructure(props) {
|
|
|
58
58
|
}
|
|
59
59
|
if (!viewerRef)
|
|
60
60
|
return null;
|
|
61
|
-
return (
|
|
61
|
+
return (_jsxs(Rnd, { default: moleculeView.floating.bounding, minWidth: 90 + AUTO_CROP_MARGIN * 2, minHeight: 100 + AUTO_CROP_MARGIN * 2, dragHandleClassName: "handle", enableUserSelectHack: false, bounds: viewerRef, style: { zIndex: 1 }, className: "draggable-molecule", onResizeStop: (e, dir, eRef, { width, height }) => dragFloatMoleculeHandler({ width, height }), onDragStop: (e, { x, y }) => {
|
|
62
62
|
dragFloatMoleculeHandler({ x, y });
|
|
63
|
-
}, resizeHandleWrapperStyle: { backgroundColor: 'white' }, css: style, children: _jsxs("div", { className: "content", onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(ResponsiveChart, { children: ({ width, height }) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
}, resizeHandleWrapperStyle: { backgroundColor: 'white' }, css: style, children: [_jsxs("div", { className: "content", onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(ResponsiveChart, { children: ({ width, height }) => {
|
|
64
|
+
return (_jsx(OCLnmr, { OCL: OCL, id: `molSVG${index || ''}`, autoCrop: true, autoCropMargin: AUTO_CROP_MARGIN, height: height - AUTO_CROP_MARGIN * 2, width: width - AUTO_CROP_MARGIN * 2, label: molecule.label, labelFontSize: 15, labelColor: "rgb(0,0,0)", molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
|
|
65
|
+
? currentDiaIDsToHighlight
|
|
66
|
+
: assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
|
|
67
|
+
dispatch({
|
|
68
|
+
type: 'SET_MOLECULE',
|
|
69
|
+
payload: {
|
|
70
|
+
molfile,
|
|
71
|
+
id: molecule.id,
|
|
72
|
+
label: molecule.label,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}, showAtomNumber: moleculeView.showAtomNumber }));
|
|
76
|
+
} })] }), modal] }));
|
|
77
77
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Zones, Ranges } from 'nmr-processing';
|
|
2
2
|
import { MoleculesView, StateMoleculeExtended } from '../../../../data/molecules/Molecule';
|
|
3
|
-
import {
|
|
3
|
+
import { DisplayerMode } from '../../../reducer/Reducer';
|
|
4
4
|
interface FloatMoleculeStructuresProps {
|
|
5
5
|
zones: Zones;
|
|
6
6
|
ranges: Ranges;
|
|
7
7
|
molecules: StateMoleculeExtended[];
|
|
8
8
|
moleculesView: MoleculesView;
|
|
9
9
|
activeTab: string;
|
|
10
|
-
displayerMode:
|
|
10
|
+
displayerMode: DisplayerMode;
|
|
11
11
|
}
|
|
12
12
|
export declare function FloatMoleculeStructuresInner(props: FloatMoleculeStructuresProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
13
|
export default function FloatMoleculeStructures(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,7 +9,6 @@ import { useChartData } from '../context/ChartContext';
|
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
10
|
import Spinner from '../loader/Spinner';
|
|
11
11
|
import { options } from '../toolbar/ToolTypes';
|
|
12
|
-
import { assert } from '../utility/assert';
|
|
13
12
|
import Chart2D from './Chart2D';
|
|
14
13
|
import FooterBanner from './FooterBanner';
|
|
15
14
|
import SlicingView from './SlicingView';
|
|
@@ -28,7 +27,6 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
28
27
|
if (spectra?.length === 1) {
|
|
29
28
|
const id = spectra[0].id;
|
|
30
29
|
const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
|
|
31
|
-
assert(spectrum, `Spectrum with id ${id} not found`);
|
|
32
30
|
return spectrum;
|
|
33
31
|
}
|
|
34
32
|
return null;
|
|
@@ -122,7 +120,7 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
122
120
|
margin: 'auto',
|
|
123
121
|
position: 'relative',
|
|
124
122
|
overflow: 'hidden',
|
|
125
|
-
}, children: _jsxs(MouseTracker, { style: { width: '100%', height: `100%`, position: 'absolute' }, children: [selectedTool && selectedTool === options.slicing.id && (_jsx(SlicingView, {})), _jsx(CrossLinePointer, {}),
|
|
123
|
+
}, children: _jsxs(MouseTracker, { style: { width: '100%', height: `100%`, position: 'absolute' }, children: [selectedTool && selectedTool === options.slicing.id && (_jsx(SlicingView, {})), _jsx(CrossLinePointer, {}), _jsx(XYLabelPointer, { data1D: spectrumData, layout: DIMENSION }), _jsx(BrushXY, { brushType: BRUSH_TYPE.XY, dimensionBorder: DIMENSION.CENTER_2D }), _jsxs(_Fragment, { children: [spectrumData[0] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.X, dimensionBorder: DIMENSION.TOP_1D, height: margin.top })), spectrumData[1] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.Y, dimensionBorder: DIMENSION.LEFT_1D, width: margin.left }))] }), _jsx(FooterBanner, { data1D: spectrumData, layout: DIMENSION }), _jsx(Chart2D, { spectra: spectrumData })] }) }))] })) }));
|
|
126
124
|
}
|
|
127
125
|
export function ViewerResponsiveWrapper(props) {
|
|
128
126
|
const dispatch = useDispatch();
|
|
@@ -11,7 +11,6 @@ import { HighlightEventSource, useHighlightData } from '../highlight/index';
|
|
|
11
11
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
12
12
|
import useExport from '../hooks/useExport';
|
|
13
13
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
14
|
-
import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
15
14
|
import { options } from '../toolbar/ToolTypes';
|
|
16
15
|
function KeysListenerTracker(props) {
|
|
17
16
|
const { mainDivRef } = props;
|
|
@@ -46,7 +45,7 @@ function KeysListenerTracker(props) {
|
|
|
46
45
|
}, [mainDivRef]);
|
|
47
46
|
const assignmentData = useAssignmentData();
|
|
48
47
|
const allow1DTool = useMemo(() => {
|
|
49
|
-
return displayerMode ===
|
|
48
|
+
return displayerMode === '1D' && data && data.length > 0;
|
|
50
49
|
}, [data, displayerMode]);
|
|
51
50
|
const deleteHandler = useCallback(async (sourceData) => {
|
|
52
51
|
const { type, extra } = sourceData;
|
|
@@ -16,7 +16,9 @@ import { SpectrumActions } from '../reducer/actions/SpectrumsActions';
|
|
|
16
16
|
import { ToolsActions } from '../reducer/actions/ToolsActions';
|
|
17
17
|
import { ZonesActions } from '../reducer/actions/ZonesActions';
|
|
18
18
|
import { ActionType } from '../reducer/types/ActionType';
|
|
19
|
-
export type Action = ToolsActions | SpectrumActions | SpectraAnalysisActions | LoadActions | IntegralsActions | RangesActions | DatabaseActions | DimensionsActions | AssignmentsActions | DomainActions | PreferencesActions | PeaksActions | MoleculeActions | ZonesActions | FiltersActions | CorrelationsActions | ActionType<'INITIALIZE_NMRIUM'
|
|
19
|
+
export type Action = ToolsActions | SpectrumActions | SpectraAnalysisActions | LoadActions | IntegralsActions | RangesActions | DatabaseActions | DimensionsActions | AssignmentsActions | DomainActions | PreferencesActions | PeaksActions | MoleculeActions | ZonesActions | FiltersActions | CorrelationsActions | ActionType<'INITIALIZE_NMRIUM'> | ActionType<'SECRET_THROW_ERROR', {
|
|
20
|
+
randomNumber: number;
|
|
21
|
+
}>;
|
|
20
22
|
export type Dispatch = (action: Action) => void;
|
|
21
23
|
export declare const dispatchContext: import("react").Context<Dispatch>;
|
|
22
24
|
export declare const DispatchProvider: import("react").Provider<Dispatch>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const labelStyle = {
|
|
3
|
+
margin: 0,
|
|
4
|
+
textAlign: 'right',
|
|
5
|
+
lineHeight: '22px',
|
|
6
|
+
padding: '0 5px',
|
|
7
|
+
whiteSpace: 'nowrap',
|
|
8
|
+
};
|
|
9
|
+
export function CounterLabel(props) {
|
|
10
|
+
const { children, style = {} } = props;
|
|
11
|
+
return _jsx("p", { style: { ...labelStyle, ...style }, children: children });
|
|
12
|
+
}
|
|
@@ -5,6 +5,7 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
5
5
|
const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, textOverFlowEllipses = false, ...InputProps } = props;
|
|
6
6
|
const [enabled, enableEdit] = useState();
|
|
7
7
|
const [isValid, setValid] = useState(true);
|
|
8
|
+
const [val, setVal] = useState(value);
|
|
8
9
|
useEffect(() => {
|
|
9
10
|
enableEdit(editStatus);
|
|
10
11
|
}, [editStatus]);
|
|
@@ -22,13 +23,13 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
22
23
|
window.removeEventListener('mousedown', mouseClickCallback);
|
|
23
24
|
}
|
|
24
25
|
}, []);
|
|
25
|
-
|
|
26
|
+
function startEditHandler() {
|
|
26
27
|
window.addEventListener('mousedown', mouseClickCallback);
|
|
27
28
|
onEditStart(true);
|
|
28
29
|
enableEdit(true);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const valid = validate(
|
|
30
|
+
}
|
|
31
|
+
function editHandler(event) {
|
|
32
|
+
const valid = validate(val);
|
|
32
33
|
setValid(valid);
|
|
33
34
|
// when press Enter or Tab
|
|
34
35
|
if (valid && ['Enter', 'Tab'].includes(event.key)) {
|
|
@@ -40,7 +41,10 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
40
41
|
enableEdit(false);
|
|
41
42
|
window.removeEventListener('mousedown', mouseClickCallback);
|
|
42
43
|
}
|
|
43
|
-
}
|
|
44
|
+
}
|
|
45
|
+
function handleChange(e) {
|
|
46
|
+
setVal(e.target.value);
|
|
47
|
+
}
|
|
44
48
|
return (_jsxs("div", { style: {
|
|
45
49
|
display: 'table',
|
|
46
50
|
width: '100%',
|
|
@@ -62,8 +66,10 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
62
66
|
width: '100%',
|
|
63
67
|
},
|
|
64
68
|
input: {
|
|
69
|
+
padding: '5px',
|
|
65
70
|
width: '100%',
|
|
71
|
+
minWidth: '60px',
|
|
66
72
|
},
|
|
67
|
-
},
|
|
73
|
+
}, autoSelect: true, className: "editable-column", value: val, type: type, onChange: handleChange, onKeyUp: editHandler, onMouseDown: (e) => e.stopPropagation(), ...InputProps }) }))] }));
|
|
68
74
|
});
|
|
69
75
|
export default EditableColumn;
|
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement } from 'react';
|
|
2
|
-
export type InputKeyboardEvent = React.KeyboardEvent & {
|
|
3
|
-
target: {
|
|
4
|
-
name: string;
|
|
5
|
-
value: string | number;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
2
|
export interface InputStyle {
|
|
9
3
|
input?: CSSProperties;
|
|
10
4
|
inputWrapper?: CSSProperties;
|
|
11
5
|
}
|
|
12
|
-
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style'
|
|
6
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style'> {
|
|
13
7
|
style?: InputStyle;
|
|
14
|
-
|
|
15
|
-
debounceTime?: number;
|
|
8
|
+
autoSelect?: boolean;
|
|
16
9
|
checkValue?: (element: number | string) => boolean;
|
|
17
10
|
format?: () => (element: string) => number | string;
|
|
18
11
|
renderIcon?: (() => ReactElement) | null;
|
|
19
12
|
canClear?: boolean;
|
|
20
13
|
onClear?: () => void;
|
|
21
|
-
onKeyDown?: (event: InputKeyboardEvent) => void;
|
|
22
|
-
onKeyUp?: (event: InputKeyboardEvent) => void;
|
|
23
|
-
nullable?: boolean;
|
|
24
14
|
datalist?: string[];
|
|
15
|
+
debounceTime?: number;
|
|
25
16
|
}
|
|
26
17
|
declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
27
18
|
export default Input;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import debounce from 'lodash/debounce';
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect, useRef, forwardRef, useMemo, useState, } from 'react';
|
|
4
4
|
import useCombinedRefs from '../hooks/useCombinedRefs';
|
|
5
5
|
const styles = {
|
|
6
|
-
label: {
|
|
7
|
-
lineHeight: 2,
|
|
8
|
-
userSelect: 'none',
|
|
9
|
-
},
|
|
10
6
|
inputWrapper: {
|
|
11
7
|
borderRadius: '5px',
|
|
12
8
|
borderWidth: '0.55px',
|
|
@@ -21,7 +17,6 @@ const styles = {
|
|
|
21
17
|
outline: 'none',
|
|
22
18
|
flex: 1,
|
|
23
19
|
height: '100%',
|
|
24
|
-
textAlign: 'center',
|
|
25
20
|
width: '100%',
|
|
26
21
|
},
|
|
27
22
|
clearButton: {
|
|
@@ -34,103 +29,56 @@ const styles = {
|
|
|
34
29
|
padding: 0,
|
|
35
30
|
},
|
|
36
31
|
};
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
const pattern = /^(?:-?\d*|\d+)(?:\.\d{0,20})?$/;
|
|
40
|
-
if (value.trim() === '' || pattern.test(value)) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
function identity(value) {
|
|
48
|
-
return value;
|
|
49
|
-
}
|
|
50
|
-
function preventPropagate(event) {
|
|
51
|
-
event.stopPropagation();
|
|
32
|
+
function mapValue(value) {
|
|
33
|
+
return typeof value === 'number' && value === 0 ? value : value || '';
|
|
52
34
|
}
|
|
53
35
|
const Input = forwardRef((props, ref) => {
|
|
54
|
-
const { value =
|
|
36
|
+
const { value: externalValue = undefined, name, style = {
|
|
55
37
|
input: {},
|
|
56
38
|
inputWrapper: {},
|
|
57
|
-
}, onChange
|
|
58
|
-
const [
|
|
59
|
-
const
|
|
39
|
+
}, onChange, checkValue = () => true, type = 'text', autoSelect = false, className, renderIcon, canClear = false, onClear, datalist = [], debounceTime = 0, ...otherProps } = props;
|
|
40
|
+
const [internalValue, setInternalValue] = useState();
|
|
41
|
+
const value = debounceTime ? internalValue : externalValue;
|
|
60
42
|
const localRef = useRef();
|
|
61
43
|
const combinedRef = useCombinedRefs([ref, localRef]);
|
|
62
|
-
const debounceOnChange = useMemo(() => debounce((
|
|
63
|
-
onChange?.(
|
|
44
|
+
const debounceOnChange = useMemo(() => debounce((e) => {
|
|
45
|
+
onChange?.(e);
|
|
64
46
|
}, debounceTime), [debounceTime, onChange]);
|
|
65
47
|
useEffect(() => {
|
|
66
|
-
|
|
67
|
-
}, [value]);
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (enableAutoSelect) {
|
|
48
|
+
if (autoSelect) {
|
|
70
49
|
combinedRef?.current?.select();
|
|
71
50
|
}
|
|
72
|
-
}, [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
? null
|
|
79
|
-
: Number(value)
|
|
80
|
-
: nullable && !value
|
|
81
|
-
? null
|
|
82
|
-
: value;
|
|
83
|
-
return format()(val);
|
|
84
|
-
}
|
|
51
|
+
}, [autoSelect, combinedRef]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (debounceTime) {
|
|
54
|
+
setInternalValue(externalValue);
|
|
55
|
+
}
|
|
56
|
+
}, [debounceTime, externalValue]);
|
|
85
57
|
function onChangeHandler(e) {
|
|
86
58
|
e.stopPropagation();
|
|
87
59
|
e.preventDefault();
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
const formatValue = format();
|
|
91
|
-
setVal(formatValue(_value));
|
|
92
|
-
valueRef.current = _value;
|
|
93
|
-
const val = {
|
|
94
|
-
...e,
|
|
95
|
-
target: { name: e.target.name, value: getValue(_value) },
|
|
96
|
-
};
|
|
60
|
+
const val = e.target.value;
|
|
61
|
+
if (checkValue(val)) {
|
|
97
62
|
if (debounceTime) {
|
|
98
|
-
|
|
63
|
+
setInternalValue(val);
|
|
64
|
+
debounceOnChange(e);
|
|
99
65
|
}
|
|
100
66
|
else {
|
|
101
|
-
onChange?.(
|
|
67
|
+
onChange?.(e);
|
|
102
68
|
}
|
|
103
69
|
}
|
|
104
70
|
}
|
|
105
|
-
function handleKeyDown(event) {
|
|
106
|
-
onKeyDown({
|
|
107
|
-
...event,
|
|
108
|
-
target: {
|
|
109
|
-
name: event.target.name,
|
|
110
|
-
value: getValue(valueRef.current),
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function handleKeyUp(event) {
|
|
115
|
-
onKeyUp({
|
|
116
|
-
...event,
|
|
117
|
-
target: {
|
|
118
|
-
name: event.target.name,
|
|
119
|
-
value: getValue(valueRef.current),
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
71
|
function clearHandler() {
|
|
124
|
-
|
|
72
|
+
localRef.current?.setAttribute('value', '');
|
|
125
73
|
onClear?.();
|
|
126
74
|
}
|
|
127
75
|
return (_jsxs("div", { style: {
|
|
128
|
-
...(renderIcon ||
|
|
76
|
+
...((renderIcon || canClear) && { padding: '0 5px' }),
|
|
129
77
|
...styles.inputWrapper,
|
|
130
78
|
...style?.inputWrapper,
|
|
131
79
|
}, className: `input ${className || ''}`, children: [renderIcon?.(), _jsx("input", { ...otherProps, ref: combinedRef, name: name, style: {
|
|
132
80
|
...styles.input,
|
|
133
81
|
...style?.input,
|
|
134
|
-
}, type:
|
|
82
|
+
}, 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))) })] }));
|
|
135
83
|
});
|
|
136
84
|
export default Input;
|
|
@@ -24,7 +24,6 @@ export const messagesColorPalettes = {
|
|
|
24
24
|
function Message(props) {
|
|
25
25
|
const { style = {}, type, children } = props;
|
|
26
26
|
return (_jsx("div", { style: {
|
|
27
|
-
fontSize: '1rem',
|
|
28
27
|
padding: '0.375rem 0.75rem',
|
|
29
28
|
borderRadius: '0.25rem',
|
|
30
29
|
backgroundColor: messagesColorPalettes[type].tint,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FaCog } from 'react-icons/fa';
|
|
3
|
+
import ToolTip from './ToolTip/ToolTip';
|
|
4
|
+
export function PreferencesButton({ onClick }) {
|
|
5
|
+
return (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onClick, children: _jsx(FaCog, {}) }) }));
|
|
6
|
+
}
|
|
@@ -3,9 +3,9 @@ export interface InputMapValueFunctions {
|
|
|
3
3
|
mapOnChangeValue?: (value: string | number) => any;
|
|
4
4
|
mapValue?: (value: any) => string | number;
|
|
5
5
|
}
|
|
6
|
-
interface FormikInputProps extends
|
|
6
|
+
interface FormikInputProps extends InputMapValueFunctions {
|
|
7
7
|
name: string;
|
|
8
8
|
checkErrorAfterInputTouched?: boolean;
|
|
9
9
|
}
|
|
10
|
-
declare function FormikInput(props: FormikInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function FormikInput(props: FormikInputProps & InputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default FormikInput;
|
|
@@ -2,14 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useFormikContext } from 'formik';
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
4
|
import Input from '../Input';
|
|
5
|
-
function identity(value) {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
5
|
function FormikInput(props) {
|
|
9
|
-
const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange
|
|
6
|
+
const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
|
|
10
7
|
const { values, handleChange, errors, touched, setFieldValue } = useFormikContext();
|
|
11
8
|
function changeHandler(e) {
|
|
12
|
-
onChange(e);
|
|
9
|
+
onChange?.(e);
|
|
13
10
|
if (mapOnChangeValue) {
|
|
14
11
|
void setFieldValue(name, mapOnChangeValue(e.target.value));
|
|
15
12
|
}
|
|
@@ -36,6 +33,6 @@ function FormikInput(props) {
|
|
|
36
33
|
}
|
|
37
34
|
: {}),
|
|
38
35
|
},
|
|
39
|
-
},
|
|
36
|
+
}, className: className, ...resProps }));
|
|
40
37
|
}
|
|
41
38
|
export default FormikInput;
|
|
@@ -11,8 +11,8 @@ import Button from '../elements/Button';
|
|
|
11
11
|
import { Header } from '../elements/Header';
|
|
12
12
|
import DropDownButton from '../elements/dropDownButton/DropDownButton';
|
|
13
13
|
import { useSaveSettings } from '../hooks/useSaveSettings';
|
|
14
|
-
import AboutUsModal from '../modal/AboutUsModal';
|
|
15
14
|
import { LogsHistoryModal } from '../modal/LogsHistoryModal';
|
|
15
|
+
import AboutUsModal from '../modal/aboutUs/AboutUsModal';
|
|
16
16
|
import GeneralSettingsModal from '../modal/setting/GeneralSettings';
|
|
17
17
|
import WorkspaceItem from '../modal/setting/WorkspaceItem';
|
|
18
18
|
import { options } from '../toolbar/ToolTypes';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Formik } from 'formik';
|
|
2
3
|
import { Filters } from 'nmr-processing';
|
|
3
4
|
import { memo, useRef } from 'react';
|
|
4
5
|
import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
|
|
5
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
7
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
8
|
import Label from '../elements/Label';
|
|
9
|
+
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
10
|
+
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
11
|
+
import FormikSelect from '../elements/formik/FormikSelect';
|
|
8
12
|
import { useFilter } from '../hooks/useFilter';
|
|
9
13
|
import useSpectrum from '../hooks/useSpectrum';
|
|
10
14
|
import { headerLabelStyle } from './Header';
|
|
11
15
|
import { HeaderContainer } from './HeaderContainer';
|
|
12
|
-
import { Formik } from 'formik';
|
|
13
|
-
import FormikSelect from '../elements/formik/FormikSelect';
|
|
14
|
-
import FormikCheckBox from '../elements/formik/FormikCheckBox';
|
|
15
|
-
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
16
16
|
const Sizes = generateNumbersPowerOfX(8, 21);
|
|
17
17
|
function useInitZeroFillingSize() {
|
|
18
18
|
const filter = useFilter(Filters.zeroFilling.id);
|
|
@@ -11,7 +11,6 @@ import { useChartData } from '../context/ChartContext';
|
|
|
11
11
|
import Header from '../header/Header';
|
|
12
12
|
import DropZone from '../loader/DropZone';
|
|
13
13
|
import Panels from '../panels/Panels';
|
|
14
|
-
import { DISPLAYER_MODE } from '../reducer/core/Constants';
|
|
15
14
|
import ToolBar from '../toolbar/ToolBar';
|
|
16
15
|
import { SplitPaneWrapper } from './SplitPaneWrapper';
|
|
17
16
|
import { StateError } from './StateError';
|
|
@@ -77,7 +76,7 @@ export function InnerNMRiumContents(props) {
|
|
|
77
76
|
width: '100%',
|
|
78
77
|
height: '100%',
|
|
79
78
|
position: 'relative',
|
|
80
|
-
}, children: [_jsx(FloatMoleculeStructures, {}), displayerMode ===
|
|
79
|
+
}, children: [_jsx(FloatMoleculeStructures, {}), displayerMode === '1D' ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
|
|
81
80
|
position: 'absolute',
|
|
82
81
|
pointerEvents: 'none',
|
|
83
82
|
zIndex: 2,
|