nmrium 0.50.1 → 0.52.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 +1 -1
- package/lib/component/1d/LinesSeries.js +2 -2
- package/lib/component/1d/Viewer1D.js +6 -11
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
- package/lib/component/2d/Viewer2D.js +16 -15
- package/lib/component/2d/ft/Contours.js +6 -3
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +12 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +32 -18
- package/lib/component/context/DispatchContext.d.ts +1 -1
- package/lib/component/context/ToasterContext.d.ts +13 -0
- package/lib/component/context/ToasterContext.js +34 -0
- package/lib/component/elements/Label.js +1 -1
- package/lib/component/elements/Select.js +2 -2
- package/lib/component/elements/ToolbarPopoverItem.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +1 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +7 -4
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -2
- package/lib/component/header/Header.d.ts +1 -11
- package/lib/component/header/Header.js +5 -6
- package/lib/component/header/PhaseCorrectionPanel.js +24 -33
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
- package/lib/component/header/RangesPickingOptionPanel.js +7 -4
- package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib/component/header/Zones2DOptionPanel.js +6 -2
- package/lib/component/hooks/useDialogToggle.d.ts +5 -0
- package/lib/component/hooks/useDialogToggle.js +16 -0
- package/lib/component/hooks/useExport.d.ts +9 -1
- package/lib/component/hooks/useExport.js +34 -36
- package/lib/component/hooks/useSaveSettings.js +6 -3
- package/lib/component/hooks/useToolsFunctions.d.ts +1 -1
- package/lib/component/hooks/useToolsFunctions.js +9 -7
- package/lib/component/loader/DropZone.js +14 -14
- package/lib/component/main/InnerNMRium.js +5 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
- package/lib/component/main/InnerNMRiumContents.js +5 -3
- package/lib/component/main/NMRium.js +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +15 -15
- package/lib/component/modal/ImportPublicationStringModal.js +5 -3
- package/lib/component/modal/LoadJCAMPModal.js +7 -5
- package/lib/component/modal/LogsHistoryModal.js +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +11 -9
- package/lib/component/modal/SaveAsModal.d.ts +3 -4
- package/lib/component/modal/SaveAsModal.js +27 -27
- package/lib/component/modal/editRange/EditRangeModal.js +2 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
- package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
- package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +2 -2
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
- package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
- package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +9 -6
- package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +1 -1
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
- package/lib/component/panels/Panels.js +5 -5
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
- package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js +5 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +1 -1
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.d.ts +5 -0
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPanelHeader.js +11 -11
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.js +12 -6
- package/lib/component/panels/SpectraPanel/SpectraTabs.d.ts +1 -0
- package/lib/component/panels/{SpectrumsPanel/SpectrumsTabs.js → SpectraPanel/SpectraTabs.js} +6 -6
- package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.js +2 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
- package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
- package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
- package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +7 -5
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +5 -5
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +6 -6
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +5 -3
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +3 -2
- package/lib/component/reducer/Reducer.js +40 -32
- package/lib/component/reducer/actions/DomainActions.js +3 -3
- package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
- package/lib/component/reducer/actions/FiltersActions.js +243 -91
- package/lib/component/reducer/actions/IntegralsActions.js +2 -2
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +0 -1
- package/lib/component/reducer/actions/PreferencesActions.js +2 -2
- package/lib/component/reducer/actions/RangesActions.js +16 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +6 -6
- package/lib/component/reducer/actions/ToolsActions.js +83 -22
- package/lib/component/reducer/actions/ZonesActions.d.ts +2 -0
- package/lib/component/reducer/actions/ZonesActions.js +5 -1
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
- package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
- package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
- package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
- package/lib/component/toolbar/ToolBar.js +32 -27
- package/lib/component/toolbar/toolbarMenu.js +4 -4
- package/lib/component/utility/Events.d.ts +11 -0
- package/lib/component/utility/Events.js +22 -0
- package/lib/constants.js +5 -5
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
- package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +3 -3
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -0
- package/lib/data/getDefaultMatrixFilters.js +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
- package/lib/versionInfo.js +1 -1
- package/package.json +32 -30
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
- package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
- package/lib/component/elements/popup/Alert/Context.js +0 -10
- package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
- package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
- package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
- package/lib/component/elements/popup/Alert/Provider.js +0 -127
- package/lib/component/elements/popup/Alert/index.d.ts +0 -3
- package/lib/component/elements/popup/Alert/index.js +0 -3
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
- package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
- package/lib/component/modal/metaImportation/index.d.ts +0 -2
- package/lib/component/modal/metaImportation/index.js +0 -17
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.d.ts +0 -5
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.d.ts +0 -1
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.js +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.d.ts +0 -0
- /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.js +0 -0
- /package/lib/component/reducer/actions/{SpectrumsActions.d.ts → SpectraActions.d.ts} +0 -0
- /package/lib/component/reducer/actions/{SpectrumsActions.js → SpectraActions.js} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { FaTimes } from 'react-icons/fa';
|
|
5
|
-
import { types } from '../options';
|
|
6
|
-
import ProgressIndicator from './ProgressIndicator';
|
|
7
|
-
const style = css `
|
|
8
|
-
padding: 25px;
|
|
9
|
-
border-radius: 10px;
|
|
10
|
-
pointer-events: all;
|
|
11
|
-
min-height: 60px;
|
|
12
|
-
position: relative;
|
|
13
|
-
|
|
14
|
-
> button {
|
|
15
|
-
position: absolute;
|
|
16
|
-
right: 5px;
|
|
17
|
-
top: 5px;
|
|
18
|
-
border: none;
|
|
19
|
-
background-color: transparent;
|
|
20
|
-
color: white;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
export default function AlertBlock(props) {
|
|
24
|
-
const { offset, alert, onClose } = props;
|
|
25
|
-
return (_jsxs("div", { css: style, style: {
|
|
26
|
-
margin: offset,
|
|
27
|
-
backgroundColor: alert.options.backgroundColor,
|
|
28
|
-
color: alert.options.color,
|
|
29
|
-
}, children: [_jsx("button", { type: "button", onClick: onClose, children: _jsx(FaTimes, {}) }), _jsx("span", { children: alert.message }), alert.options.type === types.PROGRESS_INDICATOR && _jsx(ProgressIndicator, {})] }, alert.id));
|
|
30
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Position, Type } from '../options';
|
|
3
|
-
export interface AlertOption {
|
|
4
|
-
position?: Position;
|
|
5
|
-
timeout?: number;
|
|
6
|
-
type?: Type;
|
|
7
|
-
/** CSS string color */
|
|
8
|
-
backgroundColor?: string;
|
|
9
|
-
/** CSS string color */
|
|
10
|
-
color?: string;
|
|
11
|
-
onOpen?: () => void;
|
|
12
|
-
}
|
|
13
|
-
export interface Alert {
|
|
14
|
-
id: string;
|
|
15
|
-
message?: string;
|
|
16
|
-
options: AlertOption;
|
|
17
|
-
close: () => void;
|
|
18
|
-
}
|
|
19
|
-
export interface AlertAPI {
|
|
20
|
-
show: (message?: string, options?: AlertOption) => Alert;
|
|
21
|
-
success: (message?: string, options?: AlertOption) => Alert;
|
|
22
|
-
error: (message?: string, options?: AlertOption) => Alert;
|
|
23
|
-
info: (message?: string, options?: AlertOption) => Alert;
|
|
24
|
-
showLoading: (message?: string, options?: AlertOption) => Promise<() => void>;
|
|
25
|
-
}
|
|
26
|
-
export declare const AlertProvider: import("react").Provider<AlertAPI | null>;
|
|
27
|
-
export declare function useAlert(): AlertAPI;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
const AlertContext = createContext(null);
|
|
3
|
-
export const AlertProvider = AlertContext.Provider;
|
|
4
|
-
export function useAlert() {
|
|
5
|
-
const context = useContext(AlertContext);
|
|
6
|
-
if (!context) {
|
|
7
|
-
throw new Error('useAlert should be mount into an AlertProvider');
|
|
8
|
-
}
|
|
9
|
-
return context;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function ProgressIndicator(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
const styles = css `
|
|
5
|
-
width: 40px;
|
|
6
|
-
height: 40px;
|
|
7
|
-
margin: 0 auto;
|
|
8
|
-
|
|
9
|
-
::after {
|
|
10
|
-
content: ' ';
|
|
11
|
-
display: block;
|
|
12
|
-
width: 30px;
|
|
13
|
-
height: 30px;
|
|
14
|
-
margin-top: 10px;
|
|
15
|
-
border-radius: 50%;
|
|
16
|
-
border: 4px solid;
|
|
17
|
-
border-color: #fff transparent;
|
|
18
|
-
animation: ring-animation 1s linear infinite;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes ring-animation {
|
|
22
|
-
0% {
|
|
23
|
-
transform: rotate(0deg);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
100% {
|
|
27
|
-
transform: rotate(360deg);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
export default function ProgressIndicator() {
|
|
32
|
-
return _jsx("div", { css: styles });
|
|
33
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import { Position, Type, Transition as TransitionOption } from '../options';
|
|
3
|
-
interface ProviderProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
offset?: string;
|
|
6
|
-
position?: Position;
|
|
7
|
-
timeout?: number;
|
|
8
|
-
type?: Type;
|
|
9
|
-
transition?: TransitionOption;
|
|
10
|
-
containerStyle?: CSSProperties;
|
|
11
|
-
wrapperRef?: any;
|
|
12
|
-
context?: {
|
|
13
|
-
Provider?: any;
|
|
14
|
-
Consumer?: any;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
declare function Provider({ children, wrapperRef, offset, position, timeout, type, transition, ...props }: ProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
declare const _default: import("react").MemoExoticComponent<typeof Provider>;
|
|
19
|
-
export default _default;
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import groupBy from 'lodash/groupBy';
|
|
3
|
-
import { Fragment, useState, useRef, useEffect, useCallback, useMemo, memo, } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
import { TransitionGroup } from 'react-transition-group';
|
|
6
|
-
import Transition from '../Transition';
|
|
7
|
-
import Wrapper from '../Wrapper';
|
|
8
|
-
import { positions, transitions, types, } from '../options';
|
|
9
|
-
import AlertBlock from './AlertBlock';
|
|
10
|
-
import { AlertProvider } from './Context';
|
|
11
|
-
function Provider({ children, wrapperRef = null, offset = '5px', position = positions.BOTTOM_CENTER, timeout = 3000, type, transition = transitions.FADE, ...props }) {
|
|
12
|
-
const root = useRef(null);
|
|
13
|
-
const timersId = useRef([]);
|
|
14
|
-
const [alerts, setAlerts] = useState([]);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
root.current = document.createElement('div');
|
|
17
|
-
const ref = root.current;
|
|
18
|
-
const timersIdRef = timersId.current;
|
|
19
|
-
if (wrapperRef) {
|
|
20
|
-
wrapperRef.append(ref);
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
if (ref && wrapperRef) {
|
|
24
|
-
for (const id of timersIdRef) {
|
|
25
|
-
clearTimeout(id);
|
|
26
|
-
}
|
|
27
|
-
ref.remove();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}, [wrapperRef]);
|
|
31
|
-
const remove = useCallback((alert) => {
|
|
32
|
-
setAlerts((currentAlerts) => {
|
|
33
|
-
const lengthBeforeRemove = currentAlerts.length;
|
|
34
|
-
const filteredAlerts = currentAlerts.filter((a) => a.id !== alert.id);
|
|
35
|
-
if (lengthBeforeRemove > filteredAlerts.length && alert.options.onClose) {
|
|
36
|
-
alert.options.onClose();
|
|
37
|
-
}
|
|
38
|
-
return filteredAlerts;
|
|
39
|
-
});
|
|
40
|
-
}, []);
|
|
41
|
-
const show = useCallback((message = '', options = {}) => {
|
|
42
|
-
const id = Math.random().toString(36).slice(2, 9);
|
|
43
|
-
const alertOptions = {
|
|
44
|
-
position: options.position || position,
|
|
45
|
-
timeout,
|
|
46
|
-
type,
|
|
47
|
-
backgroundColor: 'black',
|
|
48
|
-
color: 'white',
|
|
49
|
-
...options,
|
|
50
|
-
};
|
|
51
|
-
const alert = {
|
|
52
|
-
id,
|
|
53
|
-
message,
|
|
54
|
-
options: alertOptions,
|
|
55
|
-
close: () => remove(alert),
|
|
56
|
-
};
|
|
57
|
-
if (alert.options.timeout) {
|
|
58
|
-
const timerId = window.setTimeout(() => {
|
|
59
|
-
remove(alert);
|
|
60
|
-
timersId.current.splice(timersId.current.indexOf(timerId), 1);
|
|
61
|
-
}, alert.options.timeout);
|
|
62
|
-
timersId.current.push(timerId);
|
|
63
|
-
}
|
|
64
|
-
setAlerts((state) => state.concat(alert));
|
|
65
|
-
if (alert.options.onOpen)
|
|
66
|
-
alert.options.onOpen();
|
|
67
|
-
return alert;
|
|
68
|
-
}, [position, remove, timeout, type]);
|
|
69
|
-
const success = useCallback((message = '', options = {}) => {
|
|
70
|
-
options.type = types.SUCCESS;
|
|
71
|
-
options = { backgroundColor: '#28ba62', color: 'white', ...options };
|
|
72
|
-
return show(message, options);
|
|
73
|
-
}, [show]);
|
|
74
|
-
const error = useCallback((message = '', options = {}) => {
|
|
75
|
-
const alertOptions = {
|
|
76
|
-
type: types.ERROR,
|
|
77
|
-
backgroundColor: '#cf3c4f',
|
|
78
|
-
color: 'white',
|
|
79
|
-
timeout: 0,
|
|
80
|
-
...options,
|
|
81
|
-
};
|
|
82
|
-
return show(message, alertOptions);
|
|
83
|
-
}, [show]);
|
|
84
|
-
const info = useCallback((message = '', options = {}) => {
|
|
85
|
-
const alertOptions = {
|
|
86
|
-
type: types.INFO,
|
|
87
|
-
backgroundColor: '#28ba62',
|
|
88
|
-
...options,
|
|
89
|
-
};
|
|
90
|
-
return show(message, alertOptions);
|
|
91
|
-
}, [show]);
|
|
92
|
-
const showLoading = useCallback((message = 'Process in progress', options = {}) => {
|
|
93
|
-
const alertOptions = {
|
|
94
|
-
type: types.PROGRESS_INDICATOR,
|
|
95
|
-
backgroundColor: '#232323',
|
|
96
|
-
timeout: 0,
|
|
97
|
-
...options,
|
|
98
|
-
};
|
|
99
|
-
return new Promise((resolve) => {
|
|
100
|
-
const alert = show(message, alertOptions);
|
|
101
|
-
setTimeout(() => {
|
|
102
|
-
resolve(() => remove(alert));
|
|
103
|
-
}, 500);
|
|
104
|
-
});
|
|
105
|
-
}, [remove, show]);
|
|
106
|
-
const closeHandler = useCallback((alert) => {
|
|
107
|
-
remove(alert);
|
|
108
|
-
}, [remove]);
|
|
109
|
-
const alertsByPosition = groupBy(alerts, (alert) => alert.options.position);
|
|
110
|
-
const parentStyle = wrapperRef
|
|
111
|
-
? wrapperRef.getBoundingClientRect()
|
|
112
|
-
: {
|
|
113
|
-
top: 0,
|
|
114
|
-
left: 0,
|
|
115
|
-
width: window.innerWidth,
|
|
116
|
-
height: window.innerHeight,
|
|
117
|
-
};
|
|
118
|
-
const alertContextValue = useMemo(() => ({ show, success, error, info, showLoading }), [show, success, error, info, showLoading]);
|
|
119
|
-
return (_jsxs(AlertProvider, { value: alertContextValue, children: [children, root.current &&
|
|
120
|
-
createPortal(_jsx(Fragment, { children: Object.keys(positions).map((key) => {
|
|
121
|
-
const position = positions[key];
|
|
122
|
-
return (_jsx(TransitionGroup, { appear: true, options: { position, zIndex: 999999 }, component: Wrapper, containerStyle: parentStyle, ...props, children: alertsByPosition[position]
|
|
123
|
-
? alertsByPosition[position].map((alert) => (_jsx(Transition, { type: transition, children: _jsx(AlertBlock, { offset: offset, alert: alert, onClose: () => closeHandler(alert) }) }, alert.id)))
|
|
124
|
-
: null }, position));
|
|
125
|
-
}) }), root.current)] }));
|
|
126
|
-
}
|
|
127
|
-
export default memo(Provider);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { WorkSpacePanelPreferences } from 'nmr-load-save';
|
|
3
|
-
interface AddSignalFormTabProps {
|
|
4
|
-
onFocus: (element: any) => void;
|
|
5
|
-
onBlur?: () => void;
|
|
6
|
-
range: any;
|
|
7
|
-
preferences: WorkSpacePanelPreferences['ranges'];
|
|
8
|
-
}
|
|
9
|
-
declare const _default: import("react").ForwardRefExoticComponent<AddSignalFormTabProps & import("react").RefAttributes<unknown>>;
|
|
10
|
-
export default _default;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { Formik, useFormikContext } from 'formik';
|
|
5
|
-
import { translateMultiplet } from 'nmr-processing';
|
|
6
|
-
import { forwardRef, useCallback, useMemo } from 'react';
|
|
7
|
-
import { FaPlus } from 'react-icons/fa';
|
|
8
|
-
import * as Yup from 'yup';
|
|
9
|
-
import Button from '../../../../elements/Button';
|
|
10
|
-
import FormikInput from '../../../../elements/formik/FormikInput';
|
|
11
|
-
import { formatNumber } from '../../../../utility/formatNumber';
|
|
12
|
-
const styles = {
|
|
13
|
-
container: css `
|
|
14
|
-
text-align: center;
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
|
-
padding: 0.4rem;
|
|
18
|
-
`,
|
|
19
|
-
inputInfo: css `
|
|
20
|
-
font-size: 10px;
|
|
21
|
-
color: black;
|
|
22
|
-
font-weight: bold;
|
|
23
|
-
`,
|
|
24
|
-
infoText: css `
|
|
25
|
-
padding: 10px;
|
|
26
|
-
font-size: 13px;
|
|
27
|
-
`,
|
|
28
|
-
signalContainer: css `
|
|
29
|
-
border: 0.55px solid #dedede;
|
|
30
|
-
`,
|
|
31
|
-
inputContainer: css `
|
|
32
|
-
display: flex;
|
|
33
|
-
justify-content: center;
|
|
34
|
-
`,
|
|
35
|
-
};
|
|
36
|
-
// TODO: this seems to be a hacky use of ref.
|
|
37
|
-
function AddSignalFormTab({ onFocus, onBlur, range, preferences }, ref) {
|
|
38
|
-
const { values, setFieldValue } = useFormikContext();
|
|
39
|
-
const saveHandler = useCallback((val) => {
|
|
40
|
-
const newSignal = {
|
|
41
|
-
multiplicity: 'm',
|
|
42
|
-
kind: 'signal',
|
|
43
|
-
delta: Number(val.newSignalDelta),
|
|
44
|
-
js: [{ multiplicity: translateMultiplet('m'), coupling: '' }],
|
|
45
|
-
};
|
|
46
|
-
const _signals = values.signals.slice().concat(newSignal);
|
|
47
|
-
void setFieldValue('signals', _signals);
|
|
48
|
-
void setFieldValue('activeTab', String(_signals.length - 1));
|
|
49
|
-
}, [setFieldValue, values.signals]);
|
|
50
|
-
const validation = useMemo(() => {
|
|
51
|
-
return Yup.object().shape({
|
|
52
|
-
newSignalDelta: Yup.number()
|
|
53
|
-
.test(`test-range`, '', function testNewSignalDelta(value) {
|
|
54
|
-
// eslint-disable-next-line no-invalid-this
|
|
55
|
-
const { path, createError } = this;
|
|
56
|
-
if (value && value > range.from && value < range.to) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
const errorMessage = ` ${value ? value.toFixed(5) : 0} ppm out of the range`;
|
|
60
|
-
return createError({ path, message: errorMessage });
|
|
61
|
-
})
|
|
62
|
-
.required(),
|
|
63
|
-
});
|
|
64
|
-
}, [range]);
|
|
65
|
-
const triggerSubmitHandler = useCallback(() => {
|
|
66
|
-
ref.current.submitForm();
|
|
67
|
-
}, [ref]);
|
|
68
|
-
return (_jsx("div", { css: styles.container, children: _jsxs("div", { children: [_jsx("p", { css: styles.infoText, children: "Edit or select a delta value of new signal (ppm):" }), _jsx(Formik, { innerRef: ref, validationSchema: validation, initialValues: {
|
|
69
|
-
newSignalDelta: (range.from + range.to) / 2,
|
|
70
|
-
}, onSubmit: saveHandler, children: _jsxs(_Fragment, { children: [_jsxs("div", { css: styles.inputContainer, children: [_jsx(FormikInput, { name: "newSignalDelta", type: "number", placeholder: `𝛅 (ppm)`, onFocus: onFocus, onBlur: onBlur, style: {
|
|
71
|
-
input: {
|
|
72
|
-
width: '250px',
|
|
73
|
-
height: '30px',
|
|
74
|
-
padding: '0.25rem 0.5rem',
|
|
75
|
-
},
|
|
76
|
-
}, checkErrorAfterInputTouched: false }), _jsx(Button.Done, { style: {
|
|
77
|
-
marginLeft: '5px',
|
|
78
|
-
height: '30px',
|
|
79
|
-
}, onClick: triggerSubmitHandler, children: _jsx(FaPlus, { title: "Add new signal" }) })] }), _jsxs("p", { css: styles.inputInfo, children: ["[", `${formatNumber(range.from, preferences.from.format)} ppm - ${formatNumber(range.to, preferences.to.format)} ppm`, "]"] })] }) })] }) }));
|
|
80
|
-
}
|
|
81
|
-
export default forwardRef(AddSignalFormTab);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface CouplingsTableProps {
|
|
3
|
-
push: (element: {
|
|
4
|
-
multiplicity?: string;
|
|
5
|
-
coupling: string;
|
|
6
|
-
}) => void;
|
|
7
|
-
remove: (element: number) => void;
|
|
8
|
-
onFocus: (element: any) => void;
|
|
9
|
-
onBlur?: () => void;
|
|
10
|
-
}
|
|
11
|
-
declare function CouplingsTable({ push, remove, onFocus, onBlur, }: CouplingsTableProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
-
declare const _default: import("react").MemoExoticComponent<typeof CouplingsTable>;
|
|
13
|
-
export default _default;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { useFormikContext } from 'formik';
|
|
5
|
-
import lodashGet from 'lodash/get';
|
|
6
|
-
import { translateMultiplet } from 'nmr-processing';
|
|
7
|
-
import { memo, useCallback } from 'react';
|
|
8
|
-
import { FaPlus, FaRegTrashAlt } from 'react-icons/fa';
|
|
9
|
-
import { Multiplets } from '../../../../../data/constants/Multiplets';
|
|
10
|
-
import Button from '../../../../elements/Button';
|
|
11
|
-
import FormikInput from '../../../../elements/formik/FormikInput';
|
|
12
|
-
import FormikSelect from '../../../../elements/formik/FormikSelect';
|
|
13
|
-
import { hasCouplingConstant } from '../../../../panels/extra/utilities/MultiplicityUtilities';
|
|
14
|
-
const CouplingsTableStyle = css `
|
|
15
|
-
border-spacing: 0;
|
|
16
|
-
border: 1px solid #dedede;
|
|
17
|
-
width: 100%;
|
|
18
|
-
height: 100%;
|
|
19
|
-
font-size: 12px;
|
|
20
|
-
|
|
21
|
-
th,
|
|
22
|
-
td {
|
|
23
|
-
text-align: center;
|
|
24
|
-
margin: 0;
|
|
25
|
-
padding: 0.3rem;
|
|
26
|
-
border-bottom: 1px solid #f5f5f5;
|
|
27
|
-
|
|
28
|
-
.select-box {
|
|
29
|
-
background-color: transparent;
|
|
30
|
-
border: 0.5px solid #dedede;
|
|
31
|
-
height: 100%;
|
|
32
|
-
width: 100% !important;
|
|
33
|
-
text-align: center;
|
|
34
|
-
margin: 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
function CouplingsTable({ push, remove, onFocus, onBlur, }) {
|
|
39
|
-
const { values, setFieldValue } = useFormikContext();
|
|
40
|
-
const multiplicityChangeHandler = useCallback((value, name) => {
|
|
41
|
-
if (!hasCouplingConstant(value)) {
|
|
42
|
-
void setFieldValue(name, '');
|
|
43
|
-
}
|
|
44
|
-
}, [setFieldValue]);
|
|
45
|
-
const couplingsList = lodashGet(values, `signals[${values.activeTab}].js`, []);
|
|
46
|
-
return (_jsxs("div", { children: [_jsxs(Button.Done, { fill: "outline", style: { overflow: 'auto' }, onClick: () => push({
|
|
47
|
-
multiplicity: translateMultiplet('m'),
|
|
48
|
-
coupling: '',
|
|
49
|
-
}), children: [_jsx(FaPlus, { title: "Add new coupling", style: { display: 'inline-block' } }), _jsx("span", { style: { display: 'inline-block', paddingLeft: '5px' }, children: "Add New Coupling" })] }), _jsx("div", { style: { maxHeight: '300px', overflow: 'auto' }, children: _jsxs("table", { css: CouplingsTableStyle, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "#" }), _jsx("th", { children: "Multiplicity" }), _jsx("th", { children: "J (Hz)" }), _jsx("th", { children: '' })] }) }), _jsx("tbody", { style: { overflow: 'auto' }, children: couplingsList.map((_coupling, i) => (_jsxs("tr", { children: [_jsx("td", { children: i + 1 }), _jsx("td", { children: _jsx(FormikSelect, { className: "select-box", name: `signals.${values.activeTab}.js.${i}.multiplicity`, items: Multiplets, itemValueField: "label", onChange: (value) => {
|
|
50
|
-
multiplicityChangeHandler(value, `signals.${values.activeTab}.js.${i}.coupling`);
|
|
51
|
-
}, style: {
|
|
52
|
-
height: '26px',
|
|
53
|
-
} }) }), _jsx("td", { children: _jsx(FormikInput, { name: `signals.${values.activeTab}.js.${i}.coupling`, type: "number", placeholder: 'J (Hz)', disabled: !hasCouplingConstant(_coupling.multiplicity), onFocus: onFocus, onBlur: onBlur, style: {
|
|
54
|
-
input: {
|
|
55
|
-
width: '100%',
|
|
56
|
-
height: '26px',
|
|
57
|
-
padding: '0.25rem 0.5rem',
|
|
58
|
-
},
|
|
59
|
-
}, checkErrorAfterInputTouched: false }) }), _jsx("td", { children: _jsx("div", { style: { display: 'flex' }, children: _jsx(Button.Danger, { fill: "clear", onClick: () => {
|
|
60
|
-
remove(i);
|
|
61
|
-
}, children: _jsx(FaRegTrashAlt, { title: "Delete coupling" }) }) }) })] }, `editCouplings${values.activeTab}${i}`))) })] }) })] }));
|
|
62
|
-
}
|
|
63
|
-
export default memo(CouplingsTable);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function SignalFormInfo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface SignalFormTabProps {
|
|
3
|
-
onFocus: (element: any) => void;
|
|
4
|
-
onBlur?: () => void;
|
|
5
|
-
}
|
|
6
|
-
declare function SignalFormTab({ onFocus, onBlur }: SignalFormTabProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
declare const _default: import("react").MemoExoticComponent<typeof SignalFormTab>;
|
|
8
|
-
export default _default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFormikContext, FieldArray } from 'formik';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import CouplingsTable from './CouplingsTable';
|
|
5
|
-
const style = {
|
|
6
|
-
borderSpacing: '0',
|
|
7
|
-
width: '100%',
|
|
8
|
-
fontSize: '12px',
|
|
9
|
-
height: '100%',
|
|
10
|
-
margin: '0',
|
|
11
|
-
padding: '0.4rem',
|
|
12
|
-
textAlign: 'center',
|
|
13
|
-
};
|
|
14
|
-
function SignalFormTab({ onFocus, onBlur }) {
|
|
15
|
-
const { values } = useFormikContext();
|
|
16
|
-
return (_jsx("div", { style: style, children: _jsx(FieldArray, { name: `signals.${values.activeTab}.js`, render: ({ push, remove }) => (_jsx(CouplingsTable, { push: push, remove: remove, onFocus: onFocus, onBlur: onBlur })) }) }));
|
|
17
|
-
}
|
|
18
|
-
export default memo(SignalFormTab);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { WorkSpacePanelPreferences } from 'nmr-load-save';
|
|
3
|
-
import { Range } from 'nmr-processing';
|
|
4
|
-
interface SignalsFormProps {
|
|
5
|
-
range: Range;
|
|
6
|
-
preferences: WorkSpacePanelPreferences['ranges'];
|
|
7
|
-
}
|
|
8
|
-
declare function SignalsForm({ range, preferences }: SignalsFormProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
-
declare const _default: import("react").MemoExoticComponent<typeof SignalsForm>;
|
|
10
|
-
export default _default;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { useFormikContext } from 'formik';
|
|
5
|
-
import { useCallback, useMemo, memo, useEffect, useState, useRef } from 'react';
|
|
6
|
-
import { FaPlus } from 'react-icons/fa';
|
|
7
|
-
import Tab from '../../../../elements/Tab/Tab';
|
|
8
|
-
import Tabs from '../../../../elements/Tab/Tabs';
|
|
9
|
-
import useSpectrum from '../../../../hooks/useSpectrum';
|
|
10
|
-
import Events from '../../../../utility/Events';
|
|
11
|
-
import { formatNumber } from '../../../../utility/formatNumber';
|
|
12
|
-
import AddSignalFormTab from './AddSignalFormTab';
|
|
13
|
-
import DeltaInput from './DeltaInput';
|
|
14
|
-
import { SignalFormInfo } from './SignalFormInfo';
|
|
15
|
-
import SignalFormTab from './SignalFormTab';
|
|
16
|
-
const tabStylesAddition = css `
|
|
17
|
-
color: red;
|
|
18
|
-
`;
|
|
19
|
-
const tabStyles = css `
|
|
20
|
-
padding: 0 1.5rem !important;
|
|
21
|
-
height: 40px;
|
|
22
|
-
`;
|
|
23
|
-
const newTabStyles = css `
|
|
24
|
-
padding: 0 !important;
|
|
25
|
-
height: 40px;
|
|
26
|
-
`;
|
|
27
|
-
function SignalsForm({ range, preferences }) {
|
|
28
|
-
const newSignalFormRef = useRef();
|
|
29
|
-
const [activeField, setActiveField] = useState(null);
|
|
30
|
-
const { values, setFieldValue, errors, } = useFormikContext();
|
|
31
|
-
const { info } = useSpectrum({ info: {} });
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
function handle(event) {
|
|
34
|
-
if (info?.originFrequency && activeField) {
|
|
35
|
-
if (values.activeTab === 'addSignalTab') {
|
|
36
|
-
newSignalFormRef.current.setValues({
|
|
37
|
-
[activeField]: (event.range[1] - event.range[0]) / 2 + event.range[0],
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
else if (activeField.includes('delta')) {
|
|
41
|
-
setFieldValue(activeField, (event.range[1] - event.range[0]) / 2 + event.range[0]);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const value = Number(formatNumber(Math.abs(event.range[0] - event.range[1]) * info.originFrequency, preferences.deltaHz.format));
|
|
45
|
-
setFieldValue(activeField, value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
setActiveField(null);
|
|
49
|
-
}
|
|
50
|
-
Events.on('brushEnd', handle);
|
|
51
|
-
return () => {
|
|
52
|
-
Events.off('brushEnd', handle);
|
|
53
|
-
};
|
|
54
|
-
}, [
|
|
55
|
-
activeField,
|
|
56
|
-
setFieldValue,
|
|
57
|
-
values.activeTab,
|
|
58
|
-
info,
|
|
59
|
-
preferences?.deltaHz?.format,
|
|
60
|
-
]);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
function handle(event) {
|
|
63
|
-
if (activeField) {
|
|
64
|
-
if (values.activeTab === 'addSignalTab') {
|
|
65
|
-
newSignalFormRef.current.setValues({ [activeField]: event.xPPM });
|
|
66
|
-
}
|
|
67
|
-
else if (activeField.includes('delta')) {
|
|
68
|
-
setFieldValue(activeField, event.xPPM);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
setActiveField(null);
|
|
72
|
-
}
|
|
73
|
-
Events.on('mouseClick', handle);
|
|
74
|
-
return () => {
|
|
75
|
-
Events.off('mouseClick', handle);
|
|
76
|
-
};
|
|
77
|
-
}, [values.activeTab, activeField, setFieldValue]);
|
|
78
|
-
const handleOnFocus = useCallback((event) => {
|
|
79
|
-
setActiveField(event.target.name);
|
|
80
|
-
}, [setActiveField]);
|
|
81
|
-
const tapClickHandler = useCallback(({ tabid }) => {
|
|
82
|
-
setFieldValue('activeTab', tabid);
|
|
83
|
-
}, [setFieldValue]);
|
|
84
|
-
const handleDeleteSignal = useCallback(({ tabid }) => {
|
|
85
|
-
const _signals = values.signals.filter((_signal, i) => i !== Number(tabid));
|
|
86
|
-
setFieldValue('signals', _signals);
|
|
87
|
-
}, [setFieldValue, values.signals]);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
setFieldValue('activeTab', values.signals.length > 0
|
|
90
|
-
? (values.signals.length - 1).toString()
|
|
91
|
-
: 'addSignalTab');
|
|
92
|
-
}, [setFieldValue, values.signals.length]);
|
|
93
|
-
const tabContainsErrors = useCallback((i) => {
|
|
94
|
-
return !!errors?.signals?.[i];
|
|
95
|
-
}, [errors]);
|
|
96
|
-
const signalFormTabs = useMemo(() => {
|
|
97
|
-
const signalTabs = values.signals.length > 0
|
|
98
|
-
? values.signals.map((signal, i) => (_jsx(Tab
|
|
99
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
100
|
-
, { tabid: `${i}`, tabstyles: tabContainsErrors(i) ? tabStylesAddition : tabStyles, canDelete: true, render: () => (_jsx(DeltaInput, { signal: signal, index: i, onFocus: handleOnFocus })), children: _jsx(SignalFormTab, { onFocus: handleOnFocus }) }, `signalForm${i}`)))
|
|
101
|
-
: [];
|
|
102
|
-
const addSignalTab = (_jsx(Tab, { tabid: "addSignalTab", canDelete: false, tabstyles: newTabStyles, render: () => (_jsxs("div", { style: {
|
|
103
|
-
display: 'flex',
|
|
104
|
-
alignItems: 'center',
|
|
105
|
-
padding: '0 1.5rem',
|
|
106
|
-
fontSize: '12px',
|
|
107
|
-
color: '#28ba62',
|
|
108
|
-
textWrap: 'nowrap',
|
|
109
|
-
}, children: [_jsx(FaPlus, { style: { display: 'inline-block' } }), _jsx("span", { style: { display: 'inline-block' }, children: "New Signal" })] })), children: _jsx(AddSignalFormTab, { onFocus: handleOnFocus, range: range, ref: newSignalFormRef, preferences: preferences }) }, "addSignalTab"));
|
|
110
|
-
return [...signalTabs, addSignalTab];
|
|
111
|
-
}, [handleOnFocus, preferences, range, tabContainsErrors, values.signals]);
|
|
112
|
-
return (_jsxs("div", { children: [_jsx(SignalFormInfo, {}), _jsx(Tabs, { activeTab: values.activeTab, onClick: tapClickHandler, onDelete: handleDeleteSignal, children: signalFormTabs })] }));
|
|
113
|
-
}
|
|
114
|
-
export default memo(SignalsForm);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
import { useModal } from '../../elements/popup/Modal/Context';
|
|
4
|
-
import { positions } from '../../elements/popup/options';
|
|
5
|
-
import MetaImportationModal from './MetaImportationModal';
|
|
6
|
-
export { default as MetaImportationModal } from './MetaImportationModal';
|
|
7
|
-
export function useMetaInformationImportationModal() {
|
|
8
|
-
const modal = useModal();
|
|
9
|
-
return useCallback((file) => {
|
|
10
|
-
modal.show(_jsx(MetaImportationModal, { file: file, onClose: () => modal.close() }), {
|
|
11
|
-
position: positions.MIDDLE,
|
|
12
|
-
enableResizing: true,
|
|
13
|
-
width: 900,
|
|
14
|
-
height: 600,
|
|
15
|
-
});
|
|
16
|
-
}, [modal]);
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function SpectrumsTabs(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { max } from 'd3';
|
|
2
|
-
import { getActiveSpectrum } from './getActiveSpectrum';
|
|
3
|
-
export function getStrongestPeak(draft) {
|
|
4
|
-
const activeSpectrum = getActiveSpectrum(draft);
|
|
5
|
-
if (activeSpectrum) {
|
|
6
|
-
const activeData = draft.data[activeSpectrum?.index].data;
|
|
7
|
-
const strongestPeakValue = max(activeData.re);
|
|
8
|
-
const index = activeData.re.indexOf(strongestPeakValue);
|
|
9
|
-
return {
|
|
10
|
-
xValue: activeData.x[index],
|
|
11
|
-
yValue: strongestPeakValue,
|
|
12
|
-
index,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
File without changes
|