nmrium 0.41.0 → 0.43.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 +1 -1
- package/lib/component/1d/Chart1D.js +3 -2
- package/lib/component/1d/Line.js +1 -1
- package/lib/component/1d/Viewer1D.js +15 -3
- package/lib/component/1d/integral/IntegralResizable.js +4 -3
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +20 -25
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +2 -0
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +59 -0
- package/lib/component/1d/peaks/PeakEditionManager.d.ts +18 -0
- package/lib/component/1d/peaks/PeakEditionManager.js +98 -0
- package/lib/component/1d/peaks/Peaks.d.ts +1 -0
- package/lib/component/1d/peaks/Peaks.js +22 -0
- package/lib/component/1d/ranges/Range.js +3 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +11 -31
- package/lib/component/1d/utilities/intersectionResolver.d.ts +25 -0
- package/lib/component/1d/utilities/intersectionResolver.js +71 -0
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib/component/2d/SlicingView.js +1 -1
- package/lib/component/2d/ft/Contours.js +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +5 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +47 -6
- package/lib/component/assignment/index.d.ts +6 -1
- package/lib/component/assignment/index.js +5 -1
- package/lib/component/context/DispatchContext.d.ts +1 -2
- package/lib/component/context/KeyModifierContext.d.ts +13 -0
- package/lib/component/context/KeyModifierContext.js +39 -0
- package/lib/component/context/PreferencesContext.d.ts +39 -39
- package/lib/component/elements/Button.js +2 -0
- package/lib/component/elements/Input.js +1 -0
- package/lib/component/elements/NumberInput.d.ts +1 -0
- package/lib/component/elements/NumberInput.js +10 -3
- package/lib/component/elements/Scroller.d.ts +15 -0
- package/lib/component/elements/Scroller.js +31 -0
- package/lib/component/elements/formik/FormikOnChange.js +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib/component/header/BaseLineCorrectionPanel.js +31 -10
- package/lib/component/header/Header.d.ts +10 -3
- package/lib/component/header/Header.js +5 -5
- package/lib/component/header/ZeroFillingOptionsPanel.js +37 -31
- package/lib/component/highlight/index.d.ts +1 -0
- package/lib/component/highlight/index.js +1 -0
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib/component/hooks/useResizerStatus.d.ts +2 -0
- package/lib/component/hooks/useResizerStatus.js +7 -0
- package/lib/component/hooks/useSaveSettings.js +9 -11
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/main/ErrorOverlay.js +20 -0
- package/lib/component/main/InnerNMRium.d.ts +7 -0
- package/lib/component/main/InnerNMRium.js +52 -0
- package/lib/component/main/InnerNMRiumContents.d.ts +14 -0
- package/lib/component/main/InnerNMRiumContents.js +89 -0
- package/lib/component/main/NMRium.d.ts +23 -0
- package/lib/component/main/NMRium.js +13 -0
- package/lib/component/main/NMRiumStateProvider.d.ts +9 -0
- package/lib/component/main/NMRiumStateProvider.js +74 -0
- package/lib/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib/component/main/StateError.d.ts +4 -0
- package/lib/component/main/StateError.js +16 -0
- package/lib/component/main/index.d.ts +3 -0
- package/lib/component/main/index.js +3 -0
- package/lib/component/main/types.d.ts +18 -0
- package/lib/component/main/types.js +2 -0
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +5 -16
- package/lib/component/modal/changeSum/ChangeSumModal.js +6 -115
- package/lib/component/modal/changeSum/ChangeSumModalContents.d.ts +18 -0
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +94 -0
- package/lib/component/modal/setting/GeneralSettings.js +2 -2
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +6 -11
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +3 -9
- package/lib/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +11 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +6 -10
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
- package/lib/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +33 -26
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +3 -4
- package/lib/component/panels/header/DefaultPanelHeader.js +9 -5
- package/lib/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib/component/reducer/IgnoreActions.js +0 -1
- package/lib/component/reducer/Reducer.d.ts +1 -6
- package/lib/component/reducer/Reducer.js +32 -6
- package/lib/component/reducer/actions/FiltersActions.d.ts +32 -11
- package/lib/component/reducer/actions/FiltersActions.js +96 -28
- package/lib/component/reducer/actions/IntegralsActions.d.ts +6 -2
- package/lib/component/reducer/actions/IntegralsActions.js +44 -20
- package/lib/component/reducer/actions/MoleculeActions.d.ts +6 -2
- package/lib/component/reducer/actions/MoleculeActions.js +8 -2
- package/lib/component/reducer/actions/PeaksActions.d.ts +6 -4
- package/lib/component/reducer/actions/PeaksActions.js +19 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +6 -2
- package/lib/component/reducer/actions/RangesActions.js +31 -3
- package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +13 -3
- package/lib/component/toolbar/ToolTypes.d.ts +1 -0
- package/lib/component/toolbar/ToolTypes.js +36 -0
- package/lib/component/utility/PathBuilder.js +11 -0
- package/lib/component/utility/export.js +7 -4
- package/lib/component/utility/filterType.d.ts +3 -0
- package/lib/component/utility/filterType.js +1 -0
- package/lib/component/workspaces/basic.js +2 -0
- package/lib/component/workspaces/embedded.js +2 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/prediction.js +9 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +10 -5
- package/lib/data/PredictionManager.d.ts +3 -3
- package/lib/data/PredictionManager.js +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +1 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +2 -8
- package/lib/data/data1d/database.d.ts +4 -2
- package/lib/data/data1d/database.js +10 -3
- package/lib/data/molecules/Molecule.js +2 -2
- package/lib/data/molecules/MoleculeManager.d.ts +1 -0
- package/lib/data/molecules/MoleculeManager.js +14 -0
- package/lib/data/utilities/checkModifierKeyActivated.d.ts +1 -1
- package/lib/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/Line.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +15 -3
- package/lib-cjs/component/1d/integral/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +19 -24
- package/lib-cjs/component/1d/peaks/PeakAnnotationsSpreadMode.js +64 -0
- package/lib-cjs/component/1d/peaks/PeakEditionManager.js +129 -0
- package/lib-cjs/component/1d/peaks/Peaks.js +29 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -1
- package/lib-cjs/component/1d/tool/BaseLineZones.js +11 -34
- package/lib-cjs/component/1d/utilities/intersectionResolver.js +75 -0
- package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -2
- package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib-cjs/component/2d/SlicingView.js +1 -1
- package/lib-cjs/component/2d/ft/Contours.js +1 -1
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +46 -5
- package/lib-cjs/component/assignment/index.js +5 -1
- package/lib-cjs/component/context/KeyModifierContext.js +44 -0
- package/lib-cjs/component/elements/Button.js +2 -0
- package/lib-cjs/component/elements/Input.js +1 -0
- package/lib-cjs/component/elements/NumberInput.js +12 -2
- package/lib-cjs/component/elements/Scroller.js +35 -0
- package/lib-cjs/component/elements/formik/FormikOnChange.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +23 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +30 -9
- package/lib-cjs/component/header/Header.js +5 -5
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +35 -29
- package/lib-cjs/component/highlight/index.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumPeaksViewState.js +1 -0
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +7 -3
- package/lib-cjs/component/hooks/useResizerStatus.js +11 -0
- package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
- package/lib-cjs/component/hooks/useSpectrum.js +1 -1
- package/lib-cjs/component/main/ErrorOverlay.js +26 -0
- package/lib-cjs/component/main/InnerNMRium.js +82 -0
- package/lib-cjs/component/main/InnerNMRiumContents.js +96 -0
- package/lib-cjs/component/main/NMRium.js +19 -0
- package/lib-cjs/component/main/NMRiumStateProvider.js +80 -0
- package/lib-cjs/component/{SplitPaneWrapper.js → main/SplitPaneWrapper.js} +1 -1
- package/lib-cjs/component/main/StateError.js +20 -0
- package/lib-cjs/component/main/index.js +21 -0
- package/lib-cjs/component/main/types.js +3 -0
- package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +6 -141
- package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +124 -0
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -2
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +29 -11
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +14 -10
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +32 -3
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +29 -10
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideSpectrumButton.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +27 -3
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +26 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +33 -26
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +11 -5
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +0 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -2
- package/lib-cjs/component/reducer/IgnoreActions.js +0 -1
- package/lib-cjs/component/reducer/Reducer.js +31 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +98 -28
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +45 -20
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +9 -2
- package/lib-cjs/component/reducer/actions/PeaksActions.js +20 -1
- package/lib-cjs/component/reducer/actions/RangesActions.js +31 -2
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib-cjs/component/toolbar/FunctionToolBar.js +13 -3
- package/lib-cjs/component/toolbar/ToolTypes.js +36 -0
- package/lib-cjs/component/utility/PathBuilder.js +11 -0
- package/lib-cjs/component/utility/export.js +7 -4
- package/lib-cjs/component/utility/filterType.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +2 -0
- package/lib-cjs/component/workspaces/embedded.js +2 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/prediction.js +9 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +10 -5
- package/lib-cjs/data/PredictionManager.js +9 -9
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +1 -7
- package/lib-cjs/data/data1d/database.js +10 -3
- package/lib-cjs/data/molecules/Molecule.js +2 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +16 -1
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +8 -13
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/1d/peaks/PeakAnnotation.d.ts +0 -12
- package/lib/component/1d/peaks/PeakAnnotation.js +0 -116
- package/lib/component/ErrorOverlay.js +0 -27
- package/lib/component/NMRium.d.ts +0 -42
- package/lib/component/NMRium.js +0 -237
- package/lib/component/reducer/actions/GlobalActions.d.ts +0 -9
- package/lib/component/reducer/actions/GlobalActions.js +0 -4
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +0 -118
- package/lib-cjs/component/ErrorOverlay.js +0 -30
- package/lib-cjs/component/NMRium.js +0 -267
- package/lib-cjs/component/reducer/actions/GlobalActions.js +0 -7
- /package/lib/component/{ErrorOverlay.d.ts → main/ErrorOverlay.d.ts} +0 -0
- /package/lib/component/{SplitPaneWrapper.d.ts → main/SplitPaneWrapper.d.ts} +0 -0
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleTogglePeaksViewProperty = exports.handleChangePeakShape = exports.handleOptimizePeaks = exports.handleAutoPeakPicking = exports.handleDeletePeak = exports.handleAddPeaks = exports.handleAddPeak = void 0;
|
|
6
|
+
exports.handleChangePeaksDisplayingMode = exports.handleTogglePeaksViewProperty = exports.handleChangePeakShape = exports.handleOptimizePeaks = exports.handleAutoPeakPicking = exports.handleDeletePeak = exports.handleAddPeaks = exports.handleAddPeak = void 0;
|
|
7
7
|
const uuid_1 = require("@lukeed/uuid");
|
|
8
8
|
const immer_1 = require("immer");
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
@@ -158,3 +158,22 @@ function togglePeaksViewProperty(draft, key) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
+
function handleChangePeaksDisplayingMode(draft) {
|
|
162
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
163
|
+
if (activeSpectrum?.id) {
|
|
164
|
+
const peaksView = draft.view.peaks;
|
|
165
|
+
if (peaksView[activeSpectrum.id]) {
|
|
166
|
+
peaksView[activeSpectrum.id].displayingMode =
|
|
167
|
+
peaksView[activeSpectrum.id].displayingMode === 'single'
|
|
168
|
+
? 'spread'
|
|
169
|
+
: 'single';
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
const defaultPeaksView = { ...useActiveSpectrumPeaksViewState_1.defaultPeaksViewState };
|
|
173
|
+
defaultPeaksView.displayingMode =
|
|
174
|
+
defaultPeaksView.displayingMode === 'single' ? 'spread' : 'single';
|
|
175
|
+
peaksView[activeSpectrum.id] = defaultPeaksView;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.handleChangePeaksDisplayingMode = handleChangePeaksDisplayingMode;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.handleShowJGraph = exports.handleAutoSpectraRangesDetection = exports.handleShowRangesIntegrals = exports.handleShowMultiplicityTrees = exports.handleUpdateRange = exports.handleChangeRangesSumFlag = exports.handleSetDiaIDRange = exports.unlinkRange = exports.handleUnlinkRange = exports.handleSaveEditedRange = exports.handleChangeRangeSignalKind = exports.handleChangeRangeSignalValue = exports.handleChangeRangeRelativeValue = exports.handleResizeRange = exports.handleAddRange = exports.handleChangeRangeSum = exports.handleDeleteSignal = exports.deleteSignal1D = exports.handleDeleteRange = exports.handleAutoRangesDetection = void 0;
|
|
6
|
+
exports.handleShowJGraph = exports.handleAutoSpectraRangesDetection = exports.handleShowRangesIntegrals = exports.handleShowMultiplicityTrees = exports.handleUpdateRange = exports.handleChangeRangesSumFlag = exports.handleSetDiaIDRange = exports.unlinkRange = exports.handleUnlinkRange = exports.handleSaveEditedRange = exports.handleChangeRangeSignalKind = exports.handleChangeRangeSignalValue = exports.handleChangeRangeRelativeValue = exports.handleResizeRange = exports.handleAddRange = exports.handleChangeRangeSum = exports.handleDeleteSignal = exports.deleteSignal1D = exports.handleDeleteRange = exports.handleAutoRangesDetection = exports.handleCutRange = void 0;
|
|
7
7
|
const uuid_1 = require("@lukeed/uuid");
|
|
8
8
|
const immer_1 = require("immer");
|
|
9
9
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
@@ -16,6 +16,7 @@ const RangeUtilities_1 = require("../../../data/utilities/RangeUtilities");
|
|
|
16
16
|
const Reducer_1 = require("../Reducer");
|
|
17
17
|
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
18
18
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
19
|
+
const getSpectrum_1 = require("../helper/getSpectrum");
|
|
19
20
|
const CorrelationsActions_1 = require("./CorrelationsActions");
|
|
20
21
|
const DomainActions_1 = require("./DomainActions");
|
|
21
22
|
const ToolsActions_1 = require("./ToolsActions");
|
|
@@ -266,6 +267,13 @@ function handleChangeRangeSum(draft, action) {
|
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
exports.handleChangeRangeSum = handleChangeRangeSum;
|
|
270
|
+
function initiateRangeSumOptions(datum, options) {
|
|
271
|
+
const { nucleus, molecules } = options;
|
|
272
|
+
datum.ranges.options = (0, SumManager_1.initSumOptions)(datum.ranges.options, {
|
|
273
|
+
molecules,
|
|
274
|
+
nucleus,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
269
277
|
//action
|
|
270
278
|
function handleAddRange(draft, action) {
|
|
271
279
|
const { startX, endX } = action.payload;
|
|
@@ -275,12 +283,16 @@ function handleAddRange(draft, action) {
|
|
|
275
283
|
if (activeSpectrum?.id) {
|
|
276
284
|
const { index } = activeSpectrum;
|
|
277
285
|
const [from, to] = range;
|
|
278
|
-
|
|
286
|
+
const datum = data[index];
|
|
287
|
+
(0, Spectrum1D_1.addRange)(datum, {
|
|
279
288
|
from,
|
|
280
289
|
to,
|
|
290
|
+
});
|
|
291
|
+
initiateRangeSumOptions(datum, {
|
|
281
292
|
nucleus,
|
|
282
293
|
molecules,
|
|
283
294
|
});
|
|
295
|
+
(0, Spectrum1D_1.updateRangesRelativeValues)(datum);
|
|
284
296
|
(0, CorrelationsActions_1.handleUpdateCorrelations)(draft);
|
|
285
297
|
(0, DomainActions_1.setIntegralsYDomain)(draft, data[index]);
|
|
286
298
|
}
|
|
@@ -384,3 +396,20 @@ function handleShowJGraph(draft, action) {
|
|
|
384
396
|
}
|
|
385
397
|
}
|
|
386
398
|
exports.handleShowJGraph = handleShowJGraph;
|
|
399
|
+
function handleCutRange(draft, action) {
|
|
400
|
+
const { cutValue } = action.payload;
|
|
401
|
+
const spectrum = (0, getSpectrum_1.getSpectrum)(draft);
|
|
402
|
+
const ranges = spectrum.ranges.values;
|
|
403
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
404
|
+
const { to, from } = ranges[i];
|
|
405
|
+
if (cutValue > from && cutValue < to) {
|
|
406
|
+
ranges.splice(i, 1);
|
|
407
|
+
(0, Spectrum1D_1.addRange)(spectrum, { from, to: cutValue });
|
|
408
|
+
(0, Spectrum1D_1.addRange)(spectrum, { from: cutValue, to });
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
(0, Spectrum1D_1.updateRangesRelativeValues)(spectrum);
|
|
412
|
+
(0, DomainActions_1.setIntegralsYDomain)(draft, spectrum);
|
|
413
|
+
(0, CorrelationsActions_1.handleUpdateCorrelations)(draft);
|
|
414
|
+
}
|
|
415
|
+
exports.handleCutRange = handleCutRange;
|
|
@@ -10,21 +10,25 @@ const LocalStorage_1 = require("../../../utility/LocalStorage");
|
|
|
10
10
|
const workspaceDefaultProperties_1 = require("../../../workspaces/workspaceDefaultProperties");
|
|
11
11
|
function addWorkspace(draft, action) {
|
|
12
12
|
const { workspaceKey, data } = action.payload;
|
|
13
|
-
const newWorkSpace = (0, merge_1.default)({}, workspaceDefaultProperties_1.workspaceDefaultProperties,
|
|
14
13
|
// eslint-disable-next-line unicorn/prefer-logical-operator-over-ternary
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
newWorkSpace;
|
|
28
|
-
|
|
14
|
+
const workSpaceData = data
|
|
15
|
+
? data
|
|
16
|
+
: draft.workspaces?.[draft.workspace.current];
|
|
17
|
+
if (workSpaceData) {
|
|
18
|
+
const newWorkSpace = (0, merge_1.default)({}, workspaceDefaultProperties_1.workspaceDefaultProperties, workSpaceData, {
|
|
19
|
+
version: 1,
|
|
20
|
+
label: workspaceKey,
|
|
21
|
+
source: 'user',
|
|
22
|
+
});
|
|
23
|
+
const newWorkspaceKey = (0, uuid_1.v4)();
|
|
24
|
+
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
25
|
+
localData.currentWorkspace = newWorkspaceKey;
|
|
26
|
+
localData.workspaces[newWorkspaceKey] = newWorkSpace;
|
|
27
|
+
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
28
|
+
draft.workspaces[newWorkspaceKey] = newWorkSpace;
|
|
29
|
+
draft.originalWorkspaces[newWorkspaceKey] =
|
|
30
|
+
newWorkSpace;
|
|
31
|
+
draft.workspace.current = newWorkspaceKey;
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
exports.addWorkspace = addWorkspace;
|
|
@@ -33,11 +33,21 @@ function FunctionToolBarInner({ defaultValue, ftCounter, }) {
|
|
|
33
33
|
type: 'APPLY_FFT_FILTER',
|
|
34
34
|
});
|
|
35
35
|
}, [dispatch]);
|
|
36
|
-
|
|
36
|
+
const handleFFtDimension1Filter = (0, react_1.useCallback)(() => {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: 'APPLY_FFT_DIMENSION_1_FILTER',
|
|
39
|
+
});
|
|
40
|
+
}, [dispatch]);
|
|
41
|
+
const handleFFtDimension2Filter = (0, react_1.useCallback)(() => {
|
|
42
|
+
dispatch({
|
|
43
|
+
type: 'APPLY_FFT_DIMENSION_2_FILTER',
|
|
44
|
+
});
|
|
45
|
+
}, [dispatch]);
|
|
46
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtonGroup_1.default, { value: option, onChange: handleChange, children: [isButtonVisible('zoom') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zoom.id, id: ToolTypes_1.options.zoom.id, title: `${ToolTypes_1.options.zoom.label}`, children: (0, jsx_runtime_1.jsx)(fa_1.FaSearchPlus, {}) }, ToolTypes_1.options.zoom.id)), isButtonVisible('zoomOut') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: (0, jsx_runtime_1.jsx)(fa_1.FaExpand, {}) })), isButtonVisible('peakPicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.peakPicking.id, title: `${ToolTypes_1.options.peakPicking.label} ( Press p )`, id: ToolTypes_1.options.peakPicking.id, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPeakPicking, {}) }, ToolTypes_1.options.peakPicking.id)), isButtonVisible('integral') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.integral.id, id: ToolTypes_1.options.integral.id, title: `${ToolTypes_1.options.integral.label} ( Press i )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, {}) }, ToolTypes_1.options.integral.id)), isButtonVisible('zonePicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zonePicking.id, id: ToolTypes_1.options.zonePicking.id, title: `${ToolTypes_1.options.zonePicking.label} ( Press r )`, children: (0, jsx_runtime_1.jsx)(fa_1.FaDiceFour, {}) }, ToolTypes_1.options.zonePicking.id)), isButtonVisible('slicing') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.slicing.id, id: ToolTypes_1.options.slicing.id, title: `${ToolTypes_1.options.slicing.label}`, children: (0, jsx_runtime_1.jsx)("p", { children: "Slic" }) }, ToolTypes_1.options.slicing.id)), isButtonVisible('rangePicking') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.rangePicking.id, title: `${ToolTypes_1.options.rangePicking.label} ( Press r )`, id: ToolTypes_1.options.rangePicking.id, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrRangePicking, {}) }, ToolTypes_1.options.rangePicking.id)), isButtonVisible('multipleSpectraAnalysis', {
|
|
37
47
|
checkSpectrumType: false,
|
|
38
48
|
}) &&
|
|
39
|
-
ftCounter > 1 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.multipleSpectraAnalysis.id, id: ToolTypes_1.options.multipleSpectraAnalysis.id, title: ToolTypes_1.options.multipleSpectraAnalysis.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }, ToolTypes_1.options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.apodization.id, id: ToolTypes_1.options.apodization.id, title: `${ToolTypes_1.options.apodization.label} (Press a)`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrApodization, {}) }, ToolTypes_1.options.apodization.id)), isButtonVisible('zeroFilling') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zeroFilling.id, id: ToolTypes_1.options.zeroFilling.id, title: ToolTypes_1.options.zeroFilling.label
|
|
40
|
-
ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: ToolTypes_1.options.exclusionZones.id, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }) }, ToolTypes_1.options.exclusionZones.id))] }), isButtonVisible('fft') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fft.id, className: "cheminfo", title: ToolTypes_1.options.fft.label
|
|
49
|
+
ftCounter > 1 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.multipleSpectraAnalysis.id, id: ToolTypes_1.options.multipleSpectraAnalysis.id, title: ToolTypes_1.options.multipleSpectraAnalysis.label, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }, ToolTypes_1.options.multipleSpectraAnalysis.id)), isButtonVisible('apodization') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.apodization.id, id: ToolTypes_1.options.apodization.id, title: `${ToolTypes_1.options.apodization.label} (Press a)`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrApodization, {}) }, ToolTypes_1.options.apodization.id)), isButtonVisible('zeroFilling') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.zeroFilling.id, id: ToolTypes_1.options.zeroFilling.id, title: `${ToolTypes_1.options.zeroFilling.label} ( Press z )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrZeroFilling, {}) }, ToolTypes_1.options.zeroFilling.id)), isButtonVisible('phaseCorrection') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.phaseCorrection.id, id: ToolTypes_1.options.phaseCorrection.id, title: `${ToolTypes_1.options.phaseCorrection.label} ( Press a )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrPhaseCorrection, {}) }, ToolTypes_1.options.phaseCorrection.id)), isButtonVisible('baselineCorrection') && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.baselineCorrection.id, id: ToolTypes_1.options.baselineCorrection.id, title: `${ToolTypes_1.options.baselineCorrection.label} ( Press b )`, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrBaselineCorrection, {}) }, ToolTypes_1.options.baselineCorrection.id)), isButtonVisible('exclusionZones', { checkSpectrumType: false }) &&
|
|
50
|
+
ftCounter > 0 && ((0, jsx_runtime_1.jsx)(ToggleButton_1.default, { value: ToolTypes_1.options.exclusionZones.id, title: `${ToolTypes_1.options.exclusionZones.label} ( Press e )`, id: ToolTypes_1.options.exclusionZones.id, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: 18 }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrMultipleAnalysis, {}) }) }, ToolTypes_1.options.exclusionZones.id))] }), isButtonVisible('fft') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fft.id, className: "cheminfo", title: `${ToolTypes_1.options.fft.label} ( Press t )`, onClick: handleOnFFTFilter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension1') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fftDimension1.id, className: "cheminfo", title: ToolTypes_1.options.fftDimension1.label, onClick: handleFFtDimension1Filter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) })), isButtonVisible('fftDimension2') && ((0, jsx_runtime_1.jsx)(ui_1.Toolbar.Item, { id: ToolTypes_1.options.fftDimension2.id, className: "cheminfo", title: ToolTypes_1.options.fftDimension2.label, onClick: handleFFtDimension2Filter, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrFourierTransform, {}) }))] }));
|
|
41
51
|
}
|
|
42
52
|
const MemoizedFunctionToolBar = (0, react_1.memo)(FunctionToolBarInner);
|
|
43
53
|
function FunctionToolBar({ defaultValue = ToolTypes_1.options.zoom.id, }) {
|
|
@@ -291,6 +291,42 @@ exports.options = {
|
|
|
291
291
|
],
|
|
292
292
|
isToggle: false,
|
|
293
293
|
},
|
|
294
|
+
fftDimension1: {
|
|
295
|
+
id: 'fftDimension1',
|
|
296
|
+
label: 'Fourier transform dimension 1',
|
|
297
|
+
hasOptionPanel: false,
|
|
298
|
+
isFilter: true,
|
|
299
|
+
mode: Constants_1.DISPLAYER_MODE.DM_2D,
|
|
300
|
+
spectraOptions: [
|
|
301
|
+
{
|
|
302
|
+
info: [
|
|
303
|
+
{ key: 'isFid', value: true },
|
|
304
|
+
{ key: 'isComplex', value: true },
|
|
305
|
+
],
|
|
306
|
+
active: true,
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
isToggle: false,
|
|
310
|
+
isExperimental: true,
|
|
311
|
+
},
|
|
312
|
+
fftDimension2: {
|
|
313
|
+
id: 'fftDimension2',
|
|
314
|
+
label: 'Fourier transform dimension 2',
|
|
315
|
+
hasOptionPanel: false,
|
|
316
|
+
isFilter: true,
|
|
317
|
+
mode: Constants_1.DISPLAYER_MODE.DM_2D,
|
|
318
|
+
spectraOptions: [
|
|
319
|
+
{
|
|
320
|
+
info: [
|
|
321
|
+
{ key: 'isFid', value: true },
|
|
322
|
+
{ key: 'isComplex', value: true },
|
|
323
|
+
],
|
|
324
|
+
active: true,
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
isToggle: false,
|
|
328
|
+
isExperimental: true,
|
|
329
|
+
},
|
|
294
330
|
import: {
|
|
295
331
|
id: 'import',
|
|
296
332
|
label: 'Import',
|
|
@@ -6,9 +6,13 @@ class PathBuilder {
|
|
|
6
6
|
this.array = [];
|
|
7
7
|
}
|
|
8
8
|
moveTo(x, y) {
|
|
9
|
+
x = clamp(x);
|
|
10
|
+
y = clamp(y);
|
|
9
11
|
this.array.push(`M ${x} ${y}`);
|
|
10
12
|
}
|
|
11
13
|
lineTo(x, y) {
|
|
14
|
+
x = clamp(x);
|
|
15
|
+
y = clamp(y);
|
|
12
16
|
this.array.push(`L ${x} ${y}`);
|
|
13
17
|
}
|
|
14
18
|
closePath() {
|
|
@@ -20,3 +24,10 @@ class PathBuilder {
|
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
exports.PathBuilder = PathBuilder;
|
|
27
|
+
/**
|
|
28
|
+
* Clamp values to avoid rendering issues of the SVG.
|
|
29
|
+
* This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
|
|
30
|
+
*/
|
|
31
|
+
function clamp(value) {
|
|
32
|
+
return Math.max(-1e5, Math.min(1e5, value));
|
|
33
|
+
}
|
|
@@ -201,14 +201,17 @@ function getBlob(rootRef, elementID) {
|
|
|
201
201
|
return { blob, width, height };
|
|
202
202
|
}
|
|
203
203
|
exports.getBlob = getBlob;
|
|
204
|
+
function getMatrix(element) {
|
|
205
|
+
const transform = window
|
|
206
|
+
.getComputedStyle(element)
|
|
207
|
+
.getPropertyValue('transform');
|
|
208
|
+
return new DOMMatrix(transform);
|
|
209
|
+
}
|
|
204
210
|
function getMoleculesElement(rootRef) {
|
|
205
211
|
const nmriumViewer = rootRef.getRootNode().querySelector(`#nmrium-viewer`);
|
|
206
212
|
const floatingMoleculesGroup = document.createElement('g');
|
|
207
213
|
for (const element of nmriumViewer.querySelectorAll('.draggable-molecule')) {
|
|
208
|
-
const
|
|
209
|
-
.getComputedStyle(element)
|
|
210
|
-
.getPropertyValue('transform');
|
|
211
|
-
const matrix = new DOMMatrix(transform);
|
|
214
|
+
const matrix = getMatrix(element);
|
|
212
215
|
const actionHeaderElement = element.querySelector('.float-molecule-actions');
|
|
213
216
|
const molElement = element
|
|
214
217
|
.cloneNode(true)
|
|
@@ -4,6 +4,13 @@ exports.prediction = void 0;
|
|
|
4
4
|
exports.prediction = {
|
|
5
5
|
version: 1,
|
|
6
6
|
label: 'Prediction',
|
|
7
|
+
general: {
|
|
8
|
+
dimmedSpectraOpacity: 0.5,
|
|
9
|
+
verticalSplitterPosition: '440px',
|
|
10
|
+
verticalSplitterCloseThreshold: 600,
|
|
11
|
+
spectraRendering: 'auto',
|
|
12
|
+
loggingLevel: 'info',
|
|
13
|
+
},
|
|
7
14
|
display: {
|
|
8
15
|
panels: {
|
|
9
16
|
spectraPanel: { display: true },
|
|
@@ -31,6 +38,8 @@ exports.prediction = {
|
|
|
31
38
|
zoomOut: true,
|
|
32
39
|
zoom: true,
|
|
33
40
|
autoRangeAndZonePicking: true,
|
|
41
|
+
fftDimension1: true,
|
|
42
|
+
fftDimension2: true,
|
|
34
43
|
},
|
|
35
44
|
},
|
|
36
45
|
formatting: {
|
|
@@ -47,6 +47,8 @@ exports.workspaceDefaultProperties = {
|
|
|
47
47
|
zoom: false,
|
|
48
48
|
peakPicking: false,
|
|
49
49
|
autoRangeAndZonePicking: false,
|
|
50
|
+
fftDimension1: false,
|
|
51
|
+
fftDimension2: false,
|
|
50
52
|
},
|
|
51
53
|
},
|
|
52
54
|
general: {
|
|
@@ -92,21 +94,24 @@ exports.workspaceDefaultProperties = {
|
|
|
92
94
|
infoBlock: {
|
|
93
95
|
visible: false,
|
|
94
96
|
fields: [
|
|
95
|
-
{ label: 'name', jpath: ['
|
|
97
|
+
{ label: 'name', jpath: ['info', 'name'], visible: true, format: '' },
|
|
96
98
|
{
|
|
97
99
|
label: 'Number Of Scan',
|
|
98
100
|
jpath: ['info', 'numberOfScans'],
|
|
99
101
|
visible: true,
|
|
102
|
+
format: '0',
|
|
100
103
|
},
|
|
101
104
|
{
|
|
102
|
-
label: '
|
|
103
|
-
jpath: ['info', '
|
|
105
|
+
label: 'Pulse Sequence',
|
|
106
|
+
jpath: ['info', 'pulseSequence'],
|
|
104
107
|
visible: true,
|
|
108
|
+
format: '',
|
|
105
109
|
},
|
|
106
110
|
{
|
|
107
|
-
label: '
|
|
108
|
-
jpath: ['info', '
|
|
111
|
+
label: 'Frequency',
|
|
112
|
+
jpath: ['info', 'originFrequency'],
|
|
109
113
|
visible: true,
|
|
114
|
+
format: '0',
|
|
110
115
|
},
|
|
111
116
|
],
|
|
112
117
|
},
|
|
@@ -49,16 +49,16 @@ exports.FREQUENCIES = [
|
|
|
49
49
|
{ value: 1000, label: '1000 MHz' },
|
|
50
50
|
{ value: 1200, label: '1200 MHz' },
|
|
51
51
|
];
|
|
52
|
-
|
|
53
|
-
async function predictSpectra(molfile) {
|
|
52
|
+
async function predictSpectra(molfile, options) {
|
|
54
53
|
const molecule = full_1.default.Molecule.fromMolfile(molfile);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
54
|
+
const predictOptions = {};
|
|
55
|
+
for (const key in options) {
|
|
56
|
+
if (!options[key])
|
|
57
|
+
continue;
|
|
58
|
+
const experiment = key === 'proton' ? 'H' : key === 'carbon' ? 'C' : key;
|
|
59
|
+
predictOptions[experiment] = {};
|
|
60
|
+
}
|
|
61
|
+
return (0, nmr_processing_1.predict)(molecule, { predictOptions });
|
|
62
62
|
}
|
|
63
63
|
exports.predictSpectra = predictSpectra;
|
|
64
64
|
function generateName(name, options) {
|
|
@@ -8,7 +8,6 @@ const uuid_1 = require("@lukeed/uuid");
|
|
|
8
8
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
9
9
|
const nmr_processing_1 = require("nmr-processing");
|
|
10
10
|
const SignalsKinds_1 = require("../../../constants/SignalsKinds");
|
|
11
|
-
const SumManager_1 = require("../SumManager");
|
|
12
11
|
const detectSignal_1 = __importDefault(require("./detectSignal"));
|
|
13
12
|
function createRangeObj({ from, to, absolute, signal, }) {
|
|
14
13
|
return {
|
|
@@ -23,7 +22,7 @@ function createRangeObj({ from, to, absolute, signal, }) {
|
|
|
23
22
|
}
|
|
24
23
|
exports.createRangeObj = createRangeObj;
|
|
25
24
|
function addRange(spectrum, options) {
|
|
26
|
-
const { from, to
|
|
25
|
+
const { from, to } = options;
|
|
27
26
|
const { x, re } = spectrum.data;
|
|
28
27
|
const absolute = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from, to, reverse: true });
|
|
29
28
|
// detectSignal use the advance multiplet-analysis that can crash if too many points
|
|
@@ -43,12 +42,7 @@ function addRange(spectrum, options) {
|
|
|
43
42
|
}
|
|
44
43
|
try {
|
|
45
44
|
if (range) {
|
|
46
|
-
spectrum.ranges.options = (0, SumManager_1.initSumOptions)(spectrum.ranges.options, {
|
|
47
|
-
molecules,
|
|
48
|
-
nucleus,
|
|
49
|
-
});
|
|
50
45
|
spectrum.ranges.values = spectrum.ranges.values.concat((0, nmr_processing_1.mapRanges)([range], spectrum));
|
|
51
|
-
(0, nmr_processing_1.updateRangesRelativeValues)(spectrum);
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
48
|
catch (error) {
|
|
@@ -20,11 +20,18 @@ function initiateDatabase(databases, nucleus) {
|
|
|
20
20
|
const data = databases.filter((datum) => datum.nucleus === nucleus);
|
|
21
21
|
const moleculesDB = prepareMoleculesDB(data);
|
|
22
22
|
const getSolvents = () => prepareGetSolvents(data);
|
|
23
|
-
const search = (keywords =
|
|
24
|
-
|
|
25
|
-
return { searchByStructure, data, getSolvents, search };
|
|
23
|
+
const search = ({ idCode = '', keywords = '', }) => prepareSearch({ idCode, keywords, data, moleculesDB });
|
|
24
|
+
return { data, getSolvents, search };
|
|
26
25
|
}
|
|
27
26
|
exports.initiateDatabase = initiateDatabase;
|
|
27
|
+
function prepareSearch(options) {
|
|
28
|
+
const { data, keywords = [], moleculesDB, idCode } = options;
|
|
29
|
+
let searchData = data;
|
|
30
|
+
if (idCode) {
|
|
31
|
+
searchData = processSearchByStructure(moleculesDB, idCode);
|
|
32
|
+
}
|
|
33
|
+
return (0, smart_array_filter_1.filter)(searchData, { keywords });
|
|
34
|
+
}
|
|
28
35
|
function processSearchByStructure(moleculesDB, idCode) {
|
|
29
36
|
// default format { format: 'idCode' }
|
|
30
37
|
// https://github.com/cheminfo/openchemlib-utils/blob/ef3a9c30be7efe225a24de04ea9cefc9299674aa/src/db/MoleculesDB.js#L102-L115
|
|
@@ -10,8 +10,8 @@ const getAtomsFromMF_1 = __importDefault(require("../utilities/getAtomsFromMF"))
|
|
|
10
10
|
exports.DRAGGABLE_STRUCTURE_INITIAL_BOUNDING_REACT = {
|
|
11
11
|
x: 100,
|
|
12
12
|
y: 50,
|
|
13
|
-
width:
|
|
14
|
-
height:
|
|
13
|
+
width: 190,
|
|
14
|
+
height: 200,
|
|
15
15
|
};
|
|
16
16
|
function initMolecule(options = {}) {
|
|
17
17
|
const id = options.id || (0, uuid_1.v4)();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getLabelNumber = exports.extractLabelsNumbers = exports.extractNumber = exports.setMolfile = exports.addMolfile = exports.fromJSON = void 0;
|
|
3
|
+
exports.getMolecules = exports.getLabelNumber = exports.extractLabelsNumbers = exports.extractNumber = exports.setMolfile = exports.addMolfile = exports.fromJSON = void 0;
|
|
4
|
+
const filelist_utils_1 = require("filelist-utils");
|
|
5
|
+
const nmr_load_save_1 = require("nmr-load-save");
|
|
4
6
|
const full_1 = require("openchemlib/full");
|
|
5
7
|
const Molecule_1 = require("./Molecule");
|
|
6
8
|
function fromJSON(mols, reservedMolecules = []) {
|
|
@@ -89,3 +91,16 @@ function getLabelNumber(reserveNumbers) {
|
|
|
89
91
|
return 1;
|
|
90
92
|
}
|
|
91
93
|
exports.getLabelNumber = getLabelNumber;
|
|
94
|
+
async function getMolecules(text) {
|
|
95
|
+
let extension = 'smi';
|
|
96
|
+
if (/v[23]000/i.test(text)) {
|
|
97
|
+
extension = 'sdf';
|
|
98
|
+
}
|
|
99
|
+
const file = new File([text], `file.${extension}`, {
|
|
100
|
+
type: 'text/plain',
|
|
101
|
+
});
|
|
102
|
+
const collection = await (0, filelist_utils_1.fileCollectionFromFiles)([file]);
|
|
103
|
+
const { nmriumState: { data }, } = await (0, nmr_load_save_1.read)(collection);
|
|
104
|
+
return data?.molecules || [];
|
|
105
|
+
}
|
|
106
|
+
exports.getMolecules = getMolecules;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const modifiersKeys = [
|
|
4
|
+
'Alt',
|
|
5
|
+
'AltGraph',
|
|
6
|
+
'Control',
|
|
7
|
+
'Meta',
|
|
8
|
+
'Shift',
|
|
9
|
+
];
|
|
3
10
|
function checkModifierKeyActivated(event) {
|
|
4
|
-
|
|
5
|
-
'Alt',
|
|
6
|
-
'AltGraph',
|
|
7
|
-
'Control',
|
|
8
|
-
'Meta',
|
|
9
|
-
'Shift',
|
|
10
|
-
];
|
|
11
|
-
for (const key of modifiersKeys) {
|
|
12
|
-
if (event.getModifierState(key)) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
11
|
+
return modifiersKeys.some((key) => event.getModifierState(key));
|
|
17
12
|
}
|
|
18
13
|
exports.default = checkModifierKeyActivated;
|
package/lib-cjs/versionInfo.js
CHANGED