nmrium 0.40.1 → 0.42.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/FooterBanner.js +5 -4
- package/lib/component/1d/Viewer1D.js +121 -104
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
- package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
- package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
- package/lib/component/1d/tool/BaseLineZones.js +7 -4
- package/lib/component/1d/tool/PeakPointer.js +1 -1
- package/lib/component/1d/utilities/scale.js +1 -3
- package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib/component/2d/FooterBanner.js +3 -2
- package/lib/component/2d/Viewer2D.js +51 -29
- package/lib/component/2d/XAxis.js +1 -1
- package/lib/component/2d/YAxis.js +1 -1
- package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
- package/lib/component/2d/utilities/scale.d.ts +5 -5
- package/lib/component/2d/zones/Signal.js +1 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
- package/lib/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib/component/NMRium.d.ts +2 -2
- package/lib/component/NMRium.js +39 -26
- package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
- package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib/component/elements/Input.js +1 -0
- package/lib/component/elements/InputRange.js +1 -1
- package/lib/component/elements/MenuButton.d.ts +1 -1
- package/lib/component/elements/MoleculeSelection.d.ts +1 -1
- package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
- package/lib/component/elements/Scroller.d.ts +15 -0
- package/lib/component/elements/Scroller.js +31 -0
- package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
- package/lib/component/elements/ToolbarMenu.d.ts +1 -1
- package/lib/component/elements/accordion/Accordion.d.ts +1 -1
- package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
- package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
- package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib/component/elements/formik/SelectBox.d.ts +1 -1
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
- package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
- package/lib/component/elements/popup/Alert/Context.js +6 -2
- package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
- package/lib/component/elements/popup/Alert/Provider.js +3 -3
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
- package/lib/component/elements/popup/Modal/Provider.js +3 -1
- package/lib/component/elements/popup/options.d.ts +22 -19
- package/lib/component/elements/resizer/Resizer.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
- package/lib/component/elements/toggle/ToggleButton.js +1 -1
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib/component/highlight/index.d.ts +1 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib/component/hooks/useExport.js +2 -1
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
- package/lib/component/hooks/usePanelPreferences.js +2 -2
- package/lib/component/hooks/useSaveSettings.js +9 -11
- package/lib/component/hooks/useXScale.d.ts +1 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
- package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
- package/lib/component/modal/AlignSpectraModal.js +11 -1
- package/lib/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
- package/lib/component/modal/PredictSpectraModal.js +25 -28
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib/component/modal/editZone/SignalsForm.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib/component/modal/setting/settingsValidation.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib/component/panels/Panels.js +13 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +34 -27
- package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
- package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
- package/lib/component/reducer/Reducer.d.ts +13 -12
- package/lib/component/reducer/Reducer.js +253 -239
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
- package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
- package/lib/component/reducer/actions/DomainActions.js +30 -1
- package/lib/component/reducer/actions/FiltersActions.js +4 -4
- package/lib/component/reducer/actions/LoadActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +8 -2
- package/lib/component/reducer/actions/MoleculeActions.js +58 -3
- package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
- package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
- package/lib/component/reducer/actions/ToolsActions.js +2 -2
- package/lib/component/reducer/actions/ZonesActions.js +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
- package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib/component/toolbar/ToolTypes.d.ts +4 -4
- package/lib/component/utility/PathBuilder.js +11 -0
- package/lib/component/utility/export.js +9 -9
- package/lib/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib/component/utility/getUniqueNuclei.js +1 -1
- package/lib/component/utility/jpathToArray.js +1 -1
- package/lib/component/workspaces/index.d.ts +1 -0
- package/lib/component/workspaces/index.js +2 -0
- package/lib/component/workspaces/simulation.d.ts +2 -0
- package/lib/component/workspaces/simulation.js +68 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js +9 -5
- package/lib/data/PredictionManager.d.ts +8 -7
- package/lib/data/PredictionManager.js +95 -22
- package/lib/data/SpectraManager.js +1 -1
- package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
- package/lib/data/constants/SignalsKinds.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib/data/data1d/database.d.ts +9 -7
- package/lib/data/data1d/database.js +13 -6
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
- package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
- package/lib/data/data1d/spectrumSimulation.js +53 -0
- package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
- package/lib/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +2 -1
- package/lib/data/molecules/MoleculeManager.js +21 -7
- package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
- package/lib/data/utilities/FindUtilities.js +4 -4
- package/lib/data/utilities/RangeUtilities.d.ts +1 -1
- package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
- package/lib/data/utilities/calculateSanPlot.js +3 -3
- package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib/utils/clipboard/clipboard.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +5 -4
- package/lib-cjs/component/1d/Viewer1D.js +120 -103
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
- package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
- package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
- package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
- package/lib-cjs/component/1d/utilities/scale.js +1 -3
- package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
- package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
- package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -2
- package/lib-cjs/component/2d/Viewer2D.js +50 -28
- package/lib-cjs/component/2d/XAxis.js +1 -1
- package/lib-cjs/component/2d/YAxis.js +1 -1
- package/lib-cjs/component/2d/zones/Signal.js +1 -2
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
- package/lib-cjs/component/NMRium.js +37 -24
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
- package/lib-cjs/component/elements/Input.js +1 -0
- package/lib-cjs/component/elements/InputRange.js +1 -1
- package/lib-cjs/component/elements/Scroller.js +35 -0
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
- package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
- package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
- package/lib-cjs/component/hooks/useExport.js +2 -1
- package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
- package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
- package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
- package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
- package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
- package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
- package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib-cjs/component/panels/Panels.js +13 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +34 -27
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
- package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
- package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
- package/lib-cjs/component/reducer/Reducer.js +253 -239
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
- package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
- package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
- package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +62 -3
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
- package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
- package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
- package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
- package/lib-cjs/component/utility/PathBuilder.js +11 -0
- package/lib-cjs/component/utility/export.js +9 -9
- package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
- package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
- package/lib-cjs/component/utility/jpathToArray.js +1 -1
- package/lib-cjs/component/workspaces/index.js +2 -0
- package/lib-cjs/component/workspaces/simulation.js +71 -0
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +9 -5
- package/lib-cjs/data/PredictionManager.js +96 -22
- package/lib-cjs/data/SpectraManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
- package/lib-cjs/data/data1d/database.js +13 -6
- package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
- package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
- package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
- package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
- package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
- package/lib-cjs/data/matrixGeneration.js +1 -1
- package/lib-cjs/data/molecules/MoleculeManager.js +23 -8
- package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
- package/lib-cjs/data/utilities/FindUtilities.js +4 -4
- package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Integral } from 'nmr-processing';
|
|
3
3
|
import { IntegralPanelInnerProps } from './IntegralPanel';
|
|
4
4
|
interface IntegralTableProps extends Pick<IntegralPanelInnerProps, 'activeTab'> {
|
|
5
|
-
data:
|
|
5
|
+
data: Integral[];
|
|
6
6
|
}
|
|
7
7
|
declare function IntegralTable({ activeTab, data }: IntegralTableProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
declare const _default: import("react").MemoExoticComponent<typeof IntegralTable>;
|
|
@@ -84,12 +84,9 @@ function IntegralTable({ activeTab, data }) {
|
|
|
84
84
|
},
|
|
85
85
|
accessor: 'integral',
|
|
86
86
|
Cell: ({ row }) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const flag = checkIntegralKind(row.original);
|
|
91
|
-
integral = flag ? value : `[ ${value} ]`;
|
|
92
|
-
}
|
|
87
|
+
const value = formatNumber(row.original.integral || 0, integralsPreferences.relative.format);
|
|
88
|
+
const flag = checkIntegralKind(row.original);
|
|
89
|
+
const integral = flag ? value : `[ ${value} ]`;
|
|
93
90
|
return (_jsx(EditableColumn, { value: integral, onSave: (event) => saveRelativeHandler(event, row.original), type: "number" }));
|
|
94
91
|
},
|
|
95
92
|
},
|
|
@@ -109,7 +106,7 @@ function IntegralTable({ activeTab, data }) {
|
|
|
109
106
|
saveRelativeHandler,
|
|
110
107
|
]);
|
|
111
108
|
const tableColumns = useMemo(() => {
|
|
112
|
-
|
|
109
|
+
const columns = [...initialColumns];
|
|
113
110
|
for (const col of COLUMNS) {
|
|
114
111
|
const { showWhen, ...colParams } = col;
|
|
115
112
|
if (lodashGet(integralsPreferences, showWhen)) {
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { MoleculesView, StateMoleculeExtended } from '../../../data/molecules/Molecule';
|
|
3
3
|
interface MoleculePanelHeaderProps {
|
|
4
4
|
currentIndex: number;
|
|
5
|
-
molecules:
|
|
5
|
+
molecules: StateMoleculeExtended[];
|
|
6
6
|
moleculesView: MoleculesView;
|
|
7
7
|
onMoleculeIndexChange?: (index: number) => void;
|
|
8
8
|
onOpenMoleculeEditor: () => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SvgNmrFt } from 'cheminfo-font';
|
|
3
2
|
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
4
3
|
import { useCallback } from 'react';
|
|
5
4
|
import { FaCog, FaCopy, FaDownload, FaFileExport, FaFileImage, FaPaste, FaPlus, FaRegTrashAlt, } from 'react-icons/fa';
|
|
6
5
|
import { IoOpenOutline } from 'react-icons/io5';
|
|
7
6
|
import { DropdownMenu } from 'react-science/ui';
|
|
7
|
+
import { getMolecules } from '../../../data/molecules/MoleculeManager';
|
|
8
8
|
import { ClipboardFallbackModal } from '../../../utils/clipboard/clipboardComponents';
|
|
9
9
|
import { useClipboard } from '../../../utils/clipboard/clipboardHooks';
|
|
10
10
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
@@ -14,7 +14,7 @@ import ActiveButton from '../../elements/ActiveButton';
|
|
|
14
14
|
import Button from '../../elements/Button';
|
|
15
15
|
import { useAlert } from '../../elements/popup/Alert';
|
|
16
16
|
import AboutPredictionModal from '../../modal/AboutPredictionModal';
|
|
17
|
-
import
|
|
17
|
+
import PredictSpectraModal from '../../modal/PredictSpectraModal';
|
|
18
18
|
import { copyPNGToClipboard, exportAsSVG } from '../../utility/export';
|
|
19
19
|
import PanelHeader from '../header/PanelHeader';
|
|
20
20
|
const styles = {
|
|
@@ -77,7 +77,6 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
77
77
|
const dispatch = useDispatch();
|
|
78
78
|
const assignmentData = useAssignmentData();
|
|
79
79
|
const moleculeKey = molecules?.[currentIndex]?.id;
|
|
80
|
-
const openPredictSpectraModal = usePredictSpectraModal();
|
|
81
80
|
const saveAsSVGHandler = useCallback(() => {
|
|
82
81
|
if (!rootRef)
|
|
83
82
|
return;
|
|
@@ -126,10 +125,11 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
126
125
|
function handlePasteMolfileAction() {
|
|
127
126
|
void readText().then(handlePasteMolfile);
|
|
128
127
|
}
|
|
129
|
-
function handlePasteMolfile(molfile) {
|
|
128
|
+
async function handlePasteMolfile(molfile) {
|
|
130
129
|
if (!molfile)
|
|
131
130
|
return;
|
|
132
|
-
|
|
131
|
+
const molecules = await getMolecules(molfile);
|
|
132
|
+
dispatch({ type: 'ADD_MOLECULES', payload: { molecules } });
|
|
133
133
|
cleanShouldFallback();
|
|
134
134
|
}
|
|
135
135
|
const handleDelete = useCallback(() => {
|
|
@@ -160,7 +160,7 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
const hasMolecules = molecules && molecules.length > 0;
|
|
163
|
-
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(
|
|
163
|
+
return (_jsxs(PanelHeader, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsx(DropdownMenu, { trigger: "click", options: MOL_EXPORT_MENU, onSelect: exportHandler, children: _jsx(Button.BarButton, { as: "div", disabled: !hasMolecules, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Export As", tooltipOrientation: "horizontal", children: _jsx(FaFileExport, {}) }) })), _jsx(Button.BarButton, { onClick: handlePasteMolfileAction, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Paste molfile", tooltipOrientation: "horizontal", children: _jsx(FaPaste, {}) }), _jsx(Button.BarButton, { onClick: onOpenMoleculeEditor, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Add molecule", tooltipOrientation: "horizontal", children: _jsx(FaPlus, {}) }), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Button.BarButton, { onClick: handleDelete, color: { base: '#4e4e4e', hover: '#4e4e4e' }, toolTip: "Delete molecule", tooltipOrientation: "horizontal", disabled: !hasMolecules, children: _jsx(FaRegTrashAlt, {}) }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(ActiveButton, { value: moleculesView?.[moleculeKey]?.floating.visible || false, popupTitle: "Float molecule", popupPlacement: "left", onClick: floatMoleculeHandler, disabled: !hasMolecules, children: _jsx(IoOpenOutline, {}) }), _jsx(ActiveButton, { style: { marginLeft: '2px' }, value: moleculesView?.[moleculeKey]?.showAtomNumber || false, popupTitle: "Show atom number", popupPlacement: "left", onClick: showAtomNumbersHandler, disabled: !hasMolecules, children: _jsx("p", { style: styles.atomLabel, children: "#" }) }), _jsx("div", { style: { flex: 1 }, children: children }), _jsxs("p", { style: styles.counter, children: [molecules &&
|
|
164
164
|
molecules.length > 0 &&
|
|
165
165
|
`${+(currentIndex + 1)} / ${molecules.length}`, ' '] }), onClickPreferences && (_jsx(Button.BarButton, { color: { base: 'black', hover: 'black' }, onClick: onClickPreferences, toolTip: "Preferences", tooltipOrientation: "vertical", children: _jsx(FaCog, {}) })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
|
|
166
166
|
}
|
|
@@ -23,7 +23,7 @@ export interface AtomData {
|
|
|
23
23
|
*
|
|
24
24
|
*/
|
|
25
25
|
export declare function extractFromAtom(atom: Atom, activeTab: string, axis?: Axis | null): AtomData;
|
|
26
|
-
export declare function findDatumAndSignalIndex(data:
|
|
26
|
+
export declare function findDatumAndSignalIndex(data: Array<Range | Zone>, id: string): {
|
|
27
27
|
datum: Range | Zone | undefined;
|
|
28
28
|
signalIndex: any;
|
|
29
29
|
};
|
|
@@ -41,12 +41,10 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
|
|
|
41
41
|
}, [onAtomHoverAction, onAtomHoverHighlights, highlightData]);
|
|
42
42
|
const data = useMemo(() => {
|
|
43
43
|
if (zones || ranges) {
|
|
44
|
-
if (displayerMode === DISPLAYER_MODE.DM_1D && ranges
|
|
44
|
+
if (displayerMode === DISPLAYER_MODE.DM_1D && ranges?.values) {
|
|
45
45
|
return ranges.values;
|
|
46
46
|
}
|
|
47
|
-
else if (displayerMode === DISPLAYER_MODE.DM_2D &&
|
|
48
|
-
zones &&
|
|
49
|
-
zones.values) {
|
|
47
|
+
else if (displayerMode === DISPLAYER_MODE.DM_2D && zones?.values) {
|
|
50
48
|
return zones.values;
|
|
51
49
|
}
|
|
52
50
|
}
|
|
@@ -58,7 +56,7 @@ export default function useAtomAssignment({ displayerMode, activeTab: nucleus, z
|
|
|
58
56
|
y: [],
|
|
59
57
|
};
|
|
60
58
|
const assignment = assignments.data.assignments;
|
|
61
|
-
for (
|
|
59
|
+
for (const id in assignment) {
|
|
62
60
|
if (assignment[id].x) {
|
|
63
61
|
assignedDiaID.x.push(...assignment[id].x);
|
|
64
62
|
}
|
|
@@ -20,6 +20,7 @@ import ZonesPanel from './ZonesPanel/ZonesPanel';
|
|
|
20
20
|
import DatabasePanel from './databasePanel/DatabasePanel';
|
|
21
21
|
import FilterPanel from './filtersPanel/FilterPanel';
|
|
22
22
|
import PredictionPane from './predictionPanel/PredictionPanel';
|
|
23
|
+
import SpectrumSimulation from './spectrumSimulation/SpectrumSimulation';
|
|
23
24
|
const accordionItems = [
|
|
24
25
|
{
|
|
25
26
|
title: 'Spectra',
|
|
@@ -106,6 +107,12 @@ const accordionItems = [
|
|
|
106
107
|
hidePreferenceKey: 'predictionPanel',
|
|
107
108
|
mode: null,
|
|
108
109
|
},
|
|
110
|
+
{
|
|
111
|
+
title: 'Spectrum Simulation',
|
|
112
|
+
component: _jsx(SpectrumSimulation, {}),
|
|
113
|
+
hidePreferenceKey: 'simulationPanel',
|
|
114
|
+
mode: DISPLAYER_MODE.DM_1D,
|
|
115
|
+
},
|
|
109
116
|
];
|
|
110
117
|
export const TOOLS_PANELS_ACCORDION = {
|
|
111
118
|
null: 'Spectra',
|
|
@@ -122,6 +129,12 @@ function usePanelPreferences() {
|
|
|
122
129
|
display: false,
|
|
123
130
|
open: false,
|
|
124
131
|
};
|
|
132
|
+
if (item?.isExperimental && !item.hidePreferenceKey) {
|
|
133
|
+
return {
|
|
134
|
+
display: true,
|
|
135
|
+
open: false,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
125
138
|
return lodashGet(preferences.current, `display.panels.${item.hidePreferenceKey}`, defaultValue);
|
|
126
139
|
}, [preferences]);
|
|
127
140
|
}
|
|
@@ -126,7 +126,7 @@ function PeaksTable({ activeTab, data }) {
|
|
|
126
126
|
},
|
|
127
127
|
], [deletePeakHandler, editPeakHandler]);
|
|
128
128
|
const tableColumns = useMemo(() => {
|
|
129
|
-
|
|
129
|
+
const columns = [...initialColumns];
|
|
130
130
|
for (const col of COLUMNS) {
|
|
131
131
|
const { showWhen, ...colParams } = col;
|
|
132
132
|
if (lodashGet(peaksPreferences, showWhen)) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Formik } from 'formik';
|
|
3
3
|
import { useImperativeHandle, useRef, memo, forwardRef, useCallback, useMemo, } from 'react';
|
|
4
4
|
import { useChartData } from '../../context/ChartContext';
|
|
5
5
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
6
|
+
import { Scroller } from '../../elements/Scroller';
|
|
6
7
|
import useNucleus from '../../hooks/useNucleus';
|
|
7
8
|
import { usePanelPreferencesByNuclei } from '../../hooks/usePanelPreferences';
|
|
8
9
|
import { convertPathArrayToString } from '../../utility/convertPathArrayToString';
|
|
@@ -12,7 +13,7 @@ import { PreferencesContainer } from '../extra/preferences/PreferencesContainer'
|
|
|
12
13
|
import { SpectraColumnsManager } from './base/SpectraColumnsManager';
|
|
13
14
|
function SpectraPreferences(props, ref) {
|
|
14
15
|
const formRef = useRef(null);
|
|
15
|
-
const { data } = useChartData();
|
|
16
|
+
const { data, view: { spectra: { activeTab }, }, } = useChartData();
|
|
16
17
|
const preferences = usePreferences();
|
|
17
18
|
const nuclei = useNucleus();
|
|
18
19
|
const preferencesByNuclei = usePanelPreferencesByNuclei('spectra', nuclei);
|
|
@@ -67,6 +68,6 @@ function SpectraPreferences(props, ref) {
|
|
|
67
68
|
}, []);
|
|
68
69
|
const mapOnChangeValueHandler = useCallback((key) => paths[key], [paths]);
|
|
69
70
|
const mapValue = useCallback((value) => convertPathArrayToString(value), []);
|
|
70
|
-
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: _jsx(
|
|
71
|
+
return (_jsx(PreferencesContainer, { children: _jsx(Formik, { innerRef: formRef, onSubmit: saveHandler, initialValues: preferencesByNuclei, children: _jsx(Scroller, { scrollTo: activeTab, children: nuclei?.map((n) => (_jsx(Scroller.Item, { elementKey: n, children: _jsx(NucleusGroup, { nucleus: n, children: _jsx(SpectraColumnsManager, { nucleus: n, onAdd: handleAdd, onDelete: handleDelete, mapOnChangeValue: mapOnChangeValueHandler, mapValue: mapValue, datalist: datalist }) }) }, n))) }) }) }));
|
|
71
72
|
}
|
|
72
73
|
export default memo(forwardRef(SpectraPreferences));
|
|
@@ -162,7 +162,7 @@ export function SpectraTable(props) {
|
|
|
162
162
|
return activeSpectraObj?.[row?.original.id] || false;
|
|
163
163
|
}
|
|
164
164
|
const tableColumns = useMemo(() => {
|
|
165
|
-
|
|
165
|
+
const columns = [];
|
|
166
166
|
let index = 0;
|
|
167
167
|
const visibleColumns = spectraPreferences.columns.filter((col) => col.visible);
|
|
168
168
|
for (const col of visibleColumns) {
|
|
@@ -19,7 +19,9 @@ const style = css `
|
|
|
19
19
|
flex-direction: row-reverse;
|
|
20
20
|
border-radius: 4px;
|
|
21
21
|
background-color: white;
|
|
22
|
-
box-shadow:
|
|
22
|
+
box-shadow:
|
|
23
|
+
rgb(0 0 0 / 15%) 0 0 0 1px,
|
|
24
|
+
rgb(0 0 0 / 15%) 0 8px 16px;
|
|
23
25
|
overflow: auto;
|
|
24
26
|
height: 350px;
|
|
25
27
|
}
|
|
@@ -4,9 +4,9 @@ export function processSnapPlot(dimension, data, yLogBase) {
|
|
|
4
4
|
const sanResult = calculateSanPlot(dimension, data);
|
|
5
5
|
const sanPlot = {};
|
|
6
6
|
const lines = {};
|
|
7
|
-
for (
|
|
7
|
+
for (const plotKey in sanResult.sanplot) {
|
|
8
8
|
const { x, y } = xyReduce(sanResult.sanplot[plotKey]);
|
|
9
|
-
|
|
9
|
+
const result = new Array(x.length);
|
|
10
10
|
for (let i = 0; i < x.length; i++) {
|
|
11
11
|
result[i] = { x: x[i], y: y[i] };
|
|
12
12
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Correlation, Link } from 'nmr-correlation';
|
|
2
2
|
import { Spectrum2D, Spectrum } from 'nmr-load-save';
|
|
3
3
|
import { ActiveSpectrum } from '../../../reducer/Reducer';
|
|
4
|
+
import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
|
|
4
5
|
declare function getAtomType(nucleus: string): string;
|
|
5
6
|
declare function getLabelColor(correlationData: any, correlation: any): string | null;
|
|
6
7
|
declare function findSignalMatch1D(spectrum: Spectrum2D, link: Link, factor: number, xDomain0: number, xDomain1: number): boolean;
|
|
@@ -24,5 +25,5 @@ declare function getEditedCorrelations({ correlationDim1, correlationDim2, selec
|
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
27
|
declare function convertValuesString(valuesString: string, key: 'protonsCount' | 'hybridization'): number[];
|
|
27
|
-
declare function isInView(spectraData: Spectrum[], activeTab: string, activeSpectrum: ActiveSpectrum | null, xDomain: number[], yDomain: number[], displayerMode:
|
|
28
|
+
declare function isInView(spectraData: Spectrum[], activeTab: string, activeSpectrum: ActiveSpectrum | null, xDomain: number[], yDomain: number[], displayerMode: DISPLAYER_MODE, correlation: Correlation): boolean;
|
|
28
29
|
export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, convertValuesString, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, isInView, };
|
|
@@ -12,7 +12,7 @@ function getAtomType(nucleus) {
|
|
|
12
12
|
function getLabelColor(correlationData, correlation) {
|
|
13
13
|
const error = lodashGet(correlationData, `state.${correlation.atomType}.error`, null);
|
|
14
14
|
if (error) {
|
|
15
|
-
for (
|
|
15
|
+
for (const { key, color } of ErrorColors) {
|
|
16
16
|
if (key !== 'incomplete' && // do not consider this for a single atom type
|
|
17
17
|
(key === 'notAttached' || key === 'ambiguousAttachment') &&
|
|
18
18
|
lodashGet(error, `${key}`, []).some((index) => correlationData.values[index].id === correlation.id)) {
|
|
@@ -3,7 +3,7 @@ import { LocalDatabase } from '../../../data/data1d/database';
|
|
|
3
3
|
export interface DatabaseInnerProps {
|
|
4
4
|
nucleus: string;
|
|
5
5
|
selectedTool: string;
|
|
6
|
-
databases:
|
|
6
|
+
databases: Array<LocalDatabase | Database>;
|
|
7
7
|
defaultDatabase: string;
|
|
8
8
|
}
|
|
9
9
|
export default function PeaksPanel(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -40,6 +40,13 @@ const emptyKeywords = {
|
|
|
40
40
|
solvent: '-1',
|
|
41
41
|
searchKeywords: '',
|
|
42
42
|
};
|
|
43
|
+
function mapKeywordsToArray(searchKeywords, solvent) {
|
|
44
|
+
const values = searchKeywords ? searchKeywords.split(' ') : [];
|
|
45
|
+
if (solvent !== '-1') {
|
|
46
|
+
values.unshift(`solvent:${solvent}`);
|
|
47
|
+
}
|
|
48
|
+
return values;
|
|
49
|
+
}
|
|
43
50
|
function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase, }) {
|
|
44
51
|
const dispatch = useDispatch();
|
|
45
52
|
const alert = useAlert();
|
|
@@ -77,28 +84,34 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
77
84
|
}));
|
|
78
85
|
}
|
|
79
86
|
}, []);
|
|
87
|
+
const search = useCallback((solvents) => {
|
|
88
|
+
const { solvent, searchKeywords } = keywords;
|
|
89
|
+
if (databaseInstance.current) {
|
|
90
|
+
const keywords = mapKeywordsToArray(searchKeywords, solvent);
|
|
91
|
+
const data = databaseInstance.current.search({ keywords, idCode });
|
|
92
|
+
setResult((prevResult) => ({
|
|
93
|
+
...prevResult,
|
|
94
|
+
data,
|
|
95
|
+
...(solvents && { solvents }),
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
}, [idCode, keywords]);
|
|
80
99
|
useEffect(() => {
|
|
81
100
|
const { solvent, searchKeywords } = keywords;
|
|
82
101
|
setTimeout(async () => {
|
|
83
102
|
if (databaseInstance.current) {
|
|
84
103
|
const hideLoading = await alert.showLoading(`Preparing of the Result`);
|
|
85
104
|
if (solvent === '-1' && !searchKeywords) {
|
|
86
|
-
const data = databaseInstance.current.data;
|
|
87
105
|
const solvents = mapSolventsToSelect(databaseInstance.current.getSolvents());
|
|
88
|
-
|
|
106
|
+
search(solvents);
|
|
89
107
|
}
|
|
90
108
|
else {
|
|
91
|
-
|
|
92
|
-
if (solvent !== '-1') {
|
|
93
|
-
values.unshift(`solvent:${solvent}`);
|
|
94
|
-
}
|
|
95
|
-
const data = databaseInstance.current.search(values.join(' '));
|
|
96
|
-
setResult((prevResult) => ({ ...prevResult, data }));
|
|
109
|
+
search();
|
|
97
110
|
}
|
|
98
111
|
hideLoading();
|
|
99
112
|
}
|
|
100
113
|
}, 0);
|
|
101
|
-
}, [alert, keywords]);
|
|
114
|
+
}, [alert, idCode, keywords, search]);
|
|
102
115
|
useEffect(() => {
|
|
103
116
|
function handle(event) {
|
|
104
117
|
if (selectedTool === options.databaseRangesSelection.id) {
|
|
@@ -120,6 +133,16 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
120
133
|
Events.off('brushEnd', handle);
|
|
121
134
|
};
|
|
122
135
|
}, [format, selectedTool]);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setTimeout(async () => {
|
|
138
|
+
if (databaseInstance.current) {
|
|
139
|
+
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
140
|
+
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
141
|
+
hideLoading();
|
|
142
|
+
setKeywords({ ...emptyKeywords });
|
|
143
|
+
}
|
|
144
|
+
}, 0);
|
|
145
|
+
}, [alert, nucleus]);
|
|
123
146
|
const handleChangeDatabase = useCallback((databaseKey) => {
|
|
124
147
|
const database = databases.find((item) => item.key === databaseKey);
|
|
125
148
|
setTimeout(async () => {
|
|
@@ -151,16 +174,6 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
151
174
|
hideLoading();
|
|
152
175
|
}, 0);
|
|
153
176
|
}, [alert, databases, nucleus]);
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
setTimeout(async () => {
|
|
156
|
-
if (databaseInstance.current) {
|
|
157
|
-
const hideLoading = await alert.showLoading(`Loading the database`);
|
|
158
|
-
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
159
|
-
hideLoading();
|
|
160
|
-
setKeywords({ ...emptyKeywords });
|
|
161
|
-
}
|
|
162
|
-
}, 0);
|
|
163
|
-
}, [alert, nucleus]);
|
|
164
177
|
useEffect(() => {
|
|
165
178
|
if (item?.isOpen && defaultDatabase && !databaseInstance.current) {
|
|
166
179
|
handleChangeDatabase(defaultDatabase);
|
|
@@ -170,7 +183,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
170
183
|
return prepareData(result.data);
|
|
171
184
|
}, [result.data]);
|
|
172
185
|
const resurrectHandler = useCallback((rowData) => {
|
|
173
|
-
|
|
186
|
+
const { index, baseURL, jcampURL: jcampRelativeURL } = rowData;
|
|
174
187
|
const { ranges, solvent, names = [] } = result.data[index];
|
|
175
188
|
if (jcampRelativeURL) {
|
|
176
189
|
const url = new URL(jcampRelativeURL, baseURL);
|
|
@@ -231,13 +244,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
231
244
|
handleChangeOption(tool);
|
|
232
245
|
}, [handleChangeOption]);
|
|
233
246
|
const searchByStructureHandler = (idCodeValue) => {
|
|
234
|
-
|
|
235
|
-
const hideLoading = await alert.showLoading(`Searching in progress...`);
|
|
236
|
-
const data = databaseInstance.current?.searchByStructure(idCodeValue) || [];
|
|
237
|
-
setResult((prevResult) => ({ ...prevResult, data }));
|
|
238
|
-
setIdCode(idCodeValue);
|
|
239
|
-
hideLoading();
|
|
240
|
-
}, 0);
|
|
247
|
+
setIdCode(idCodeValue);
|
|
241
248
|
};
|
|
242
249
|
const openSearchByStructure = () => {
|
|
243
250
|
modal.show(_jsx(DatabaseStructureSearchModal, { onChange: searchByStructureHandler, idCode: idCode }), {
|
|
@@ -142,7 +142,7 @@ function DatabaseTable({ data, onAdd, onSave, totalCount, }) {
|
|
|
142
142
|
},
|
|
143
143
|
], [databasePreferences?.allowSaveAsNMRium, onAdd, onSave]);
|
|
144
144
|
const tableColumns = useMemo(() => {
|
|
145
|
-
|
|
145
|
+
const columns = [...initialColumns];
|
|
146
146
|
for (const col of databaseTableColumns(databasePreferences)) {
|
|
147
147
|
const { showWhen, ...colParams } = col;
|
|
148
148
|
if (lodashGet(databasePreferences, showWhen, false)) {
|
|
@@ -13,14 +13,14 @@ function hasCouplingConstant(multiplet) {
|
|
|
13
13
|
function getPascal(n, spin) {
|
|
14
14
|
if (n === undefined || n === 0 || spin === undefined)
|
|
15
15
|
return [1];
|
|
16
|
-
|
|
16
|
+
const mult = 2 * spin + 1;
|
|
17
17
|
let previousLine = [];
|
|
18
18
|
for (let j = 0; j < mult - 1; j++)
|
|
19
19
|
previousLine.push(1);
|
|
20
20
|
// complete with "1 1" or "1 1 1" for spin 1/2 and 1 respectively
|
|
21
21
|
for (let i = 0; i < n - 1; i++) {
|
|
22
22
|
// copy the line
|
|
23
|
-
|
|
23
|
+
const _line = previousLine.slice();
|
|
24
24
|
for (let j = 1; j < mult; j++) {
|
|
25
25
|
for (let k = 0; k < previousLine.length - 1; k++) {
|
|
26
26
|
_line[k + j] += previousLine[k];
|
|
@@ -8,7 +8,7 @@ function useToggleStatus(key, data) {
|
|
|
8
8
|
const [status, setStatus] = useState({});
|
|
9
9
|
const oldIdRef = useRef();
|
|
10
10
|
useEffect(() => {
|
|
11
|
-
|
|
11
|
+
const statusflags = {};
|
|
12
12
|
if (data && Array.isArray(data)) {
|
|
13
13
|
for (const item of data) {
|
|
14
14
|
statusflags[item[key]] = false;
|
|
@@ -2,10 +2,10 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo, useCallback, memo, useRef } from 'react';
|
|
3
3
|
import { FaRegTrashAlt } from 'react-icons/fa';
|
|
4
4
|
import { ObjectInspector } from 'react-inspector';
|
|
5
|
+
import { Checkbox } from 'react-science/ui';
|
|
5
6
|
import { useChartData } from '../../context/ChartContext';
|
|
6
7
|
import { useDispatch } from '../../context/DispatchContext';
|
|
7
8
|
import Button from '../../elements/Button';
|
|
8
|
-
import CheckBox from '../../elements/CheckBox';
|
|
9
9
|
import { ColumnWrapper } from '../../elements/ColumnWrapper';
|
|
10
10
|
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
11
11
|
import { useAlert } from '../../elements/popup/Alert';
|
|
@@ -109,7 +109,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
|
109
109
|
style: { width: '30px' },
|
|
110
110
|
Cell: ({ row }) => {
|
|
111
111
|
const { flag, id } = row.original;
|
|
112
|
-
return (_jsx(ColumnWrapper, { children: _jsx(
|
|
112
|
+
return (_jsx(ColumnWrapper, { children: _jsx(Checkbox, { onChange: (checked) => handelFilterCheck(id, checked), checked: flag }) }));
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
{
|
|
@@ -18,6 +18,7 @@ const NUMBER_OF_POINTS_2D = generateNumbersPowerOfX(10, 10, {
|
|
|
18
18
|
const predictionFormValidation = Yup.object().shape({
|
|
19
19
|
name: Yup.string().label('Name'),
|
|
20
20
|
frequency: Yup.number().integer().required().label('Frequency'),
|
|
21
|
+
autoExtendRange: Yup.boolean(),
|
|
21
22
|
'1d': Yup.object({
|
|
22
23
|
'1H': Yup.object({
|
|
23
24
|
from: Yup.number().required().label("1H ' From ' "),
|
|
@@ -78,7 +79,7 @@ function PredictionOptionsPanel(props, ref) {
|
|
|
78
79
|
const { options, onSubmit, hideName = false } = props;
|
|
79
80
|
return (_jsx(Formik, { initialValues: options, validationSchema: predictionFormValidation, enableReinitialize: true, onSubmit: onSubmit, innerRef: ref, children: _jsxs(_Fragment, { children: [_jsx(FormikErrorsSummary, {}), !hideName && (_jsx(Label, { title: "Name", style: labelStyle, children: _jsx(FormikInput, { name: "name", style: inputStyle }) })), _jsx(Label, { title: "Frequency", style: labelStyle, children: _jsx(FormikSelect, { items: FREQUENCIES, style: styles.select, name: "frequency" }) }), _jsxs(GroupPane, { text: "1D Options", style: {
|
|
80
81
|
header: styles.groupHeader,
|
|
81
|
-
}, children: [_jsxs(Label, { title: "1H", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "13C", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: inputStyle }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), _jsx(Label, { title: "Number of Points", style: labelStyle, children: _jsx(FormikSelect, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), _jsx(GroupPane, { text: "2D Options", style: {
|
|
82
|
+
}, children: [_jsx(Label, { title: "Auto extend range", style: labelStyle, children: _jsx(FormikCheckBox, { name: "autoExtendRange" }) }), _jsxs(Label, { title: "1H", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.1H.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "13C", renderTitle: (title) => (_jsx(IsotopesViewer, { value: title, className: "custom-label" })), style: labelStyle, children: [_jsx(Label, { title: "From", children: _jsx(FormikInput, { name: "1d.13C.from", type: "number", style: inputStyle }) }), _jsx(Label, { title: "To", style: { label: { padding: '0 10px' } }, children: _jsx(FormikInput, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), _jsxs(Label, { title: "Line Width", style: labelStyle, children: [_jsx(FormikInput, { name: "1d.lineWidth", type: "number", style: inputStyle }), _jsx("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), _jsx(Label, { title: "Number of Points", style: labelStyle, children: _jsx(FormikSelect, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), _jsx(GroupPane, { text: "2D Options", style: {
|
|
82
83
|
header: styles.groupHeader,
|
|
83
84
|
}, children: _jsxs(Label, { title: "Number of Points", style: labelStyle, children: [_jsx(FormikSelect, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), _jsx("span", { style: { padding: '0 10px' }, children: " X " }), _jsx(FormikSelect, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }) }), _jsx(GroupPane, { text: "Spectra", style: {
|
|
84
85
|
header: styles.groupHeader,
|
|
@@ -72,10 +72,11 @@ export default function PredictionPanel() {
|
|
|
72
72
|
}
|
|
73
73
|
const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
|
|
74
74
|
try {
|
|
75
|
-
const data = await predictSpectra(molfile
|
|
75
|
+
const data = await predictSpectra(molfile);
|
|
76
76
|
dispatch({
|
|
77
77
|
type: 'PREDICT_SPECTRA',
|
|
78
78
|
payload: {
|
|
79
|
+
logger,
|
|
79
80
|
predictedSpectra: data.spectra,
|
|
80
81
|
options: predictionPreferences,
|
|
81
82
|
molecule: { ...molecules[currentIndex], molfile },
|
|
@@ -118,6 +119,6 @@ export default function PredictionPanel() {
|
|
|
118
119
|
}, children: molecules && molecules.length > 0 ? (molecules.map((mol, molIndex) => (_jsxs("div", { style: styles.flexColumnContainer, children: [_jsx(MoleculeHeader, { currentMolecule: mol, molecules: molecules }), _jsx("div", { style: {
|
|
119
120
|
...styles.slider,
|
|
120
121
|
height: height - 31,
|
|
121
|
-
}, children: molIndex === currentIndex && (_jsx(StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : (_jsx(StructureEditor, { width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
|
|
122
|
+
}, children: molIndex === currentIndex && (_jsx(StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : (_jsx(StructureEditor, { initialMolfile: molfile || '', width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
|
|
122
123
|
} }) }), _jsxs("div", { style: { display: 'flex', padding: '5px' }, children: [_jsx(Button.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && (_jsx(Button.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] }))] }));
|
|
123
124
|
}
|
|
@@ -3,7 +3,7 @@ import { Formik } from 'formik';
|
|
|
3
3
|
import lodashMerge from 'lodash/merge';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
5
|
import * as Yup from 'yup';
|
|
6
|
-
import {
|
|
6
|
+
import { getDefaultPredictionOptions, FREQUENCIES, } from '../../../data/PredictionManager';
|
|
7
7
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
8
8
|
import Label from '../../elements/Label';
|
|
9
9
|
import FormikNumberInput from '../../elements/formik/FormikNumberInput';
|
|
@@ -25,7 +25,7 @@ function PredictionSimpleOptions() {
|
|
|
25
25
|
const { dispatch } = usePreferences();
|
|
26
26
|
const predictionPreferences = usePanelPreferences('prediction');
|
|
27
27
|
const optionsChangeHandler = useCallback((values) => {
|
|
28
|
-
const value = lodashMerge({},
|
|
28
|
+
const value = lodashMerge({}, getDefaultPredictionOptions(), values);
|
|
29
29
|
dispatch({
|
|
30
30
|
type: 'SET_PANELS_PREFERENCES',
|
|
31
31
|
payload: { key: 'prediction', value },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SpectrumSimulation(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { Formik } from 'formik';
|
|
5
|
+
import { useCallback, useState, useRef, useMemo } from 'react';
|
|
6
|
+
import { defaultSimulationOptions, } from '../../../data/data1d/spectrumSimulation';
|
|
7
|
+
import { useDispatch } from '../../context/DispatchContext';
|
|
8
|
+
import Button from '../../elements/Button';
|
|
9
|
+
import FormikOnChange from '../../elements/formik/FormikOnChange';
|
|
10
|
+
import AboutSpectrumSimulationModal from '../../modal/AboutSpectrumSimulationModal';
|
|
11
|
+
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
12
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
13
|
+
import PreferencesHeader from '../header/PreferencesHeader';
|
|
14
|
+
import SpectrumSimulationPreferences from './SpectrumSimulationPreferences';
|
|
15
|
+
import SpectrumSimulationSimpleOptions from './SpectrumSimulationSimpleOptions';
|
|
16
|
+
import { SpinSystemTable } from './SpinSystemTable';
|
|
17
|
+
export default function SpectrumSimulation() {
|
|
18
|
+
const dispatch = useDispatch();
|
|
19
|
+
const [isFlipped, setFlipStatus] = useState(false);
|
|
20
|
+
const [spinSystem, setSpinSystem] = useState('AB');
|
|
21
|
+
const spinSystemRef = useRef('AB');
|
|
22
|
+
const formRef = useRef(null);
|
|
23
|
+
const settingRef = useRef(null);
|
|
24
|
+
const settingsPanelHandler = useCallback(() => {
|
|
25
|
+
setFlipStatus(!isFlipped);
|
|
26
|
+
}, [isFlipped]);
|
|
27
|
+
const saveSettingHandler = useCallback(() => {
|
|
28
|
+
settingRef.current?.saveSetting();
|
|
29
|
+
setFlipStatus(false);
|
|
30
|
+
}, []);
|
|
31
|
+
function spinSystemChangeHandler(system) {
|
|
32
|
+
spinSystemRef.current = system;
|
|
33
|
+
setSpinSystem(system);
|
|
34
|
+
}
|
|
35
|
+
const data = useMemo(() => {
|
|
36
|
+
const rows = [];
|
|
37
|
+
const spinLength = spinSystem.length;
|
|
38
|
+
for (let i = 1; i <= spinLength; i++) {
|
|
39
|
+
const columns = [];
|
|
40
|
+
for (let j = 0; j < spinLength; j++) {
|
|
41
|
+
if (j < i && i !== 1) {
|
|
42
|
+
columns.push(0);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
columns.push(null);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
columns[0] = i;
|
|
49
|
+
rows.push(columns);
|
|
50
|
+
}
|
|
51
|
+
return rows;
|
|
52
|
+
}, [spinSystem]);
|
|
53
|
+
function simulateHandler(values, keepSpectrum = false) {
|
|
54
|
+
dispatch({
|
|
55
|
+
type: 'SIMULATE_SPECTRUM',
|
|
56
|
+
payload: { ...values, spinSystem: spinSystemRef.current, keepSpectrum },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function addSpectrumHandler() {
|
|
60
|
+
const values = formRef.current?.values;
|
|
61
|
+
if (values) {
|
|
62
|
+
simulateHandler(values, true);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function saveSettingsHandler(values) {
|
|
66
|
+
simulateHandler(values);
|
|
67
|
+
formRef.current?.setValues(values);
|
|
68
|
+
}
|
|
69
|
+
return (_jsx(Formik, { initialValues: { ...defaultSimulationOptions, data }, enableReinitialize: true,
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
71
|
+
onSubmit: () => { }, innerRef: formRef, children: ({ values }) => (_jsxs(_Fragment, { children: [_jsxs("div", { css: [
|
|
72
|
+
tablePanelStyle,
|
|
73
|
+
isFlipped &&
|
|
74
|
+
css `
|
|
75
|
+
.table-container {
|
|
76
|
+
table,
|
|
77
|
+
th {
|
|
78
|
+
position: relative !important;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`,
|
|
82
|
+
], children: [!isFlipped && (_jsxs(DefaultPanelHeader, { showSettingButton: true, onSettingClick: settingsPanelHandler, canDelete: false, children: [_jsx(AboutSpectrumSimulationModal, {}), _jsx(SpectrumSimulationSimpleOptions, { onSpinSystemChange: spinSystemChangeHandler, spinSystem: spinSystem })] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsxs("div", { style: {
|
|
83
|
+
display: 'flex',
|
|
84
|
+
flexDirection: 'column',
|
|
85
|
+
height: '100%',
|
|
86
|
+
overflow: 'auto',
|
|
87
|
+
}, children: [_jsx(SpinSystemTable, { spinSystem: spinSystem }), _jsx("div", { style: { padding: '5px' }, children: _jsx(Button.Done, { onClick: addSpectrumHandler, children: "Add Spectrum" }) })] })) : (_jsx(SpectrumSimulationPreferences, { ref: settingRef, options: values, onSave: saveSettingsHandler })) })] }), _jsx(FormikOnChange, { onChange: (values) => simulateHandler(values) }, Boolean(isFlipped).toString())] })) }));
|
|
88
|
+
}
|