nmrium 0.30.0 → 0.32.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/ApodizationLine.js +3 -1
- package/lib/component/1d/FooterBanner.js +20 -11
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +4 -2
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +15 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +110 -96
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +12 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +227 -232
- package/lib/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +19 -12
- package/lib/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
- package/lib/component/reducer/actions/RangesActions.js +89 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +44 -27
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +69 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +12 -13
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/Export.js +7 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +9 -3
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +19 -10
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +4 -2
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +14 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
- package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/Export.js +7 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +9 -3
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -12,6 +12,7 @@ const ChartContext_1 = require("../../context/ChartContext");
|
|
|
12
12
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
13
13
|
const highlight_1 = require("../../highlight");
|
|
14
14
|
const MultiplicityUtilities_1 = require("../../panels/extra/utilities/MultiplicityUtilities");
|
|
15
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
15
16
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
16
17
|
const LevelNode_1 = __importDefault(require("./LevelNode"));
|
|
17
18
|
const StringNode_1 = __importDefault(require("./StringNode"));
|
|
@@ -30,7 +31,8 @@ function MultiplicityTree({ rangeFrom, rangeTo, signal, labelOptions = {
|
|
|
30
31
|
fontSize: 11,
|
|
31
32
|
}, }) {
|
|
32
33
|
const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
|
|
33
|
-
const { data: spectraData,
|
|
34
|
+
const { data: spectraData, toolOptions: { selectedTool }, width, } = (0, ChartContext_1.useChartData)();
|
|
35
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
34
36
|
const assignment = (0, AssignmentsContext_1.useAssignment)(signal.id);
|
|
35
37
|
const highlight = (0, highlight_1.useHighlight)(extractID(assignment), {
|
|
36
38
|
type: highlight_1.HighlightEventSource.SIGNAL,
|
|
@@ -8,11 +8,13 @@ const react_1 = require("react");
|
|
|
8
8
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
9
9
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
10
10
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
11
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
11
12
|
const getVerticalShift_1 = __importDefault(require("../utilities/getVerticalShift"));
|
|
12
13
|
const PeakAnnotation_1 = __importDefault(require("./PeakAnnotation"));
|
|
13
14
|
const emptyData = { peaks: {}, info: {}, display: {} };
|
|
14
15
|
function PeakAnnotations() {
|
|
15
|
-
const {
|
|
16
|
+
const { verticalAlign, displayerKey } = (0, ChartContext_1.useChartData)();
|
|
17
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
16
18
|
const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
|
|
17
19
|
const spectrum = (0, useSpectrum_1.default)(emptyData);
|
|
18
20
|
const Peaks = (0, react_1.useMemo)(() => {
|
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
8
8
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
9
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
9
10
|
const getVerticalShift_1 = __importDefault(require("../utilities/getVerticalShift"));
|
|
10
11
|
const usePeakShapesPath_1 = require("./usePeakShapesPath");
|
|
11
12
|
const emptyData = { peaks: {}, display: {} };
|
|
12
13
|
function PeaksShapes() {
|
|
13
|
-
const {
|
|
14
|
+
const { verticalAlign, displayerKey, toolOptions: { data: { peaksOptions: { showPeaksShapes, showPeaksSum }, }, }, } = (0, ChartContext_1.useChartData)();
|
|
15
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
14
16
|
const spectrum = (0, useSpectrum_1.default)(emptyData);
|
|
15
17
|
if (!spectrum?.peaks?.values || !spectrum.display.isVisible) {
|
|
16
18
|
return null;
|
|
@@ -25,7 +27,7 @@ function PeaksShapesItems(props) {
|
|
|
25
27
|
const getPath = (0, usePeakShapesPath_1.usePeakShapesPath)(spectrum);
|
|
26
28
|
return ((0, jsx_runtime_1.jsxs)("g", { children: [' ', spectrum.peaks.values.map((peak) => {
|
|
27
29
|
const { fill, path } = getPath({ target: 'peakShape', peak });
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)("path", {
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)("path", { fill: fill, fillOpacity: 0.3, d: path, transform: `translate(0,-${props.vAlign})` }, peak.id));
|
|
29
31
|
})] }));
|
|
30
32
|
}
|
|
31
33
|
function PeaksShapesSum(props) {
|
|
@@ -10,16 +10,20 @@ function usePeakShapesPath(spectrum) {
|
|
|
10
10
|
const { width, xDomain } = (0, ChartContext_1.useChartData)();
|
|
11
11
|
return function getPath(options) {
|
|
12
12
|
const { target } = options;
|
|
13
|
+
const frequency = spectrum.info.originFrequency;
|
|
13
14
|
let pathSeries = null;
|
|
14
15
|
switch (target) {
|
|
15
16
|
case 'peakShape':
|
|
16
17
|
pathSeries = (0, nmr_processing_1.peakToXY)(options.peak, {
|
|
17
|
-
frequency
|
|
18
|
+
frequency,
|
|
19
|
+
nbPoints: 1024,
|
|
20
|
+
from: options.peak.x - (options.peak.width / frequency) * 9,
|
|
21
|
+
to: options.peak.x + (options.peak.width / frequency) * 9,
|
|
18
22
|
});
|
|
19
23
|
break;
|
|
20
24
|
case 'peaksSum':
|
|
21
25
|
pathSeries = (0, nmr_processing_1.peaksToXY)(options.peaks, {
|
|
22
|
-
frequency
|
|
26
|
+
frequency,
|
|
23
27
|
nbPoints: width,
|
|
24
28
|
from: xDomain[0],
|
|
25
29
|
to: xDomain[1],
|
|
@@ -40,7 +44,7 @@ function usePeakShapesPath(spectrum) {
|
|
|
40
44
|
}
|
|
41
45
|
if (target === 'peakShape') {
|
|
42
46
|
pathBuilder.closePath();
|
|
43
|
-
fill = '
|
|
47
|
+
fill = 'black';
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
return { path: pathBuilder.toString(), fill };
|
|
@@ -8,6 +8,7 @@ const react_1 = require("react");
|
|
|
8
8
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
9
9
|
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
10
10
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
11
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
11
12
|
const Range_1 = __importDefault(require("./Range"));
|
|
12
13
|
const RangeIntegral_1 = __importDefault(require("./RangeIntegral"));
|
|
13
14
|
function RangesInner({ ranges, displayerKey, selectedTool, showMultiplicityTrees, showRangesIntegrals, relativeFormat, }) {
|
|
@@ -16,7 +17,12 @@ function RangesInner({ ranges, displayerKey, selectedTool, showMultiplicityTrees
|
|
|
16
17
|
const MemoizedRanges = (0, react_1.memo)(RangesInner);
|
|
17
18
|
const empyData = { ranges: {} };
|
|
18
19
|
function Ranges() {
|
|
19
|
-
const { displayerKey,
|
|
20
|
+
const { displayerKey, view: { ranges: rangeState, spectra: { activeTab }, }, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
|
|
21
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
22
|
+
const { showMultiplicityTrees, showRangesIntegrals } = (0, react_1.useMemo)(() => activeSpectrum
|
|
23
|
+
? rangeState.find((r) => r.spectrumID === activeSpectrum.id) ||
|
|
24
|
+
Reducer_1.rangeStateInit
|
|
25
|
+
: Reducer_1.rangeStateInit, [activeSpectrum, rangeState]);
|
|
20
26
|
const { ranges } = (0, useSpectrum_1.default)(empyData);
|
|
21
27
|
const rangesPreferences = (0, usePanelPreferences_1.usePanelPreferences)('ranges', activeTab);
|
|
22
28
|
return ((0, jsx_runtime_1.jsx)(MemoizedRanges, { ...{
|
|
@@ -11,6 +11,7 @@ const BrushTracker_1 = require("../../EventsTrackers/BrushTracker");
|
|
|
11
11
|
const MouseTracker_1 = require("../../EventsTrackers/MouseTracker");
|
|
12
12
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
13
13
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
14
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
14
15
|
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
15
16
|
const getVerticalShift_1 = __importDefault(require("../utilities/getVerticalShift"));
|
|
16
17
|
const styles = {
|
|
@@ -21,8 +22,9 @@ const styles = {
|
|
|
21
22
|
SVGPadding: 1,
|
|
22
23
|
};
|
|
23
24
|
function PeakPointer() {
|
|
24
|
-
const { height, width, margin,
|
|
25
|
+
const { height, width, margin, data, mode, toolOptions: { selectedTool }, verticalAlign, } = (0, ChartContext_1.useChartData)();
|
|
25
26
|
const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
|
|
27
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
26
28
|
let position = (0, react_1.useContext)(MouseTracker_1.MouseContext);
|
|
27
29
|
const brushState = (0, react_1.useContext)(BrushTracker_1.BrushContext);
|
|
28
30
|
const [closePeakPosition, setPosition] = (0, react_1.useState)();
|
|
@@ -7,6 +7,7 @@ const MouseTracker_1 = require("../../EventsTrackers/MouseTracker");
|
|
|
7
7
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
8
8
|
const ScaleContext_1 = require("../../context/ScaleContext");
|
|
9
9
|
const useFormatNumberByNucleus_1 = require("../../hooks/useFormatNumberByNucleus");
|
|
10
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
10
11
|
const style = {
|
|
11
12
|
cursor: 'crosshair',
|
|
12
13
|
transformOrigin: 'bottom right',
|
|
@@ -18,7 +19,8 @@ const style = {
|
|
|
18
19
|
userSelect: 'none',
|
|
19
20
|
};
|
|
20
21
|
function XLabelPointer() {
|
|
21
|
-
const { height, width, margin, data
|
|
22
|
+
const { height, width, margin, data } = (0, ChartContext_1.useChartData)();
|
|
23
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
22
24
|
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
23
25
|
const position = (0, react_1.useContext)(MouseTracker_1.MouseContext);
|
|
24
26
|
const brushState = (0, react_1.useContext)(BrushTracker_1.BrushContext);
|
|
@@ -9,10 +9,12 @@ const react_1 = require("react");
|
|
|
9
9
|
const Spectrum2D_1 = require("../../data/data2d/Spectrum2D");
|
|
10
10
|
const ChartContext_1 = require("../context/ChartContext");
|
|
11
11
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
12
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
12
13
|
const PathBuilder_1 = require("../utility/PathBuilder");
|
|
13
14
|
const scale_1 = require("./utilities/scale");
|
|
14
15
|
function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
|
|
15
|
-
const { margin, width, height, xDomain, yDomain, contours
|
|
16
|
+
const { margin, width, height, xDomain, yDomain, contours } = (0, ChartContext_1.useChartData)();
|
|
17
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
16
18
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
17
19
|
const { xShift, yShift } = (0, Spectrum2D_1.getShift)(datum);
|
|
18
20
|
const isActive = (0, react_1.useMemo)(() => {
|
|
@@ -51,7 +53,7 @@ function ContoursPaths({ id: spectrumID, sign, color, datum, }) {
|
|
|
51
53
|
return ((0, jsx_runtime_1.jsx)("path", { fill: "none", "data-test-id": "spectrum-line", stroke: color, strokeWidth: "1", style: {
|
|
52
54
|
opacity: isActive
|
|
53
55
|
? 1
|
|
54
|
-
: (0, get_1.default)(preferences.current, 'general.
|
|
56
|
+
: (0, get_1.default)(preferences.current, 'general.dimmedSpectraOpacity', 0.1),
|
|
55
57
|
}, d: path }));
|
|
56
58
|
}
|
|
57
59
|
function ContoursInner({ data, displayerKey }) {
|
|
@@ -11,6 +11,7 @@ const BrushTracker_1 = require("../EventsTrackers/BrushTracker");
|
|
|
11
11
|
const MouseTracker_1 = require("../EventsTrackers/MouseTracker");
|
|
12
12
|
const ChartContext_1 = require("../context/ChartContext");
|
|
13
13
|
const useFormatNumberByNucleus_1 = require("../hooks/useFormatNumberByNucleus");
|
|
14
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
14
15
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
15
16
|
const DimensionLayout_1 = require("./utilities/DimensionLayout");
|
|
16
17
|
const scale_1 = require("./utilities/scale");
|
|
@@ -51,7 +52,8 @@ const styles = (0, react_1.css) `
|
|
|
51
52
|
function FooterBanner({ layout, data1D }) {
|
|
52
53
|
const position = (0, react_2.useContext)(MouseTracker_1.MouseContext);
|
|
53
54
|
const { startX, endX, startY, endY, step } = (0, react_2.useContext)(BrushTracker_1.BrushContext);
|
|
54
|
-
const { margin, width, height,
|
|
55
|
+
const { margin, width, height, xDomain, yDomain, yDomains, view: { spectra: { activeTab }, }, data, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
|
|
56
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
55
57
|
const trackID = position &&
|
|
56
58
|
(0, DimensionLayout_1.getLayoutID)(layout, {
|
|
57
59
|
startX: position.x,
|
|
@@ -66,6 +66,6 @@ function Left1DChart({ margin: marignValue = 10, data: spectrum, }) {
|
|
|
66
66
|
const mainHeight = originHeight - margin.bottom - margin.top;
|
|
67
67
|
if (!mainHeight || !height)
|
|
68
68
|
return null;
|
|
69
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${height} ${mainHeight + margin.top}`, width: height, height: mainHeight + margin.top, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-left`, children: (0, jsx_runtime_1.jsx)("rect", { width: height, height: mainHeight, x: "0", y: margin.top }) }) }), (0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-left)`, children: (0, jsx_runtime_1.jsx)("path", { className: "line", stroke:
|
|
69
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${height} ${mainHeight + margin.top}`, width: height, height: mainHeight + margin.top, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-left`, children: (0, jsx_runtime_1.jsx)("rect", { width: height, height: mainHeight, x: "0", y: margin.top }) }) }), (0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-left)`, children: (0, jsx_runtime_1.jsx)("path", { className: "line", stroke: spectrum.display.color, fill: "none", d: paths }) })] }));
|
|
70
70
|
}
|
|
71
71
|
exports.default = (0, react_1.memo)(Left1DChart);
|
|
@@ -62,6 +62,6 @@ function Top1DChart({ margin: marginProps = 10, data: spectrum, }) {
|
|
|
62
62
|
if (!width || !height) {
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-top`, children: (0, jsx_runtime_1.jsx)("rect", { width: width - originMargin.left - originMargin.right, height: height, x: originMargin.left, y: `${0}` }) }) }), (0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-top)`, children: (0, jsx_runtime_1.jsx)("path", { className: "line", stroke:
|
|
65
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-top`, children: (0, jsx_runtime_1.jsx)("rect", { width: width - originMargin.left - originMargin.right, height: height, x: originMargin.left, y: `${0}` }) }) }), (0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-top)`, children: (0, jsx_runtime_1.jsx)("path", { className: "line", stroke: spectrum.display.color, fill: "none", strokeWidth: "1px", d: paths }) })] }));
|
|
66
66
|
}
|
|
67
67
|
exports.default = (0, react_1.memo)(Top1DChart);
|
|
@@ -48,15 +48,15 @@ const SlicingView_1 = __importDefault(require("./tools/slicing/SlicingView"));
|
|
|
48
48
|
const DimensionLayout_1 = require("./utilities/DimensionLayout");
|
|
49
49
|
function Viewer2D({ emptyText = undefined }) {
|
|
50
50
|
const state = (0, ChartContext_1.useChartData)();
|
|
51
|
-
const { toolOptions: { selectedTool }, isLoading, data, margin,
|
|
51
|
+
const { toolOptions: { selectedTool }, isLoading, data, margin, view: { spectra: { activeSpectra, activeTab }, }, } = state;
|
|
52
52
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
53
53
|
const { info } = (0, useSpectrum_1.default)({ info: {} });
|
|
54
54
|
const isVisible = info.isFt || !('isFt' in info);
|
|
55
55
|
const spectrumData = (0, react_1.useMemo)(() => {
|
|
56
56
|
const nucleuses = activeTab.split(',');
|
|
57
57
|
return nucleuses.reduce((acc, n) => {
|
|
58
|
-
if (
|
|
59
|
-
const id =
|
|
58
|
+
if (activeSpectra[n]?.id) {
|
|
59
|
+
const id = activeSpectra[n]?.id;
|
|
60
60
|
const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
|
|
61
61
|
if (spectrum) {
|
|
62
62
|
acc.push(spectrum);
|
|
@@ -67,7 +67,7 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
67
67
|
}
|
|
68
68
|
return acc;
|
|
69
69
|
}, []);
|
|
70
|
-
}, [activeTab, data,
|
|
70
|
+
}, [activeTab, data, activeSpectra]);
|
|
71
71
|
const DIMENSION = (0, DimensionLayout_1.get2DDimensionLayout)(state);
|
|
72
72
|
const handelBrushEnd = (0, react_1.useCallback)((brushData) => {
|
|
73
73
|
const trackID = (0, DimensionLayout_1.getLayoutID)(DIMENSION, brushData);
|
|
@@ -46,7 +46,7 @@ const defaultMargin = { right: 100, top: 0, left: 0, bottom: 0 };
|
|
|
46
46
|
function XAxis(props) {
|
|
47
47
|
const { show = true, label = 'δ [ppm]', margin: marginProps = defaultMargin, } = props;
|
|
48
48
|
const state = (0, ChartContext_1.useChartData)();
|
|
49
|
-
const { xDomain, height, width, margin,
|
|
49
|
+
const { xDomain, height, width, margin, view: { spectra: { activeSpectra, activeTab }, }, } = state;
|
|
50
50
|
const refAxis = (0, react_2.useRef)(null);
|
|
51
51
|
(0, react_2.useEffect)(() => {
|
|
52
52
|
if (!show)
|
|
@@ -64,7 +64,7 @@ function XAxis(props) {
|
|
|
64
64
|
margin.right,
|
|
65
65
|
margin.top,
|
|
66
66
|
show,
|
|
67
|
-
|
|
67
|
+
activeSpectra,
|
|
68
68
|
width,
|
|
69
69
|
xDomain,
|
|
70
70
|
]);
|
|
@@ -51,7 +51,7 @@ function YAxis(props) {
|
|
|
51
51
|
const { show = true, label = '', margin: marginProps = defaultMargin, } = props;
|
|
52
52
|
const refAxis = (0, react_2.useRef)(null);
|
|
53
53
|
const state = (0, ChartContext_1.useChartData)();
|
|
54
|
-
const { yDomain, width, height, activeTab,
|
|
54
|
+
const { yDomain, width, height, view: { spectra: { activeTab, activeSpectra }, }, margin, } = state;
|
|
55
55
|
(0, react_2.useEffect)(() => {
|
|
56
56
|
if (!show || !yDomain)
|
|
57
57
|
return;
|
|
@@ -59,7 +59,7 @@ function YAxis(props) {
|
|
|
59
59
|
const axis = d3.axisRight(scaleY).ticks(8).tickFormat(d3.format('0'));
|
|
60
60
|
// @ts-expect-error well typed
|
|
61
61
|
d3.select(refAxis.current).call(axis);
|
|
62
|
-
}, [show, yDomain, activeTab,
|
|
62
|
+
}, [show, yDomain, activeTab, activeSpectra, height, margin]);
|
|
63
63
|
if (!width || !height) {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
@@ -6,6 +6,7 @@ const BrushTracker_1 = require("../../EventsTrackers/BrushTracker");
|
|
|
6
6
|
const MouseTracker_1 = require("../../EventsTrackers/MouseTracker");
|
|
7
7
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
8
8
|
const useFormatNumberByNucleus_1 = require("../../hooks/useFormatNumberByNucleus");
|
|
9
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
9
10
|
const DimensionLayout_1 = require("../utilities/DimensionLayout");
|
|
10
11
|
const scale_1 = require("../utilities/scale");
|
|
11
12
|
const style = {
|
|
@@ -24,7 +25,8 @@ const style = {
|
|
|
24
25
|
function XYLabelPointer({ layout, data1D }) {
|
|
25
26
|
const position = (0, react_1.useContext)(MouseTracker_1.MouseContext);
|
|
26
27
|
const { step } = (0, react_1.useContext)(BrushTracker_1.BrushContext);
|
|
27
|
-
const { margin, width, height, xDomain, yDomain, yDomains, activeTab,
|
|
28
|
+
const { margin, width, height, xDomain, yDomain, yDomains, view: { spectra: { activeTab }, }, } = (0, ChartContext_1.useChartData)();
|
|
29
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
28
30
|
const trackID = position &&
|
|
29
31
|
(0, DimensionLayout_1.getLayoutID)(layout, {
|
|
30
32
|
startX: position.x,
|
|
@@ -8,12 +8,14 @@ const react_1 = require("react");
|
|
|
8
8
|
const Spectrum2D_1 = require("../../../../data/data2d/Spectrum2D");
|
|
9
9
|
const MouseTracker_1 = require("../../../EventsTrackers/MouseTracker");
|
|
10
10
|
const ChartContext_1 = require("../../../context/ChartContext");
|
|
11
|
+
const Reducer_1 = require("../../../reducer/Reducer");
|
|
11
12
|
const scale_1 = require("../../utilities/scale");
|
|
12
13
|
const HorizontalSliceChart_1 = __importDefault(require("./HorizontalSliceChart"));
|
|
13
14
|
const VerticalSliceChart_1 = __importDefault(require("./VerticalSliceChart"));
|
|
14
15
|
function SlicingView() {
|
|
15
|
-
const { width, height, margin,
|
|
16
|
+
const { width, height, margin, data: spectra, xDomain, yDomain, } = (0, ChartContext_1.useChartData)();
|
|
16
17
|
const position = (0, MouseTracker_1.useMouseTracker)();
|
|
18
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
17
19
|
const chart2d = (0, react_1.useMemo)(() => {
|
|
18
20
|
if (position && activeSpectrum && activeSpectrum.id) {
|
|
19
21
|
const { x, y } = position;
|
|
@@ -13,7 +13,7 @@ const lineStyle = (0, react_1.css) `
|
|
|
13
13
|
opacity: 0.7;
|
|
14
14
|
`;
|
|
15
15
|
function IndicationLines({ axis, show }) {
|
|
16
|
-
const { data, activeTab, margin, width, height, xDomain, yDomain, displayerMode, } = (0, ChartContext_1.useChartData)();
|
|
16
|
+
const { data, view: { spectra: { activeTab }, }, margin, width, height, xDomain, yDomain, displayerMode, } = (0, ChartContext_1.useChartData)();
|
|
17
17
|
const [deltas1D, setDeltas1D] = (0, react_2.useState)([]);
|
|
18
18
|
const scaleX = (0, scale_1.get2DXScale)({ margin, width, xDomain });
|
|
19
19
|
const scaleY = (0, scale_1.get2DYScale)({ margin, height, yDomain });
|
|
@@ -7,30 +7,25 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
9
9
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
10
|
-
const
|
|
10
|
+
const Reducer_1 = require("../../reducer/Reducer");
|
|
11
11
|
const Zone_1 = __importDefault(require("./Zone"));
|
|
12
|
-
function ZonesInner({ zones, display, displayerKey }) {
|
|
13
|
-
const [isVisible, setVisibility] = (0, react_1.useState)({
|
|
14
|
-
zones: true,
|
|
15
|
-
signals: true,
|
|
16
|
-
peaks: true,
|
|
17
|
-
});
|
|
18
|
-
(0, react_1.useEffect)(() => {
|
|
19
|
-
Events_1.default.on('onZonesVisibilityChange', ({ key }) => {
|
|
20
|
-
setVisibility((prevVisiblity) => ({
|
|
21
|
-
...prevVisiblity,
|
|
22
|
-
[key]: !prevVisiblity[key],
|
|
23
|
-
}));
|
|
24
|
-
});
|
|
25
|
-
}, []);
|
|
12
|
+
function ZonesInner({ zones, display, displayerKey, isVisible, }) {
|
|
26
13
|
return ((0, jsx_runtime_1.jsx)("g", { clipPath: `url(#${displayerKey}clip-chart-2d)`, className: "2D-Zones", children: display.isVisible &&
|
|
27
14
|
zones.values.map((zone) => ((0, jsx_runtime_1.jsx)("g", { className: "zone", children: (0, jsx_runtime_1.jsx)(Zone_1.default, { zoneData: zone, isVisible: isVisible }) }, zone.id))) }));
|
|
28
15
|
}
|
|
29
16
|
const MemoizedZones = (0, react_1.memo)(ZonesInner);
|
|
30
17
|
const emptyData = { zones: {}, display: {} };
|
|
31
18
|
function Zones() {
|
|
32
|
-
const { displayerKey } = (0, ChartContext_1.useChartData)();
|
|
33
|
-
const { zones, display } = (0, useSpectrum_1.default)(emptyData);
|
|
34
|
-
|
|
19
|
+
const { displayerKey, view: { zones: zoneState }, } = (0, ChartContext_1.useChartData)();
|
|
20
|
+
const { zones, display, id } = (0, useSpectrum_1.default)(emptyData);
|
|
21
|
+
const isVisible = (0, react_1.useMemo)(() => {
|
|
22
|
+
const { showPeaks, showSignals, showZones } = zoneState.find((r) => r.spectrumID === id) || Reducer_1.zoneStateInit;
|
|
23
|
+
return {
|
|
24
|
+
zones: showZones,
|
|
25
|
+
signals: showSignals,
|
|
26
|
+
peaks: showPeaks,
|
|
27
|
+
};
|
|
28
|
+
}, [id, zoneState]);
|
|
29
|
+
return (0, jsx_runtime_1.jsx)(MemoizedZones, { ...{ zones, display, displayerKey, isVisible } });
|
|
35
30
|
}
|
|
36
31
|
exports.default = Zones;
|
|
@@ -19,6 +19,9 @@ const initialState = {
|
|
|
19
19
|
startY: 0,
|
|
20
20
|
endY: 0,
|
|
21
21
|
};
|
|
22
|
+
function stopPageScrolling(event) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
}
|
|
22
25
|
exports.BrushContext = (0, react_1.createContext)(initialState);
|
|
23
26
|
function BrushTracker({ children, className, style, onBrush = () => null, onZoom = () => null, onDoubleClick = () => null, onClick = () => null, noPropagation, }) {
|
|
24
27
|
const [state, dispatch] = (0, react_1.useReducer)(reducer, initialState);
|
|
@@ -41,6 +44,24 @@ function BrushTracker({ children, className, style, onBrush = () => null, onZoom
|
|
|
41
44
|
});
|
|
42
45
|
setMouseDownTime(event.timeStamp);
|
|
43
46
|
}
|
|
47
|
+
function moveCallback(event) {
|
|
48
|
+
dispatch({
|
|
49
|
+
type: 'MOVE',
|
|
50
|
+
screenX: event.screenX,
|
|
51
|
+
screenY: event.screenY,
|
|
52
|
+
clientX: event.clientX,
|
|
53
|
+
clientY: event.clientY,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function mouseUpCallback() {
|
|
57
|
+
dispatch({
|
|
58
|
+
type: 'UP',
|
|
59
|
+
});
|
|
60
|
+
window.removeEventListener('mousemove', moveCallback);
|
|
61
|
+
window.removeEventListener('mouseup', mouseUpCallback);
|
|
62
|
+
}
|
|
63
|
+
window.addEventListener('mousemove', moveCallback);
|
|
64
|
+
window.addEventListener('mouseup', mouseUpCallback);
|
|
44
65
|
return false;
|
|
45
66
|
}, [noPropagation]);
|
|
46
67
|
const clickHandler = (0, react_1.useCallback)((e) => {
|
|
@@ -80,35 +101,23 @@ function BrushTracker({ children, className, style, onBrush = () => null, onZoom
|
|
|
80
101
|
});
|
|
81
102
|
}
|
|
82
103
|
}, [onBrush, state]);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const upCallback = (0, react_1.useCallback)((event) => {
|
|
93
|
-
dispatch({
|
|
94
|
-
type: 'UP',
|
|
95
|
-
clientX: event.clientX,
|
|
96
|
-
clientY: event.clientY,
|
|
97
|
-
});
|
|
98
|
-
return false;
|
|
99
|
-
}, []);
|
|
100
|
-
return ((0, jsx_runtime_1.jsx)(exports.BrushContext.Provider, { value: state, children: (0, jsx_runtime_1.jsx)("div", { className: className, style: style, onMouseDown: mouseDownHandler, onMouseUp: upCallback, onMouseMove: moveCallback, onClick: clickHandler, onWheel: handleMouseWheel, children: children }) }));
|
|
104
|
+
return ((0, jsx_runtime_1.jsx)(exports.BrushContext.Provider, { value: state, children: (0, jsx_runtime_1.jsx)("div", { className: className, style: style, onMouseDown: mouseDownHandler, onClick: clickHandler, onWheel: handleMouseWheel, onMouseEnter: () => {
|
|
105
|
+
// disable page scrolling once the mouse over the Displayer
|
|
106
|
+
window.addEventListener('wheel', stopPageScrolling, {
|
|
107
|
+
passive: false,
|
|
108
|
+
});
|
|
109
|
+
}, onMouseLeave: () => {
|
|
110
|
+
// disable page scrolling once the mouse over the Displayer
|
|
111
|
+
window.removeEventListener('wheel', stopPageScrolling);
|
|
112
|
+
}, children: children }) }));
|
|
101
113
|
}
|
|
102
114
|
exports.BrushTracker = BrushTracker;
|
|
103
115
|
function reducer(state, action) {
|
|
104
116
|
switch (action.type) {
|
|
105
117
|
case 'UP':
|
|
106
118
|
if (state.step === 'brushing' || state.step === 'start') {
|
|
107
|
-
const { clientX, clientY } = action;
|
|
108
119
|
return {
|
|
109
120
|
...state,
|
|
110
|
-
endX: clientX - state.boundingRect.x,
|
|
111
|
-
endY: clientY - state.boundingRect.y,
|
|
112
121
|
step: state.step === 'start' ? 'initial' : 'end',
|
|
113
122
|
};
|
|
114
123
|
}
|
|
@@ -115,11 +115,19 @@ const defaultData = {
|
|
|
115
115
|
const NMRium = (0, react_2.forwardRef)(function NMRium(props, ref) {
|
|
116
116
|
return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props, innerRef: ref }) }) }));
|
|
117
117
|
});
|
|
118
|
-
function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, innerRef, }) {
|
|
118
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, onViewChange, emptyText, innerRef, }) {
|
|
119
119
|
const rootRef = (0, react_2.useRef)(null);
|
|
120
120
|
const elementsWrapperRef = (0, react_2.useRef)(null);
|
|
121
121
|
const viewerRef = (0, react_2.useRef)(null);
|
|
122
122
|
const [show, toggle] = (0, react_use_1.useToggle)(false);
|
|
123
|
+
const handleDataChange = (0, react_2.useRef)(onDataChange);
|
|
124
|
+
(0, react_2.useEffect)(() => {
|
|
125
|
+
handleDataChange.current = onDataChange;
|
|
126
|
+
}, [onDataChange]);
|
|
127
|
+
const handleViewChange = (0, react_2.useRef)(onViewChange);
|
|
128
|
+
(0, react_2.useEffect)(() => {
|
|
129
|
+
handleViewChange.current = onViewChange;
|
|
130
|
+
}, [onViewChange]);
|
|
123
131
|
const isFullscreen = (0, react_use_1.useFullscreen)(rootRef, show, {
|
|
124
132
|
onClose: () => {
|
|
125
133
|
toggle(false);
|
|
@@ -130,9 +138,12 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
|
|
|
130
138
|
const { displayerMode, data: spectraData } = state;
|
|
131
139
|
(0, react_2.useEffect)(() => {
|
|
132
140
|
if ((0, IgnoreActions_1.default)(state.actionType)) {
|
|
133
|
-
|
|
141
|
+
handleDataChange.current?.((0, SpectraManager_1.toJSON)(state, 'onDataChange'));
|
|
134
142
|
}
|
|
135
|
-
}, [
|
|
143
|
+
}, [state]);
|
|
144
|
+
(0, react_2.useEffect)(() => {
|
|
145
|
+
handleViewChange.current?.(state.view);
|
|
146
|
+
}, [state.view]);
|
|
136
147
|
const dispatchMiddleWare = (0, react_2.useMemo)(() => {
|
|
137
148
|
return (0, Reducer_1.dispatchMiddleware)(dispatch);
|
|
138
149
|
}, []);
|
|
@@ -7,6 +7,6 @@ const PreferencesContext_1 = require("./context/PreferencesContext");
|
|
|
7
7
|
function SplitPaneWrapper({ children }) {
|
|
8
8
|
const { current } = (0, PreferencesContext_1.usePreferences)();
|
|
9
9
|
const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.SplitPane, {
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.SplitPane, { initialSize: initialPanelWidth, direction: "horizontal", controlledSide: "end", initialClosed: hidePanelOnLoad ? true : 600, children: children }, hidePanelOnLoad ? 'true' : 'false'));
|
|
11
11
|
}
|
|
12
12
|
exports.SplitPaneWrapper = SplitPaneWrapper;
|
|
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const Input_1 = __importDefault(require("./Input"));
|
|
9
9
|
const EditableColumn = (0, react_1.forwardRef)(function EditableColumn(props, ref) {
|
|
10
|
-
const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, } = props;
|
|
10
|
+
const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, textOverFlowEllipses = false, ...InputProps } = props;
|
|
11
11
|
const [enabled, enableEdit] = (0, react_1.useState)();
|
|
12
12
|
const [isValid, setValid] = (0, react_1.useState)(true);
|
|
13
13
|
(0, react_1.useEffect)(() => {
|
|
@@ -48,11 +48,26 @@ const EditableColumn = (0, react_1.forwardRef)(function EditableColumn(props, re
|
|
|
48
48
|
window.removeEventListener('mousedown', mouseClickCallback);
|
|
49
49
|
}
|
|
50
50
|
}, [mouseClickCallback, onSave, validate]);
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
51
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
52
|
+
display: 'table',
|
|
53
|
+
width: '100%',
|
|
54
|
+
height: '100%',
|
|
55
|
+
...(textOverFlowEllipses
|
|
56
|
+
? { whiteSpace: 'nowrap', overflow: 'hidden', display: 'inline-flex' }
|
|
57
|
+
: {}),
|
|
58
|
+
...style,
|
|
59
|
+
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && ((0, jsx_runtime_1.jsx)("span", { style: {
|
|
60
|
+
display: 'table-cell',
|
|
61
|
+
verticalAlign: 'middle',
|
|
62
|
+
width: 'inherit',
|
|
63
|
+
...(textOverFlowEllipses
|
|
64
|
+
? { textOverflow: 'ellipsis', overflow: 'hidden' }
|
|
65
|
+
: {}),
|
|
66
|
+
}, children: value })), enabled && ((0, jsx_runtime_1.jsx)("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: (0, jsx_runtime_1.jsx)(Input_1.default, { style: {
|
|
52
67
|
inputWrapper: {
|
|
53
68
|
width: '100%',
|
|
54
69
|
...(!isValid && { borderColor: 'red' }),
|
|
55
70
|
},
|
|
56
|
-
}, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler }) }))] }));
|
|
71
|
+
}, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler, ...InputProps }) }))] }));
|
|
57
72
|
});
|
|
58
73
|
exports.default = EditableColumn;
|
|
@@ -28,7 +28,7 @@ const transitionStyles = {
|
|
|
28
28
|
exited: { transform: 'scale(0)' },
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
|
-
function Provider({ children, style
|
|
31
|
+
function Provider({ children, style, offset = '0px', position = options_1.positions.MIDDLE, transition = options_1.transitions.SCALE, wrapperRef = null, }) {
|
|
32
32
|
const root = (0, react_2.useRef)();
|
|
33
33
|
const modalRef = (0, react_2.useRef)();
|
|
34
34
|
const [modal, setModal] = (0, react_2.useState)();
|
|
@@ -49,16 +49,13 @@ function Provider({ children, style = undefined, offset = '0px', position = opti
|
|
|
49
49
|
const close = (0, react_2.useCallback)(function close() {
|
|
50
50
|
setModal(null);
|
|
51
51
|
}, [setModal]);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
height: window.innerHeight,
|
|
60
|
-
};
|
|
61
|
-
}, [wrapperRef]);
|
|
52
|
+
// todo: optimize this
|
|
53
|
+
const parentStyle = wrapperRef?.getBoundingClientRect() || {
|
|
54
|
+
top: 0,
|
|
55
|
+
left: 0,
|
|
56
|
+
width: window.innerWidth,
|
|
57
|
+
height: window.innerHeight,
|
|
58
|
+
};
|
|
62
59
|
/**
|
|
63
60
|
*
|
|
64
61
|
* @param {*} component <component />
|
|
@@ -37,13 +37,15 @@ const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
|
|
|
37
37
|
const Label_1 = __importDefault(require("../elements/Label"));
|
|
38
38
|
const Select_1 = __importDefault(require("../elements/Select"));
|
|
39
39
|
const useFilter_1 = require("../hooks/useFilter");
|
|
40
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
40
41
|
const Types_1 = require("../reducer/types/Types");
|
|
41
42
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
42
43
|
const HeaderContainer_1 = require("./HeaderContainer");
|
|
43
44
|
const Sizes = (0, generateNumbersPowerOfX_1.default)(8, 21);
|
|
44
45
|
function ZeroFillingOptionsPanel() {
|
|
45
46
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
46
|
-
const { data
|
|
47
|
+
const { data } = (0, ChartContext_1.useChartData)();
|
|
48
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
47
49
|
const [size, setSize] = (0, react_1.useState)();
|
|
48
50
|
const [livePreview, setLivePreview] = (0, react_1.useState)(true);
|
|
49
51
|
const filter = (0, useFilter_1.useFilter)(Filters.zeroFilling.id);
|
|
@@ -5,16 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const get_1 = __importDefault(require("lodash/get"));
|
|
7
7
|
const react_1 = require("react");
|
|
8
|
-
const ChartContext_1 = require("../context/ChartContext");
|
|
9
8
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
9
|
+
const Reducer_1 = require("../reducer/Reducer");
|
|
10
10
|
function useActiveSpectrumStyleOptions(id) {
|
|
11
|
-
const
|
|
11
|
+
const activeSpectrum = (0, Reducer_1.useActiveSpectrum)();
|
|
12
12
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
13
13
|
return (0, react_1.useMemo)(() => {
|
|
14
14
|
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
|
|
15
15
|
const opacity = isActive
|
|
16
16
|
? 1
|
|
17
|
-
: (0, get_1.default)(preferences.current, 'general.
|
|
17
|
+
: (0, get_1.default)(preferences.current, 'general.dimmedSpectraOpacity', 0.1);
|
|
18
18
|
return { isActive, opacity };
|
|
19
19
|
}, [activeSpectrum, id, preferences]);
|
|
20
20
|
}
|