nmrium 0.27.0 → 0.28.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/ExclusionZonesAnnotations.js +1 -1
- package/lib/component/1d/IntegralsSeries.js +2 -6
- package/lib/component/1d/PeakAnnotation.js +2 -2
- package/lib/component/1d/PeakAnnotations.js +2 -4
- package/lib/component/1d/SpectraTracker.js +2 -2
- package/lib/component/1d/Viewer1D.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +28 -26
- package/lib/component/1d/ranges/Range.d.ts +1 -2
- package/lib/component/1d/ranges/Range.js +3 -4
- package/lib/component/1d/ranges/Ranges.js +3 -4
- package/lib/component/1d/tool/BaseLineZones.js +3 -6
- package/lib/component/1d/tool/VerticalIndicator.js +1 -1
- package/lib/component/2d/Contours.js +1 -5
- package/lib/component/2d/SignalDeltaLine.js +1 -1
- package/lib/component/2d/Viewer2D.js +1 -1
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/zones/IndicationLines.js +2 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +59 -41
- package/lib/component/NMRium.d.ts +14 -49
- package/lib/component/NMRium.js +14 -6
- package/lib/component/SplitPaneWrapper.js +2 -2
- package/lib/component/context/PreferencesContext.d.ts +3 -43
- package/lib/component/elements/Button.js +1 -1
- package/lib/component/elements/Logo.js +1 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
- package/lib/component/elements/Tab/Tabs.js +2 -1
- package/lib/component/elements/ToggleButton.js +2 -2
- package/lib/component/elements/accordion/Accordion.js +2 -6
- package/lib/component/elements/formik/Input.js +1 -1
- package/lib/component/elements/popup/Modal/Modal.js +1 -1
- package/lib/component/elements/popup/Modal/ModalContent.js +1 -1
- package/lib/component/elements/toggle/ToggleButtonGroup.js +2 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +7 -4
- package/lib/component/header/Header.js +2 -2
- package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -1
- package/lib/component/hooks/useExport.js +2 -2
- package/lib/component/hooks/useFormatNumberByNucleus.js +3 -4
- package/lib/component/loader/DropZone.js +8 -2
- package/lib/component/loader/NoData.d.ts +3 -2
- package/lib/component/loader/NoData.js +31 -30
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -2
- package/lib/component/modal/editRange/EditRangeModal.d.ts +3 -3
- package/lib/component/modal/editRange/EditRangeModal.js +49 -54
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +2 -0
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +34 -0
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +1 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +11 -14
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +2 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +18 -29
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/setting/DatabasesTabContent.d.ts +2 -1
- package/lib/component/modal/setting/DatabasesTabContent.js +28 -30
- package/lib/component/modal/setting/settingsValidation.d.ts +150 -42
- package/lib/component/modal/setting/settingsValidation.js +6 -4
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +13 -15
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +2 -2
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib/component/panels/Panels.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +12 -3
- package/lib/component/panels/RangesPanel/RangesPanel.js +19 -19
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +4 -4
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +48 -30
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -3
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -8
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
- package/lib/component/panels/SummaryPanel/utilities/{IsInView.d.ts → useInView.d.ts} +2 -2
- package/lib/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +13 -13
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +4 -0
- package/lib/component/panels/databasePanel/DatabasePanel.js +80 -26
- package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.d.ts +7 -0
- package/lib/component/panels/databasePanel/DatabaseStructureSearchModal.js +8 -0
- package/lib/component/panels/databasePanel/DatabaseTable.js +14 -9
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +2 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +1 -3
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/reducer/Reducer.d.ts +8 -66
- package/lib/component/reducer/Reducer.js +13 -8
- package/lib/component/reducer/actions/DatabaseActions.d.ts +3 -2
- package/lib/component/reducer/actions/DatabaseActions.js +21 -3
- package/lib/component/reducer/actions/DomainActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +2 -1
- package/lib/component/reducer/actions/FiltersActions.js +25 -4
- package/lib/component/reducer/actions/PreferencesActions.js +32 -20
- package/lib/component/reducer/actions/RangesActions.d.ts +2 -2
- package/lib/component/reducer/actions/RangesActions.js +45 -11
- package/lib/component/reducer/actions/SpectrumsActions.js +6 -9
- package/lib/component/reducer/actions/ToolsActions.js +66 -53
- package/lib/component/reducer/helper/getSpectrum.d.ts +5 -0
- package/lib/component/reducer/helper/getSpectrum.js +14 -0
- package/lib/component/reducer/preferences/actions/initPreferences.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -10
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/tool/BrushX.js +1 -1
- package/lib/component/tool/BrushXY.js +1 -1
- package/lib/component/tool/CrossLinePointer.js +1 -1
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +4 -3
- package/lib/component/toolbar/BasicToolBar.js +0 -1
- package/lib/component/toolbar/FunctionToolBar.js +9 -13
- package/lib/component/toolbar/ToolTypes.d.ts +1 -1
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/utility/Export.d.ts +7 -1
- package/lib/component/utility/Export.js +3 -3
- package/lib/component/utility/formatNumber.d.ts +1 -1
- package/lib/component/utility/formatNumber.js +4 -2
- package/lib/component/utility/isGoogleDocument.d.ts +1 -0
- package/lib/component/utility/isGoogleDocument.js +3 -0
- package/lib/component/utility/nmredataToNmrium.js +1 -2
- package/lib/component/utility/nmriumToNmredata.d.ts +2 -2
- package/lib/component/utility/nmriumToNmredata.js +2 -2
- package/lib/component/utility/util/nmredata/addSource.js +2 -2
- package/lib/component/workspaces/Workspace.d.ts +9 -4
- package/lib/component/workspaces/basic.js +15 -8
- package/lib/component/workspaces/exercise.js +2 -2
- package/lib/component/workspaces/process1D.js +1 -1
- package/lib/data/FiltersManager.js +1 -1
- package/lib/data/PredictionManager.js +7 -9
- package/lib/data/SpectraManager.d.ts +4 -12
- package/lib/data/SpectraManager.js +14 -23
- package/lib/data/data1d/Data1DManager.js +8 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +36 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +38 -15
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
- package/lib/data/data1d/database.d.ts +5 -3
- package/lib/data/data1d/database.js +54 -4
- package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib/data/data2d/Processing2D.js +1 -1
- package/lib/data/molecules/Molecule.d.ts +4 -5
- package/lib/data/molecules/Molecule.js +3 -1
- package/lib/data/utilities/FindUtilities.js +1 -3
- package/lib/data/utilities/RangeUtilities.js +5 -6
- package/lib/data/utilities/ZoneUtilities.js +1 -1
- package/lib/data/utilities/getSum.js +1 -3
- package/lib/data/utilities/isMolFileEmpty.d.ts +1 -0
- package/lib/data/utilities/isMolFileEmpty.js +6 -0
- package/lib/types/NMRiumDataReturn.d.ts +15 -0
- package/lib/types/NMRiumDataReturn.js +1 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +10 -0
- package/lib/types/NMRiumGeneralPreferences.js +1 -0
- package/lib/types/NMRiumPanelPreferences.d.ts +16 -0
- package/lib/types/NMRiumPanelPreferences.js +1 -0
- package/lib/types/NMRiumToolBarPreferences.d.ts +20 -0
- package/lib/types/NMRiumToolBarPreferences.js +1 -0
- package/lib/types/Preferences.d.ts +5 -0
- package/lib/types/Preferences.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -1
- package/lib-cjs/component/1d/IntegralsSeries.js +2 -6
- package/lib-cjs/component/1d/PeakAnnotation.js +2 -2
- package/lib-cjs/component/1d/PeakAnnotations.js +2 -4
- package/lib-cjs/component/1d/SpectraTracker.js +2 -2
- package/lib-cjs/component/1d/Viewer1D.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +30 -25
- package/lib-cjs/component/1d/ranges/Range.js +3 -4
- package/lib-cjs/component/1d/ranges/Ranges.js +3 -4
- package/lib-cjs/component/1d/tool/BaseLineZones.js +3 -6
- package/lib-cjs/component/1d/tool/VerticalIndicator.js +1 -1
- package/lib-cjs/component/2d/Contours.js +1 -5
- package/lib-cjs/component/2d/SignalDeltaLine.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +2 -3
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +59 -41
- package/lib-cjs/component/NMRium.js +13 -5
- package/lib-cjs/component/SplitPaneWrapper.js +2 -2
- package/lib-cjs/component/elements/Button.js +1 -1
- package/lib-cjs/component/elements/Logo.js +1 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -0
- package/lib-cjs/component/elements/Tab/Tabs.js +2 -1
- package/lib-cjs/component/elements/ToggleButton.js +2 -2
- package/lib-cjs/component/elements/accordion/Accordion.js +2 -6
- package/lib-cjs/component/elements/formik/Input.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/Modal.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ModalContent.js +1 -1
- package/lib-cjs/component/elements/toggle/ToggleButtonGroup.js +2 -2
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -3
- package/lib-cjs/component/header/Header.js +2 -2
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +1 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -1
- package/lib-cjs/component/hooks/useExport.js +2 -2
- package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +2 -3
- package/lib-cjs/component/loader/DropZone.js +8 -2
- package/lib-cjs/component/loader/NoData.js +31 -30
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +47 -52
- package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +9 -22
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +12 -50
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +38 -0
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormTab.js +13 -16
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +18 -29
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +31 -33
- package/lib-cjs/component/modal/setting/settingsValidation.js +6 -4
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +12 -14
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +8 -15
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +1 -1
- package/lib-cjs/component/panels/Panels.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -1
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +18 -18
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +47 -29
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +3 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +6 -8
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +6 -8
- package/lib-cjs/component/panels/SummaryPanel/utilities/{IsInView.js → useInView.js} +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -12
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +78 -24
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabaseStructureSearchModal.js +15 -0
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +14 -9
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +2 -4
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +1 -3
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib-cjs/component/reducer/Reducer.js +13 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +22 -3
- package/lib-cjs/component/reducer/actions/DomainActions.js +1 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +26 -4
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +30 -18
- package/lib-cjs/component/reducer/actions/RangesActions.js +46 -12
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +4 -7
- package/lib-cjs/component/reducer/actions/ToolsActions.js +63 -73
- package/lib-cjs/component/reducer/helper/getSpectrum.js +18 -0
- package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +1 -1
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +4 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib-cjs/component/reducer/types/Types.js +5 -3
- package/lib-cjs/component/tool/BrushX.js +1 -1
- package/lib-cjs/component/tool/BrushXY.js +1 -1
- package/lib-cjs/component/tool/CrossLinePointer.js +1 -1
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/toolbar/BasicToolBar.js +0 -1
- package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -13
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/utility/Export.js +4 -3
- package/lib-cjs/component/utility/formatNumber.js +3 -1
- package/lib-cjs/component/utility/isGoogleDocument.js +7 -0
- package/lib-cjs/component/utility/nmredataToNmrium.js +1 -2
- package/lib-cjs/component/utility/util/nmredata/addSource.js +2 -2
- package/lib-cjs/component/workspaces/basic.js +15 -8
- package/lib-cjs/component/workspaces/exercise.js +2 -2
- package/lib-cjs/component/workspaces/process1D.js +1 -1
- package/lib-cjs/data/FiltersManager.js +1 -1
- package/lib-cjs/data/PredictionManager.js +7 -9
- package/lib-cjs/data/SpectraManager.js +14 -23
- package/lib-cjs/data/data1d/Data1DManager.js +8 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +8 -10
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +5 -7
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +40 -16
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +1 -1
- package/lib-cjs/data/data1d/database.js +55 -5
- package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib-cjs/data/data2d/Processing2D.js +1 -1
- package/lib-cjs/data/molecules/Molecule.js +3 -1
- package/lib-cjs/data/utilities/FindUtilities.js +1 -3
- package/lib-cjs/data/utilities/RangeUtilities.js +8 -6
- package/lib-cjs/data/utilities/ZoneUtilities.js +1 -1
- package/lib-cjs/data/utilities/getSum.js +1 -3
- package/lib-cjs/data/utilities/isMolFileEmpty.js +10 -0
- package/lib-cjs/types/NMRiumDataReturn.js +2 -0
- package/lib-cjs/types/NMRiumGeneralPreferences.js +2 -0
- package/lib-cjs/types/NMRiumPanelPreferences.js +2 -0
- package/lib-cjs/types/NMRiumToolBarPreferences.js +2 -0
- package/lib-cjs/types/Preferences.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +31 -31
- package/lib/component/1d/multiplicityTree/TempMultiplicityTree.d.ts +0 -2
- package/lib/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -14
- package/lib/component/panels/databasePanel/useDatabases.d.ts +0 -5
- package/lib/component/panels/databasePanel/useDatabases.js +0 -10
- package/lib-cjs/component/1d/multiplicityTree/TempMultiplicityTree.js +0 -20
- package/lib-cjs/component/panels/databasePanel/useDatabases.js +0 -14
package/lib/component/NMRium.js
CHANGED
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { RootLayout } from 'analysis-ui-components';
|
|
5
|
-
import { useEffect, useCallback, useReducer, useMemo, useRef, memo, } from 'react';
|
|
5
|
+
import { useEffect, useCallback, useReducer, useMemo, useRef, memo, forwardRef, useImperativeHandle, } from 'react';
|
|
6
6
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
7
7
|
import { useToggle, useFullscreen } from 'react-use';
|
|
8
|
+
import { toJSON } from '../data/SpectraManager';
|
|
8
9
|
import checkModifierKeyActivated from '../data/utilities/checkModifierKeyActivated';
|
|
9
10
|
import Viewer1D from './1d/Viewer1D';
|
|
10
11
|
import Viewer2D from './2d/Viewer2D';
|
|
@@ -29,6 +30,7 @@ import { DISPLAYER_MODE } from './reducer/core/Constants';
|
|
|
29
30
|
import preferencesReducer, { preferencesInitialState, initPreferencesState, } from './reducer/preferences/preferencesReducer';
|
|
30
31
|
import { INITIATE, SET_LOADING_FLAG, SET_MOUSE_OVER_DISPLAYER, } from './reducer/types/Types';
|
|
31
32
|
import ToolBar from './toolbar/ToolBar';
|
|
33
|
+
import { getBlob } from './utility/Export';
|
|
32
34
|
const viewerContainerStyle = css `
|
|
33
35
|
border: 0.55px #e6e6e6 solid;
|
|
34
36
|
display: flex;
|
|
@@ -62,6 +64,7 @@ const containerStyles = css `
|
|
|
62
64
|
button {
|
|
63
65
|
outline: none !important;
|
|
64
66
|
}
|
|
67
|
+
|
|
65
68
|
* {
|
|
66
69
|
-webkit-user-drag: none;
|
|
67
70
|
-moz-user-drag: none;
|
|
@@ -81,10 +84,10 @@ const defaultPreferences = {};
|
|
|
81
84
|
const defaultData = {
|
|
82
85
|
spectra: [],
|
|
83
86
|
};
|
|
84
|
-
function NMRium(props) {
|
|
85
|
-
return (_jsx(RootLayout, { style: { width: '100%' }, children: _jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, children: _jsx(InnerNMRium, { ...props }) }) }));
|
|
86
|
-
}
|
|
87
|
-
function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, }) {
|
|
87
|
+
const NMRium = forwardRef(function NMRium(props, ref) {
|
|
88
|
+
return (_jsx(RootLayout, { style: { width: '100%' }, children: _jsx(ErrorBoundary, { FallbackComponent: ErrorOverlay, children: _jsx(InnerNMRium, { ...props, innerRef: ref }) }) }));
|
|
89
|
+
});
|
|
90
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, innerRef, }) {
|
|
88
91
|
const rootRef = useRef(null);
|
|
89
92
|
const elementsWrapperRef = useRef(null);
|
|
90
93
|
const viewerRef = useRef(null);
|
|
@@ -99,7 +102,7 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
|
|
|
99
102
|
const { displayerMode, data: spectraData } = state;
|
|
100
103
|
useEffect(() => {
|
|
101
104
|
if (checkActionType(state.actionType)) {
|
|
102
|
-
onDataChange?.(state);
|
|
105
|
+
onDataChange?.(toJSON(state, 'onDataChange'));
|
|
103
106
|
}
|
|
104
107
|
}, [onDataChange, state]);
|
|
105
108
|
const dispatchMiddleWare = useMemo(() => {
|
|
@@ -118,6 +121,11 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
|
|
|
118
121
|
},
|
|
119
122
|
});
|
|
120
123
|
}, [preferences, workspace]);
|
|
124
|
+
useImperativeHandle(innerRef, () => ({
|
|
125
|
+
getSpectraViewerAsBlob: () => {
|
|
126
|
+
return rootRef?.current ? getBlob(rootRef.current, 'nmrSVG') : null;
|
|
127
|
+
},
|
|
128
|
+
}), []);
|
|
121
129
|
useEffect(() => {
|
|
122
130
|
dispatchMiddleWare({ type: SET_LOADING_FLAG, isLoading: true });
|
|
123
131
|
if (dataProp) {
|
|
@@ -3,6 +3,6 @@ import { SplitPane } from 'analysis-ui-components';
|
|
|
3
3
|
import { usePreferences } from './context/PreferencesContext';
|
|
4
4
|
export function SplitPaneWrapper({ children }) {
|
|
5
5
|
const { current } = usePreferences();
|
|
6
|
-
const
|
|
7
|
-
return (_jsx(SplitPane, { initialSeparation:
|
|
6
|
+
const { hidePanelOnLoad = false, initialPanelWidth = '560px' } = current?.display?.general || {};
|
|
7
|
+
return (_jsx(SplitPane, { initialSeparation: initialPanelWidth, orientation: "horizontal", sideSeparation: "end", ...(hidePanelOnLoad ? { initialClosed: true } : { minimumSize: 600 }), children: children }, hidePanelOnLoad ? 'true' : 'false'));
|
|
8
8
|
}
|
|
@@ -24,49 +24,9 @@ export declare function usePreferences(): {
|
|
|
24
24
|
type: "INIT_PREFERENCES";
|
|
25
25
|
payload: {
|
|
26
26
|
display: Partial<{
|
|
27
|
-
general: Partial<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
hideGeneralSettings: boolean;
|
|
31
|
-
experimentalFeatures: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
32
|
-
hidePanelOnLoad: boolean;
|
|
33
|
-
initialPanelWidth?: import("analysis-ui-components/lib-esm/components/SplitPane").InitialSeparation | undefined;
|
|
34
|
-
}>;
|
|
35
|
-
panels: Partial<{
|
|
36
|
-
spectraPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
37
|
-
informationPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
38
|
-
peaksPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
39
|
-
integralsPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
40
|
-
rangesPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
41
|
-
structuresPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
42
|
-
filtersPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
43
|
-
zonesPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
44
|
-
summaryPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
45
|
-
multipleSpectraAnalysisPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
46
|
-
databasePanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
47
|
-
predictionPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
48
|
-
automaticAssignmentPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
|
|
49
|
-
}>;
|
|
50
|
-
toolBarButtons: Partial<{
|
|
51
|
-
zoomTool: boolean;
|
|
52
|
-
zoomOutTool: boolean;
|
|
53
|
-
import: boolean;
|
|
54
|
-
exportAs: boolean;
|
|
55
|
-
spectraStackAlignments: boolean;
|
|
56
|
-
spectraCenterAlignments: boolean;
|
|
57
|
-
realImaginary: boolean;
|
|
58
|
-
peakTool: boolean;
|
|
59
|
-
integralTool: boolean;
|
|
60
|
-
zonePickingTool: boolean;
|
|
61
|
-
slicingTool: boolean;
|
|
62
|
-
autoRangesTool: boolean;
|
|
63
|
-
zeroFillingTool: boolean;
|
|
64
|
-
phaseCorrectionTool: boolean;
|
|
65
|
-
baseLineCorrectionTool: boolean;
|
|
66
|
-
FFTTool: boolean;
|
|
67
|
-
multipleSpectraAnalysisTool: boolean;
|
|
68
|
-
exclusionZonesTool: boolean;
|
|
69
|
-
}>;
|
|
27
|
+
general: Partial<import("../../types/NMRiumGeneralPreferences").NMRiumGeneralPreferences>;
|
|
28
|
+
panels: Partial<import("../../types/NMRiumPanelPreferences").NMRiumPanelPreferences>;
|
|
29
|
+
toolBarButtons: Partial<import("../../types/NMRiumToolBarPreferences").NMRiumToolBarPreferences>;
|
|
70
30
|
}>;
|
|
71
31
|
workspace: import("../NMRium").NMRiumWorkspace;
|
|
72
32
|
dispatch: any;
|
|
@@ -134,7 +134,7 @@ function ThemeButton(props) {
|
|
|
134
134
|
const { colorTheme, ...buttonProps } = props;
|
|
135
135
|
const { base, shade, tint } = colorPalettes[props.colorTheme];
|
|
136
136
|
const { color = { base: shade, hover: 'white' }, backgroundColor = {
|
|
137
|
-
base
|
|
137
|
+
base,
|
|
138
138
|
hover: shade,
|
|
139
139
|
active: tint,
|
|
140
140
|
}, fill = 'solid', ...restProps } = buttonProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
export default function Logo({ width = 100, height = 100 }) {
|
|
3
|
-
return (_jsxs("svg", { style: { width
|
|
3
|
+
return (_jsxs("svg", { style: { width, height }, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 752.34 221.73", children: [_jsx("path", { fill: "#ea580c", fillRule: "evenodd", d: "M.64,31.7A31.67,31.67,0,0,1,54.72,9.29l0,0A31.66,31.66,0,0,1,64,31.7V190a13.39,13.39,0,0,0,26.77,0V54a31.7,31.7,0,0,1,31.7-31.7V40.58A13.38,13.38,0,0,0,109.13,54V190a31.71,31.71,0,0,1-63.41,0V31.7a13.29,13.29,0,0,0-3.88-9.46l0,0A13.41,13.41,0,0,0,19,31.7V164.82H.64Z" }), _jsx("path", { fill: "#2b143e", fillRule: "evenodd", d: "M154.21,54v68.17a13.34,13.34,0,0,0,3.89,9.47h0A13.39,13.39,0,0,0,181,122.14V99.32h-.06a31.63,31.63,0,0,1,9.29-22.38l0,0a31.65,31.65,0,0,1,44.8,0l0,0a31.58,31.58,0,0,1,9.3,22.39V118H226V99.32a13.3,13.3,0,0,0-3.89-9.46h0a13.44,13.44,0,0,0-18.93,0l0,0a13.3,13.3,0,0,0-3.83,8.19v24.09a31.7,31.7,0,0,1-54.11,22.42v0a31.66,31.66,0,0,1-9.3-22.4V54Z" }), _jsx("path", { fill: "#2b143e", fillRule: "evenodd", d: "M729.19,96.34c-8.65,0-14.26,3.17-17.67,8-3.41-5.12-8.78-8-16-8-8.16,0-13.52,3.17-16.32,7.31v-5.6H661V159h18.28V124.62c0-7.19,3.41-11.46,9.5-11.46,5.85,0,8.78,3.9,8.78,10V159h18.27V124.62c0-7.19,3.42-11.46,9.51-11.46,5.85,0,8.77,3.9,8.77,10V159h18.28V121.57C752.34,106.33,743.2,96.34,729.19,96.34Z" }), _jsx("path", { fill: "#2b143e", fillRule: "evenodd", d: "M629.26,98.05v33.26c0,8.66-4.63,12.56-11.33,12.56-5.85,0-10.6-3.54-10.6-11.09V98.05H589.05v37.41c0,16.45,10.48,25.22,22.79,25.22,8,0,14.13-2.92,17.42-7.43V159h18.28V98.05Z" }), _jsx("rect", { fill: "#2b143e", x: "558.22", y: "98.05", width: "18.28", height: "60.93" }), _jsx("path", { fill: "#2b143e", fillRule: "evenodd", d: "M567.36,92.68a11,11,0,1,0-11-11A11.08,11.08,0,0,0,567.36,92.68Z" }), _jsx("path", { fill: "#ea580c", fillRule: "evenodd", d: "M478.77,159H498V116.57L525.66,159H549.2l-22.3-34.75c5.45-2.13,8.12-4.14,11.48-8.86a31.07,31.07,0,0,0,6.07-18.26V94.62c0-10.61-3.45-15.93-9.28-21.78S520.75,63.09,510,63.09H478.71l.06,95.89Zm33.1-50.27h-6.46v-.06H498V82.19h10.87c4.67,0,9.44,1.38,11.94,3.81a12.84,12.84,0,0,1,3.81,9.2C524.58,102.52,518.92,108.71,511.87,108.71Z" }), _jsx("polygon", { fill: "#ea580c", fillRule: "evenodd", points: "372.91 60.8 372.91 158.98 392.16 158.98 392.16 119.23 419.91 157.41 447.61 119.23 447.61 158.98 466.87 158.98 466.87 60.8 419.91 125.22 372.91 60.8" }), _jsx("polygon", { fill: "#ea580c", fillRule: "evenodd", points: "283.89 61.04 283.89 159.1 303.14 159.1 303.14 105.85 361.01 160.93 361.01 62.83 341.67 62.83 341.67 116.08 283.89 61.04" })] }));
|
|
4
4
|
}
|
|
@@ -13,6 +13,7 @@ const topStyles = css `
|
|
|
13
13
|
border-bottom: 1px solid #ccc;
|
|
14
14
|
padding-left: 0;
|
|
15
15
|
margin: 0;
|
|
16
|
+
display: inline-flex;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
.tab-list li:first-of-type {
|
|
@@ -24,7 +25,7 @@ const topStyles = css `
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.tab-list-item {
|
|
27
|
-
display: inline-
|
|
28
|
+
display: inline-flex;
|
|
28
29
|
list-style: none;
|
|
29
30
|
padding: 0.5rem 2rem;
|
|
30
31
|
}
|
|
@@ -19,10 +19,10 @@ const styles = css `
|
|
|
19
19
|
}
|
|
20
20
|
`;
|
|
21
21
|
function ToggleButton({ children, style = {}, onClick = () => null, popupTitle = '', popupPlacement = 'right', defaultValue = false, disabled = false, className = '', testID, }) {
|
|
22
|
-
const [flag,
|
|
22
|
+
const [flag, toggle] = useState(defaultValue);
|
|
23
23
|
const toggleHandler = useCallback(() => {
|
|
24
24
|
onClick(!flag);
|
|
25
|
-
|
|
25
|
+
toggle(!flag);
|
|
26
26
|
}, [onClick, flag]);
|
|
27
27
|
return (_jsx(ToolTip, { title: popupTitle, popupPlacement: popupPlacement, children: _jsx("button", { "data-test-id": testID, disabled: disabled, css: styles, style: style, className: (flag ? 'toggle toggle-active ' : 'toggle ') + className, type: "button", onClick: toggleHandler, children: children }) }));
|
|
28
28
|
}
|
|
@@ -20,7 +20,7 @@ function Accordion({ children, defaultOpenIndex = 0 }) {
|
|
|
20
20
|
el = el.map((e, i) => i === index && alwaysOpenIndexRef.current !== index ? !e : e);
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
el = el.map((e, i) =>
|
|
23
|
+
el = el.map((e, i) => i === index);
|
|
24
24
|
if (trigger.shiftKey) {
|
|
25
25
|
if (alwaysOpenIndexRef.current === index) {
|
|
26
26
|
alwaysOpenIndexRef.current = null;
|
|
@@ -50,11 +50,7 @@ function Accordion({ children, defaultOpenIndex = 0 }) {
|
|
|
50
50
|
if (defaultOpenIndex != null) {
|
|
51
51
|
setElements((prevState) => {
|
|
52
52
|
if (prevState.length > 0) {
|
|
53
|
-
return prevState.map((e, i) => !forcedOpenedElementsRef.current[i]
|
|
54
|
-
? i === defaultOpenIndex
|
|
55
|
-
? true
|
|
56
|
-
: false
|
|
57
|
-
: e);
|
|
53
|
+
return prevState.map((e, i) => !forcedOpenedElementsRef.current[i] ? i === defaultOpenIndex : e);
|
|
58
54
|
}
|
|
59
55
|
forcedOpenedElementsRef.current = Array(children.length)
|
|
60
56
|
.fill(false)
|
|
@@ -4,6 +4,6 @@ import ErrorMessage from './ErrorMessage';
|
|
|
4
4
|
function Input(props) {
|
|
5
5
|
const { onFocus = () => null, onBlur = () => null, enableErrorMessage, ...inputProps } = props;
|
|
6
6
|
const [field] = useField(inputProps);
|
|
7
|
-
return (_jsxs("div", { children: [_jsx("input", { ...field, ...props, onFocus: () => onFocus(field.name), onBlur: () => onBlur(field.name) }), enableErrorMessage
|
|
7
|
+
return (_jsxs("div", { children: [_jsx("input", { ...field, ...props, onFocus: () => onFocus(field.name), onBlur: () => onBlur(field.name) }), enableErrorMessage ? _jsx(ErrorMessage, { ...inputProps }) : null] }));
|
|
8
8
|
}
|
|
9
9
|
export default Input;
|
|
@@ -8,7 +8,7 @@ export default function ToggleButtonGroup({ children, value, onChange = () => nu
|
|
|
8
8
|
const toggles = _toggles.map((toggle) => {
|
|
9
9
|
return {
|
|
10
10
|
value: toggle.value,
|
|
11
|
-
isActive: toggle.value === val
|
|
11
|
+
isActive: toggle.value === val,
|
|
12
12
|
};
|
|
13
13
|
});
|
|
14
14
|
setToggleButtons(toggles);
|
|
@@ -38,7 +38,7 @@ export default function ToggleButtonGroup({ children, value, onChange = () => nu
|
|
|
38
38
|
if (child && child.type === ToggleButton) {
|
|
39
39
|
return {
|
|
40
40
|
value: child.props.value,
|
|
41
|
-
isActive: child.props.value === value
|
|
41
|
+
isActive: child.props.value === value,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
});
|
|
@@ -8,7 +8,8 @@ import Label from '../elements/Label';
|
|
|
8
8
|
import Select from '../elements/Select';
|
|
9
9
|
import FormikForm from '../elements/formik/FormikForm';
|
|
10
10
|
import FormikInput from '../elements/formik/FormikInput';
|
|
11
|
-
import
|
|
11
|
+
import FormikOnChange from '../elements/formik/FormikOnChange';
|
|
12
|
+
import { RESET_SELECTED_TOOL, APPLY_BASE_LINE_CORRECTION_FILTER, CALCULATE_BASE_LINE_CORRECTION_FILTER, } from '../reducer/types/Types';
|
|
12
13
|
const styles = {
|
|
13
14
|
container: {
|
|
14
15
|
padding: '5px',
|
|
@@ -26,7 +27,7 @@ function BaseLineCorrectionPanel() {
|
|
|
26
27
|
const formRef = useRef();
|
|
27
28
|
const algorithmRef = useRef();
|
|
28
29
|
const [algorithm, setAlgorithm] = useState('polynomial');
|
|
29
|
-
const handleApplyFilter = useCallback((values) => {
|
|
30
|
+
const handleApplyFilter = useCallback((values, liveUpdate = false) => {
|
|
30
31
|
let options = {};
|
|
31
32
|
switch (algorithm) {
|
|
32
33
|
case 'airpls':
|
|
@@ -45,7 +46,9 @@ function BaseLineCorrectionPanel() {
|
|
|
45
46
|
break;
|
|
46
47
|
}
|
|
47
48
|
dispatch({
|
|
48
|
-
type:
|
|
49
|
+
type: liveUpdate
|
|
50
|
+
? CALCULATE_BASE_LINE_CORRECTION_FILTER
|
|
51
|
+
: APPLY_BASE_LINE_CORRECTION_FILTER,
|
|
49
52
|
options,
|
|
50
53
|
});
|
|
51
54
|
}, [algorithm, dispatch]);
|
|
@@ -85,6 +88,6 @@ function BaseLineCorrectionPanel() {
|
|
|
85
88
|
return { validation: {}, initialValue: {} };
|
|
86
89
|
}
|
|
87
90
|
}, [algorithm]);
|
|
88
|
-
return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Algorithm: " }), _jsx(Select, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 },
|
|
91
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("span", { style: styles.label, children: "Algorithm: " }), _jsx(Select, { ref: algorithmRef, data: getAlgorithmsList(), style: { marginLeft: 10, marginRight: 10 }, defaultValue: "polynomial", onChange: changeAlgorithmHandler }), _jsxs(FormikForm, { ref: formRef, onSubmit: (values) => handleApplyFilter(values), initialValues: formData.initialValue, validationSchema: formData.validation, children: [algorithm && algorithm === 'airpls' && (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(Label, { title: "maxIterations:", children: _jsx(FormikInput, { type: "number", name: "maxIterations", debounceTime: 250 }) }), _jsx(Label, { title: "tolerance:", style: { label: { padding: '0 5px' } }, children: _jsx(FormikInput, { type: "number", name: "tolerance", debounceTime: 250 }) })] })), algorithm && ['autoPolynomial', 'polynomial'].includes(algorithm) && (_jsx(Label, { title: "degree [ 1 - 6 ]:", children: _jsx(FormikInput, { type: "number", name: "degree", min: 1, max: 6, style: { inputWrapper: { height: '100%' } }, debounceTime: 250 }) })), _jsx(FormikOnChange, { onChange: (values) => handleApplyFilter(values, true) })] }, JSON.stringify(formData.initialValue)), _jsx(ActionButtons, { onDone: () => formRef.current.submitForm(), onCancel: handleCancelFilter })] }));
|
|
89
92
|
}
|
|
90
93
|
export default BaseLineCorrectionPanel;
|
|
@@ -22,7 +22,7 @@ function HeaderInner(props) {
|
|
|
22
22
|
const modal = useModal();
|
|
23
23
|
const { current: { display: { general }, }, workspace, dispatch, } = usePreferences();
|
|
24
24
|
const workspacesList = useWorkspacesList();
|
|
25
|
-
const hideGeneralSettings = general?.hideGeneralSettings && workspace.base
|
|
25
|
+
const hideGeneralSettings = !!(general?.hideGeneralSettings && workspace.base);
|
|
26
26
|
const selectedPanel = useMemo(() => {
|
|
27
27
|
switch (selectedOptionPanel) {
|
|
28
28
|
case options.zeroFilling.id:
|
|
@@ -33,7 +33,7 @@ function HeaderInner(props) {
|
|
|
33
33
|
return _jsx(AutoPeakPickingOptionPanel, {});
|
|
34
34
|
case options.rangesPicking.id:
|
|
35
35
|
return _jsx(RangesPickingOptionPanel, {});
|
|
36
|
-
case options.
|
|
36
|
+
case options.baselineCorrection.id:
|
|
37
37
|
return _jsx(BaseLineCorrectionPanel, {});
|
|
38
38
|
case options.zone2D.id:
|
|
39
39
|
return _jsx(Zones2DOptionPanel, {});
|
|
@@ -36,7 +36,7 @@ function ZeroFillingOptionsPanel() {
|
|
|
36
36
|
type: APPLY_ZERO_FILLING_FILTER,
|
|
37
37
|
value: {
|
|
38
38
|
zeroFillingSize: Number(sizeTextInputRef.current.value),
|
|
39
|
-
lineBroadeningValue
|
|
39
|
+
lineBroadeningValue,
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}, [dispatch, lineBroadeningValue]);
|
|
@@ -6,7 +6,7 @@ export default function useActiveSpectrumStyleOptions(id) {
|
|
|
6
6
|
const { activeSpectrum } = useChartData();
|
|
7
7
|
const preferences = usePreferences();
|
|
8
8
|
return useMemo(() => {
|
|
9
|
-
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id
|
|
9
|
+
const isActive = activeSpectrum === null ? true : id === activeSpectrum.id;
|
|
10
10
|
const opacity = isActive
|
|
11
11
|
? 1
|
|
12
12
|
: get(preferences.current, 'controllers.dimmedSpectraTransparency', 0.1);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { NMRiumToolBarPreferences } from '../../types/NMRiumToolBarPreferences';
|
|
2
|
+
export declare function useCheckToolsVisibility(): (toolKey: keyof NMRiumToolBarPreferences) => boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import lodashGet from 'lodash/get';
|
|
2
|
+
import { useCallback } from 'react';
|
|
2
3
|
import { usePreferences } from '../context/PreferencesContext';
|
|
3
4
|
export function useCheckToolsVisibility() {
|
|
4
5
|
const preferences = usePreferences();
|
|
5
|
-
return (toolKey) => lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, true);
|
|
6
|
+
return useCallback((toolKey) => lodashGet(preferences.current, `display.toolBarButtons.${toolKey}`, true), [preferences]);
|
|
6
7
|
}
|
|
@@ -30,7 +30,7 @@ export default function useExport() {
|
|
|
30
30
|
async function handle() {
|
|
31
31
|
//exported file name by default will be the first spectrum name
|
|
32
32
|
const fileName = state.data[0]?.display?.name;
|
|
33
|
-
const exportedData = toJSON(state);
|
|
33
|
+
const exportedData = toJSON(state, 'nmrium');
|
|
34
34
|
await exportAsJSON(exportedData, fileName, spaceIndent, isCompressed);
|
|
35
35
|
hideLoading();
|
|
36
36
|
}
|
|
@@ -78,7 +78,7 @@ export default function useExport() {
|
|
|
78
78
|
const hideLoading = await alert.showLoading(`Exporting as ${name}.nmrium process in progress`);
|
|
79
79
|
setTimeout(() => {
|
|
80
80
|
void (async () => {
|
|
81
|
-
const exportedData = toJSON(state, dataExportOption);
|
|
81
|
+
const exportedData = toJSON(state, 'nmrium', dataExportOption);
|
|
82
82
|
const spaceIndent = pretty ? 2 : 0;
|
|
83
83
|
await exportAsJSON(exportedData, name, spaceIndent, compressed);
|
|
84
84
|
hideLoading();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import lodashGet from 'lodash/get';
|
|
2
|
-
import
|
|
2
|
+
import numeral from 'numeral';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { usePreferences } from '../context/PreferencesContext';
|
|
5
5
|
export function useFormatNumberByNucleus(nucleus) {
|
|
@@ -11,9 +11,8 @@ export function useFormatNumberByNucleus(nucleus) {
|
|
|
11
11
|
return useMemo(() => {
|
|
12
12
|
function formatFun(n) {
|
|
13
13
|
return (value, formatKey = 'ppm', prefix = '', suffix = '') => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
suffix);
|
|
14
|
+
const formattedNumber = numeral(Number(value)).format(lodashGet(nucleusByKey, `${n.toLowerCase()}.${formatKey}`, '0.0'));
|
|
15
|
+
return `${prefix}${formattedNumber}${suffix}`;
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
if (!nucleus) {
|
|
@@ -9,6 +9,7 @@ import { useChartData } from '../context/ChartContext';
|
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
10
|
import { LoaderProvider } from '../context/LoaderContext';
|
|
11
11
|
import { useAlert } from '../elements/popup/Alert';
|
|
12
|
+
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
12
13
|
import { LOAD_MOL_FILE, LOAD_JSON_FILE, LOAD_JCAMP_FILE, SET_LOADING_FLAG, LOAD_ZIP_FILE, LOAD_JDF_FILE, LOAD_NMREDATA_FILE, } from '../reducer/types/Types';
|
|
13
14
|
import { FILES_TYPES, FILES_SIGNATURES, getFileExtension, getFileSignature, loadFiles, loadFilesFromZip, } from '../utility/FileUtility';
|
|
14
15
|
const style = css `
|
|
@@ -46,6 +47,7 @@ function DropZone(props) {
|
|
|
46
47
|
const { width, height } = useChartData();
|
|
47
48
|
const dispatch = useDispatch();
|
|
48
49
|
const alert = useAlert();
|
|
50
|
+
const isToolEnabled = useCheckToolsVisibility();
|
|
49
51
|
const loadSubFilesFromZip = useCallback(async (extractedfiles, uniqueFileExtensions) => {
|
|
50
52
|
for (let extension of uniqueFileExtensions) {
|
|
51
53
|
const selectedFilesByExtensions = extractedfiles.filter((file) => getFileExtension(file.name) === extension);
|
|
@@ -192,14 +194,18 @@ function DropZone(props) {
|
|
|
192
194
|
dispatch({ type: SET_LOADING_FLAG, isLoading: true });
|
|
193
195
|
void loadFilesHandler(droppedFiles);
|
|
194
196
|
}, [dispatch, loadFilesHandler]);
|
|
197
|
+
const isImportEnabled = isToolEnabled('import');
|
|
195
198
|
const { getRootProps, getInputProps, isDragActive, open: openImportDialog, } = useDropzone({
|
|
196
199
|
onDrop,
|
|
197
200
|
noClick: true,
|
|
198
201
|
noKeyboard: true,
|
|
202
|
+
noDrag: !isImportEnabled,
|
|
199
203
|
});
|
|
200
204
|
const open = useCallback(() => {
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
if (isImportEnabled) {
|
|
206
|
+
openImportDialog();
|
|
207
|
+
}
|
|
208
|
+
}, [isImportEnabled, openImportDialog]);
|
|
203
209
|
return (_jsx(LoaderProvider, { value: open, children: _jsxs("div", { ...getRootProps(), role: "none", css: containerStyle, children: [_jsx("input", { "data-test-id": "dropzone-input", ...getInputProps() }), isDragActive && (_jsxs("div", { css: style, style: {
|
|
204
210
|
width: `${width}px`,
|
|
205
211
|
height: `${height}px`,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
interface NoDataProps {
|
|
3
3
|
isEmpty?: boolean;
|
|
4
4
|
canOpenLoader?: boolean;
|
|
5
5
|
emptyText?: ReactNode;
|
|
6
|
+
style?: CSSProperties;
|
|
6
7
|
}
|
|
7
|
-
declare function NoData({ isEmpty, emptyText, canOpenLoader, }: NoDataProps):
|
|
8
|
+
declare function NoData({ isEmpty, emptyText, canOpenLoader, style, }: NoDataProps): JSX.Element | null;
|
|
8
9
|
export default NoData;
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { jsx as _jsx } from "
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
2
|
import { useLoader } from '../context/LoaderContext';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function NoData({ isEmpty = true, emptyText = 'Drag and drop here a JCAMP-DX, zipped Bruker folder, Jeol jdf or NMRium file', canOpenLoader = true, }) {
|
|
3
|
+
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
4
|
+
const styles = {
|
|
5
|
+
container: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
backgroundColor: ' rgba(255, 255, 255, 0.25)',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
userSelect: 'none',
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
14
|
+
outline: '10px dashed rgba(0, 0, 0, 0.3)',
|
|
15
|
+
outlineOffset: '-10px',
|
|
16
|
+
paddingLeft: '20px',
|
|
17
|
+
paddingRight: '20px',
|
|
18
|
+
},
|
|
19
|
+
text: {
|
|
20
|
+
padding: '15px 30px',
|
|
21
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
22
|
+
borderRadius: '39px',
|
|
23
|
+
color: 'white',
|
|
24
|
+
fontSize: 'x-large',
|
|
25
|
+
fontWeight: 'bold',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
function NoData({ isEmpty = true, emptyText = 'Drag and drop here a JCAMP-DX, zipped Bruker folder, Jeol jdf or NMRium file', canOpenLoader = true, style, }) {
|
|
31
29
|
const openLoader = useLoader();
|
|
30
|
+
const isToolEnabled = useCheckToolsVisibility();
|
|
32
31
|
if (!isEmpty) {
|
|
33
32
|
return null;
|
|
34
33
|
}
|
|
35
|
-
return (_jsx("div", {
|
|
34
|
+
return (_jsx("div", { style: { ...styles.container, ...style }, ...(canOpenLoader && { onClick: openLoader }), children: _jsx("p", { style: styles.text, children: isToolEnabled('import')
|
|
35
|
+
? emptyText
|
|
36
|
+
: 'Importation feature has been disabled' }) }));
|
|
36
37
|
}
|
|
37
38
|
export default NoData;
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import { StructureEditor } from 'react-ocl/full';
|
|
5
|
+
import { isMolFileEmpty } from '../../data/utilities/isMolFileEmpty';
|
|
5
6
|
import { useDispatch } from '../context/DispatchContext';
|
|
6
7
|
import ActionButtons from '../elements/ActionButtons';
|
|
7
8
|
import { useModal } from '../elements/popup/Modal';
|
|
@@ -21,8 +22,7 @@ function MoleculeStructureEditorModal(props) {
|
|
|
21
22
|
}
|
|
22
23
|
}, [selectedMolecule]);
|
|
23
24
|
const cb = useCallback((newMolfile) => {
|
|
24
|
-
|
|
25
|
-
setMolfile(molText?.trim() ? newMolfile : null);
|
|
25
|
+
setMolfile(isMolFileEmpty(newMolfile) ? null : newMolfile);
|
|
26
26
|
}, [setMolfile]);
|
|
27
27
|
const handleClose = useCallback(() => {
|
|
28
28
|
onClose();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
interface EditRangeModalProps {
|
|
2
2
|
onSaveEditRangeModal: (value: any) => Promise<void> | null | void;
|
|
3
|
-
onCloseEditRangeModal: () => void;
|
|
3
|
+
onCloseEditRangeModal: (range: any, originalRange: any) => void;
|
|
4
4
|
onZoomEditRangeModal: (value: any) => void;
|
|
5
5
|
range: any;
|
|
6
|
-
|
|
6
|
+
manualRange?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare function EditRangeModal({ onSaveEditRangeModal, onCloseEditRangeModal, onZoomEditRangeModal,
|
|
8
|
+
declare function EditRangeModal({ onSaveEditRangeModal, onCloseEditRangeModal, onZoomEditRangeModal, manualRange, range: originRange, }: EditRangeModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default EditRangeModal;
|