nmrium 0.39.0 → 0.41.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/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/context/LoggerContext.js +11 -6
- 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/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 +8 -0
- package/lib/component/elements/popup/Alert/AlertBlock.js +30 -0
- 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 +5 -23
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +2 -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/Header.js +2 -2
- 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/useXScale.d.ts +1 -1
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
- package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
- package/lib/component/modal/AboutUsModal.js +4 -2
- package/lib/component/modal/AlignSpectraModal.js +11 -1
- package/lib/component/modal/LogsHistoryModal.d.ts +6 -0
- package/lib/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +6 -4
- 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/GeneralSettings.js +28 -27
- 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/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 +19 -19
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
- package/lib/component/panels/Panels.js +13 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +9 -15
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -10
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
- 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 +1 -1
- 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 +251 -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 +2 -0
- package/lib/component/reducer/actions/MoleculeActions.js +51 -2
- 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/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/export.d.ts +5 -4
- package/lib/component/utility/export.js +33 -61
- 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 +1 -0
- 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 +5 -5
- package/lib/data/data1d/database.js +3 -3
- 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 +1 -1
- package/lib/data/molecules/MoleculeManager.js +7 -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 +12 -0
- package/lib/utils/clipboard/clipboard.js +15 -0
- package/lib/utils/clipboard/clipboardComponents.d.ts +45 -0
- package/lib/utils/clipboard/clipboardComponents.js +150 -0
- package/lib/utils/clipboard/clipboardHooks.d.ts +94 -0
- package/lib/utils/clipboard/clipboardHooks.js +142 -0
- package/lib/utils/clipboard/types.d.ts +1 -0
- package/lib/utils/clipboard/types.js +1 -0
- 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/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/context/LoggerContext.js +10 -5
- package/lib-cjs/component/elements/InputRange.js +1 -1
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
- package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +36 -0
- package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +4 -22
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +2 -1
- package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
- package/lib-cjs/component/header/Header.js +2 -2
- 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/modal/AboutSpectrumSimulationModal.js +54 -0
- package/lib-cjs/component/modal/AboutUsModal.js +4 -2
- package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
- package/lib-cjs/component/{header/LogsHistory.js → modal/LogsHistoryModal.js} +8 -6
- 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/GeneralSettings.js +28 -27
- 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/settingsValidation.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +18 -18
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +9 -13
- package/lib-cjs/component/panels/Panels.js +13 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +9 -15
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -10
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +8 -11
- 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 +1 -1
- 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 +251 -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 +54 -2
- 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/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/export.js +33 -63
- 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 +1 -0
- 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 +3 -3
- 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 +7 -7
- 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/utils/clipboard/clipboard.js +23 -0
- package/lib-cjs/utils/clipboard/clipboardComponents.js +158 -0
- package/lib-cjs/utils/clipboard/clipboardHooks.js +147 -0
- package/lib-cjs/utils/clipboard/types.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/header/LogsHistory.d.ts +0 -1
|
@@ -46,12 +46,10 @@ function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }
|
|
|
46
46
|
}, [onAtomHoverAction, onAtomHoverHighlights, highlightData]);
|
|
47
47
|
const data = (0, react_1.useMemo)(() => {
|
|
48
48
|
if (zones || ranges) {
|
|
49
|
-
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && ranges
|
|
49
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && ranges?.values) {
|
|
50
50
|
return ranges.values;
|
|
51
51
|
}
|
|
52
|
-
else if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D &&
|
|
53
|
-
zones &&
|
|
54
|
-
zones.values) {
|
|
52
|
+
else if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && zones?.values) {
|
|
55
53
|
return zones.values;
|
|
56
54
|
}
|
|
57
55
|
}
|
|
@@ -63,7 +61,7 @@ function useAtomAssignment({ displayerMode, activeTab: nucleus, zones, ranges, }
|
|
|
63
61
|
y: [],
|
|
64
62
|
};
|
|
65
63
|
const assignment = assignments.data.assignments;
|
|
66
|
-
for (
|
|
64
|
+
for (const id in assignment) {
|
|
67
65
|
if (assignment[id].x) {
|
|
68
66
|
assignedDiaID.x.push(...assignment[id].x);
|
|
69
67
|
}
|
package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js
CHANGED
|
@@ -11,6 +11,8 @@ const react_2 = require("react");
|
|
|
11
11
|
const fa_1 = require("react-icons/fa");
|
|
12
12
|
const io5_1 = require("react-icons/io5");
|
|
13
13
|
const multipleSpectraAnalysis_1 = require("../../../data/data1d/multipleSpectraAnalysis");
|
|
14
|
+
const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
|
|
15
|
+
const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
|
|
14
16
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
15
17
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
16
18
|
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
@@ -19,7 +21,6 @@ const Alert_1 = require("../../elements/popup/Alert");
|
|
|
19
21
|
const Modal_1 = require("../../elements/popup/Modal");
|
|
20
22
|
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
21
23
|
const AlignSpectraModal_1 = __importDefault(require("../../modal/AlignSpectraModal"));
|
|
22
|
-
const export_1 = require("../../utility/export");
|
|
23
24
|
const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
24
25
|
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
25
26
|
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
@@ -55,18 +56,13 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, })
|
|
|
55
56
|
width: 500,
|
|
56
57
|
});
|
|
57
58
|
}, [activeTab, modal, dispatch]);
|
|
59
|
+
const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = (0, clipboardHooks_1.useClipboard)();
|
|
58
60
|
const copyToClipboardHandler = (0, react_2.useCallback)(() => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
alert.error('copy to clipboard failed');
|
|
67
|
-
}
|
|
68
|
-
})();
|
|
69
|
-
}, [alert, spectra, spectraAnalysis, spectraPreferences]);
|
|
61
|
+
const data = (0, multipleSpectraAnalysis_1.getDataAsString)(spectraAnalysis, spectra, spectraPreferences);
|
|
62
|
+
if (!data)
|
|
63
|
+
return;
|
|
64
|
+
void rawWriteWithType(data).then(() => alert.success('Data copied to clipboard'));
|
|
65
|
+
}, [alert, rawWriteWithType, spectra, spectraAnalysis, spectraPreferences]);
|
|
70
66
|
return ((0, jsx_runtime_1.jsxs)("div", { css: [
|
|
71
67
|
BasicPanelStyle_1.tablePanelStyle,
|
|
72
68
|
isFlipped &&
|
|
@@ -75,7 +71,7 @@ function MultipleSpectraAnalysisPanelInner({ activeTab, spectra, showLegend, })
|
|
|
75
71
|
position: relative;
|
|
76
72
|
}
|
|
77
73
|
`,
|
|
78
|
-
], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Spectra calibration", onClick: openAlignSpectra, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay, { style: { fontSize: '18px' } }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, defaultValue: showLegend, children: (0, jsx_runtime_1.jsx)(io5_1.IoPulseOutline, {}) }, `${showLegend}`)] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisTable_1.default, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })) : ((0, jsx_runtime_1.jsx)(preferences_1.default, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) })] }));
|
|
74
|
+
], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { deleteToolTip: "Delete All Peaks", showSettingButton: true, canDelete: false, onSettingClick: settingsPanelHandler, children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Copy To Clipboard", onClick: copyToClipboardHandler, children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Spectra calibration", onClick: openAlignSpectra, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrOverlay, { style: { fontSize: '18px' } }) }), (0, jsx_runtime_1.jsx)(ToggleButton_1.default, { popupTitle: "Y spectra tracker", popupPlacement: "right", onClick: showTrackerHandler, defaultValue: showLegend, children: (0, jsx_runtime_1.jsx)(io5_1.IoPulseOutline, {}) }, `${showLegend}`)] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)(MultipleSpectraAnalysisTable_1.default, { data: spectraAnalysis, resortSpectra: preferences.analysisOptions.resortSpectra, activeTab: activeTab })) : ((0, jsx_runtime_1.jsx)(preferences_1.default, { data: spectraAnalysis, activeTab: activeTab, onAfterSave: afterSaveHandler, ref: settingRef })) }), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra Analysis" })] }));
|
|
79
75
|
}
|
|
80
76
|
const MemoizedMultipleSpectraAnalysisPanel = (0, react_2.memo)(MultipleSpectraAnalysisPanelInner);
|
|
81
77
|
function MultipleSpectraAnalysisPanel() {
|
|
@@ -26,6 +26,7 @@ const ZonesPanel_1 = __importDefault(require("./ZonesPanel/ZonesPanel"));
|
|
|
26
26
|
const DatabasePanel_1 = __importDefault(require("./databasePanel/DatabasePanel"));
|
|
27
27
|
const FilterPanel_1 = __importDefault(require("./filtersPanel/FilterPanel"));
|
|
28
28
|
const PredictionPanel_1 = __importDefault(require("./predictionPanel/PredictionPanel"));
|
|
29
|
+
const SpectrumSimulation_1 = __importDefault(require("./spectrumSimulation/SpectrumSimulation"));
|
|
29
30
|
const accordionItems = [
|
|
30
31
|
{
|
|
31
32
|
title: 'Spectra',
|
|
@@ -112,6 +113,12 @@ const accordionItems = [
|
|
|
112
113
|
hidePreferenceKey: 'predictionPanel',
|
|
113
114
|
mode: null,
|
|
114
115
|
},
|
|
116
|
+
{
|
|
117
|
+
title: 'Spectrum Simulation',
|
|
118
|
+
component: (0, jsx_runtime_1.jsx)(SpectrumSimulation_1.default, {}),
|
|
119
|
+
hidePreferenceKey: 'simulationPanel',
|
|
120
|
+
mode: Constants_1.DISPLAYER_MODE.DM_1D,
|
|
121
|
+
},
|
|
115
122
|
];
|
|
116
123
|
exports.TOOLS_PANELS_ACCORDION = {
|
|
117
124
|
null: 'Spectra',
|
|
@@ -128,6 +135,12 @@ function usePanelPreferences() {
|
|
|
128
135
|
display: false,
|
|
129
136
|
open: false,
|
|
130
137
|
};
|
|
138
|
+
if (item?.isExperimental && !item.hidePreferenceKey) {
|
|
139
|
+
return {
|
|
140
|
+
display: true,
|
|
141
|
+
open: false,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
131
144
|
return (0, get_1.default)(preferences.current, `display.panels.${item.hidePreferenceKey}`, defaultValue);
|
|
132
145
|
}, [preferences]);
|
|
133
146
|
}
|
|
@@ -131,7 +131,7 @@ function PeaksTable({ activeTab, data }) {
|
|
|
131
131
|
},
|
|
132
132
|
], [deletePeakHandler, editPeakHandler]);
|
|
133
133
|
const tableColumns = (0, react_1.useMemo)(() => {
|
|
134
|
-
|
|
134
|
+
const columns = [...initialColumns];
|
|
135
135
|
for (const col of COLUMNS) {
|
|
136
136
|
const { showWhen, ...colParams } = col;
|
|
137
137
|
if ((0, get_1.default)(peaksPreferences, showWhen)) {
|
|
@@ -11,6 +11,8 @@ const get_1 = __importDefault(require("lodash/get"));
|
|
|
11
11
|
const nmr_processing_1 = require("nmr-processing");
|
|
12
12
|
const fa_1 = require("react-icons/fa");
|
|
13
13
|
const im_1 = require("react-icons/im");
|
|
14
|
+
const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
|
|
15
|
+
const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
|
|
14
16
|
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
15
17
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
16
18
|
const ActiveButton_1 = __importDefault(require("../../elements/ActiveButton"));
|
|
@@ -20,7 +22,6 @@ const Modal_1 = require("../../elements/popup/Modal");
|
|
|
20
22
|
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
21
23
|
const CopyClipboardModal_1 = __importDefault(require("../../modal/CopyClipboardModal"));
|
|
22
24
|
const ChangeSumModal_1 = __importDefault(require("../../modal/changeSum/ChangeSumModal"));
|
|
23
|
-
const export_1 = require("../../utility/export");
|
|
24
25
|
const formatNumber_1 = require("../../utility/formatNumber");
|
|
25
26
|
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
26
27
|
const style = (0, react_1.css) `
|
|
@@ -92,16 +93,9 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
|
|
|
92
93
|
function handleShowJGraph() {
|
|
93
94
|
dispatch({ type: 'SHOW_J_GRAPH', payload: { id } });
|
|
94
95
|
}
|
|
96
|
+
const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = (0, clipboardHooks_1.useClipboard)();
|
|
95
97
|
function saveToClipboardHandler(value) {
|
|
96
|
-
void (
|
|
97
|
-
const success = await (0, export_1.copyHTMLToClipboard)(value);
|
|
98
|
-
if (success) {
|
|
99
|
-
alert.success('Data copied to clipboard');
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
alert.error('copy to clipboard failed');
|
|
103
|
-
}
|
|
104
|
-
})();
|
|
98
|
+
void rawWriteWithType(value, 'text/html').then(() => alert.success('Data copied to clipboard'));
|
|
105
99
|
}
|
|
106
100
|
function saveAsHTMLHandler() {
|
|
107
101
|
if (Array.isArray(ranges?.values) && ranges.values.length > 0) {
|
|
@@ -123,10 +117,10 @@ function RangesHeader({ id, ranges, info, onUnlink, onFilterActivated, onSetting
|
|
|
123
117
|
});
|
|
124
118
|
}
|
|
125
119
|
const hasRanges = Array.isArray(ranges?.values) && ranges.values.length > 0;
|
|
126
|
-
return ((0, jsx_runtime_1.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
120
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: style, children: [(0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { counter: ranges?.values?.length || 0, onDelete: handleDeleteAll, deleteToolTip: "Delete All Ranges", onFilter: onFilterActivated, filterToolTip: isFilterActive ? 'Show all ranges' : 'Hide ranges out of view', filterIsActive: isFilterActive, counterFiltered: filterCounter, showSettingButton: true, onSettingClick: onSettingClick, children: [(0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Preview publication string", popupPlacement: "right", onClick: saveAsHTMLHandler, className: "btn preview-publication-icon", disabled: !hasRanges, children: (0, jsx_runtime_1.jsx)(fa_1.FaFileExport, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: currentSum
|
|
121
|
+
? `Change ranges sum (${Number(currentSum).toFixed(2)})`
|
|
122
|
+
: 'Change ranges sum', popupPlacement: "right", onClick: showChangeRangesSumModal, className: "btn icon", children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrSum, {}) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "Remove all assignments", popupPlacement: "right", onClick: handleOnRemoveAssignments, disabled: !hasRanges, className: "btn icon", children: (0, jsx_runtime_1.jsx)(fa_1.FaUnlink, {}) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: showMultiplicityTrees
|
|
123
|
+
? 'Hide multiplicity trees in spectrum'
|
|
124
|
+
: 'Show multiplicity trees in spectrum', popupPlacement: "right", onClick: handleSetShowMultiplicityTrees, value: showMultiplicityTrees, disabled: !hasRanges, children: (0, jsx_runtime_1.jsx)(fa_1.FaSitemap, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: showJGraph ? 'Hide J Graph' : 'Show J Graph', popupPlacement: "right", onClick: handleShowJGraph, value: showJGraph, disabled: !hasRanges, children: (0, jsx_runtime_1.jsx)(fa_1.FaChartBar, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { popupTitle: showRangesIntegrals ? 'Hide integrals' : 'Show integrals', popupPlacement: "right", onClick: handleShowIntegrals, value: showRangesIntegrals, disabled: !hasRanges, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrIntegrate, { style: { pointerEvents: 'none', fontSize: '12px' } }) }), (0, jsx_runtime_1.jsx)(ActiveButton_1.default, { className: "icon", popupTitle: "Fix integral values", popupPlacement: "right", onClick: changeSumConstantFlagHandler, value: ranges?.options?.isSumConstant, children: (0, jsx_runtime_1.jsx)(im_1.ImLink, {}) })] }), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Preview publication string" })] }));
|
|
131
125
|
}
|
|
132
126
|
exports.default = RangesHeader;
|
|
@@ -9,6 +9,8 @@ const react_1 = require("@emotion/react");
|
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
10
10
|
const react_2 = require("react");
|
|
11
11
|
const fa_1 = require("react-icons/fa");
|
|
12
|
+
const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
|
|
13
|
+
const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
|
|
12
14
|
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
13
15
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
14
16
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
@@ -16,7 +18,6 @@ const Alert_1 = require("../../elements/popup/Alert");
|
|
|
16
18
|
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
17
19
|
const useSpectrum_1 = __importDefault(require("../../hooks/useSpectrum"));
|
|
18
20
|
const Reducer_1 = require("../../reducer/Reducer");
|
|
19
|
-
const export_1 = require("../../utility/export");
|
|
20
21
|
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
21
22
|
const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
|
|
22
23
|
const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
|
|
@@ -73,6 +74,7 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
|
|
|
73
74
|
},
|
|
74
75
|
});
|
|
75
76
|
}, [assignmentData, dispatch]);
|
|
77
|
+
const { rawWriteWithType, shouldFallback, cleanShouldFallback, text } = (0, clipboardHooks_1.useClipboard)();
|
|
76
78
|
const saveJSONToClipboardHandler = (0, react_2.useCallback)(async (value) => {
|
|
77
79
|
if (data.x && data.re) {
|
|
78
80
|
const { x, re } = data;
|
|
@@ -86,15 +88,10 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
|
|
|
86
88
|
y: Array.from(re.slice(fromIndex, toIndex)),
|
|
87
89
|
...value,
|
|
88
90
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
alert.show('Data copied to clipboard');
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
alert.error('copy to clipboard failed');
|
|
95
|
-
}
|
|
91
|
+
await rawWriteWithType(JSON.stringify(dataToClipboard, undefined, 2));
|
|
92
|
+
alert.show('Data copied to clipboard');
|
|
96
93
|
}
|
|
97
|
-
}, [data, alert]);
|
|
94
|
+
}, [data, rawWriteWithType, alert]);
|
|
98
95
|
const contextMenuSelectHandler = (0, react_2.useCallback)((option, data) => {
|
|
99
96
|
void saveJSONToClipboardHandler(data);
|
|
100
97
|
}, [saveJSONToClipboardHandler]);
|
|
@@ -124,7 +121,7 @@ function RangesTablePanelInner({ id, ranges, data, info, xDomain, preferences, a
|
|
|
124
121
|
showRangesIntegrals,
|
|
125
122
|
showMultiplicityTrees,
|
|
126
123
|
showJGraph,
|
|
127
|
-
isFilterActive, onUnlink: unlinkRangeHandler, onFilterActivated: filterHandler, onSettingClick: settingsPanelHandler, filterCounter: rangesData.length })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)("div", { className: "table-container", children: rangesData && rangesData.length > 0 ? ((0, jsx_runtime_1.jsx)(RangesTable_1.default, { activeTab: activeTab, tableData: rangesData, onUnlink: unlinkRangeHandler, contextMenu: rangesContextMenuOptions, onContextMenuSelect: contextMenuSelectHandler, preferences: preferences, info: info })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {})) })) : ((0, jsx_runtime_1.jsx)(RangesPreferences_1.default, { ref: settingRef })) })] }));
|
|
124
|
+
isFilterActive, onUnlink: unlinkRangeHandler, onFilterActivated: filterHandler, onSettingClick: settingsPanelHandler, filterCounter: rangesData.length })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsx)("div", { className: "table-container", children: rangesData && rangesData.length > 0 ? ((0, jsx_runtime_1.jsx)(RangesTable_1.default, { activeTab: activeTab, tableData: rangesData, onUnlink: unlinkRangeHandler, contextMenu: rangesContextMenuOptions, onContextMenuSelect: contextMenuSelectHandler, preferences: preferences, info: info })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {})) })) : ((0, jsx_runtime_1.jsx)(RangesPreferences_1.default, { ref: settingRef })) }), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Range" })] }));
|
|
128
125
|
}
|
|
129
126
|
const MemoizedRangesTablePanel = (0, react_2.memo)(RangesTablePanelInner);
|
|
130
127
|
const emptyData = { ranges: {}, data: {}, info: {} };
|
|
@@ -10,12 +10,13 @@ const react_1 = require("react");
|
|
|
10
10
|
const fa_1 = require("react-icons/fa");
|
|
11
11
|
const io5_1 = require("react-icons/io5");
|
|
12
12
|
const ui_1 = require("react-science/ui");
|
|
13
|
+
const clipboardComponents_1 = require("../../../utils/clipboard/clipboardComponents");
|
|
14
|
+
const clipboardHooks_1 = require("../../../utils/clipboard/clipboardHooks");
|
|
13
15
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
14
16
|
const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
|
|
15
17
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
16
18
|
const usePanelPreferences_1 = require("../../hooks/usePanelPreferences");
|
|
17
19
|
const ExportAsJcampModal_1 = __importDefault(require("../../modal/ExportAsJcampModal"));
|
|
18
|
-
const export_1 = require("../../utility/export");
|
|
19
20
|
const ColorIndicator_1 = __importDefault(require("./base/ColorIndicator"));
|
|
20
21
|
const ShowHideSpectrumButton_1 = __importDefault(require("./base/ShowHideSpectrumButton"));
|
|
21
22
|
const SpectrumName_1 = require("./base/SpectrumName");
|
|
@@ -136,19 +137,15 @@ function SpectraTable(props) {
|
|
|
136
137
|
},
|
|
137
138
|
},
|
|
138
139
|
}), [onChangeVisibility, onOpenSettingModal]);
|
|
140
|
+
const { rawWriteWithType, cleanShouldFallback, shouldFallback, text } = (0, clipboardHooks_1.useClipboard)();
|
|
139
141
|
const selectContextMenuHandler = (0, react_1.useCallback)((option, spectrum) => {
|
|
140
142
|
const { id } = option.data;
|
|
141
143
|
switch (id) {
|
|
142
144
|
case SpectraContextMenuOptionsKeys.CopyToClipboard: {
|
|
143
145
|
void (async () => {
|
|
144
146
|
const { data, info } = spectrum;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
alert.success('Data copied to clipboard');
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
alert.error('Copy to clipboard failed');
|
|
151
|
-
}
|
|
147
|
+
await rawWriteWithType(JSON.stringify({ data, info }, (_, value) => ArrayBuffer.isView(value) ? Array.from(value) : value, 2));
|
|
148
|
+
alert.success('Data copied to clipboard');
|
|
152
149
|
})();
|
|
153
150
|
break;
|
|
154
151
|
}
|
|
@@ -166,12 +163,12 @@ function SpectraTable(props) {
|
|
|
166
163
|
break;
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
|
-
}, [alert, dispatch]);
|
|
166
|
+
}, [alert, dispatch, rawWriteWithType]);
|
|
170
167
|
function handleActiveRow(row) {
|
|
171
168
|
return activeSpectraObj?.[row?.original.id] || false;
|
|
172
169
|
}
|
|
173
170
|
const tableColumns = (0, react_1.useMemo)(() => {
|
|
174
|
-
|
|
171
|
+
const columns = [];
|
|
175
172
|
let index = 0;
|
|
176
173
|
const visibleColumns = spectraPreferences.columns.filter((col) => col.visible);
|
|
177
174
|
for (const col of visibleColumns) {
|
|
@@ -220,7 +217,7 @@ function SpectraTable(props) {
|
|
|
220
217
|
? Spectra1DContextMenuOptions
|
|
221
218
|
: Spectra2DContextMenuOptions, onContextMenuSelect: selectContextMenuHandler, onSortEnd: handleSortEnd, style: { 'table td': { paddingTop: 0, paddingBottom: 0 } } }), exportedSpectrum && ((0, jsx_runtime_1.jsx)(ExportAsJcampModal_1.default, { spectrum: exportedSpectrum, closeDialog: () => {
|
|
222
219
|
setExportedSpectrum(null);
|
|
223
|
-
} }))] }));
|
|
220
|
+
} })), (0, jsx_runtime_1.jsx)(clipboardComponents_1.ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, text: text, label: "Spectra" })] }));
|
|
224
221
|
}
|
|
225
222
|
exports.SpectraTable = SpectraTable;
|
|
226
223
|
const ColumnHeader = ({ label, col, }) => {
|
|
@@ -24,7 +24,9 @@ const style = (0, react_1.css) `
|
|
|
24
24
|
flex-direction: row-reverse;
|
|
25
25
|
border-radius: 4px;
|
|
26
26
|
background-color: white;
|
|
27
|
-
box-shadow:
|
|
27
|
+
box-shadow:
|
|
28
|
+
rgb(0 0 0 / 15%) 0 0 0 1px,
|
|
29
|
+
rgb(0 0 0 / 15%) 0 8px 16px;
|
|
28
30
|
overflow: auto;
|
|
29
31
|
height: 350px;
|
|
30
32
|
}
|
|
@@ -7,9 +7,9 @@ function processSnapPlot(dimension, data, yLogBase) {
|
|
|
7
7
|
const sanResult = (0, calculateSanPlot_1.calculateSanPlot)(dimension, data);
|
|
8
8
|
const sanPlot = {};
|
|
9
9
|
const lines = {};
|
|
10
|
-
for (
|
|
10
|
+
for (const plotKey in sanResult.sanplot) {
|
|
11
11
|
const { x, y } = (0, ml_spectra_processing_1.xyReduce)(sanResult.sanplot[plotKey]);
|
|
12
|
-
|
|
12
|
+
const result = new Array(x.length);
|
|
13
13
|
for (let i = 0; i < x.length; i++) {
|
|
14
14
|
result[i] = { x: x[i], y: y[i] };
|
|
15
15
|
}
|
|
@@ -19,7 +19,7 @@ exports.getAtomType = getAtomType;
|
|
|
19
19
|
function getLabelColor(correlationData, correlation) {
|
|
20
20
|
const error = (0, get_1.default)(correlationData, `state.${correlation.atomType}.error`, null);
|
|
21
21
|
if (error) {
|
|
22
|
-
for (
|
|
22
|
+
for (const { key, color } of Constants_2.ErrorColors) {
|
|
23
23
|
if (key !== 'incomplete' && // do not consider this for a single atom type
|
|
24
24
|
(key === 'notAttached' || key === 'ambiguousAttachment') &&
|
|
25
25
|
(0, get_1.default)(error, `${key}`, []).some((index) => correlationData.values[index].id === correlation.id)) {
|
|
@@ -175,7 +175,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
175
175
|
return (0, database_1.prepareData)(result.data);
|
|
176
176
|
}, [result.data]);
|
|
177
177
|
const resurrectHandler = (0, react_2.useCallback)((rowData) => {
|
|
178
|
-
|
|
178
|
+
const { index, baseURL, jcampURL: jcampRelativeURL } = rowData;
|
|
179
179
|
const { ranges, solvent, names = [] } = result.data[index];
|
|
180
180
|
if (jcampRelativeURL) {
|
|
181
181
|
const url = new URL(jcampRelativeURL, baseURL);
|
|
@@ -147,7 +147,7 @@ function DatabaseTable({ data, onAdd, onSave, totalCount, }) {
|
|
|
147
147
|
},
|
|
148
148
|
], [databasePreferences?.allowSaveAsNMRium, onAdd, onSave]);
|
|
149
149
|
const tableColumns = (0, react_1.useMemo)(() => {
|
|
150
|
-
|
|
150
|
+
const columns = [...initialColumns];
|
|
151
151
|
for (const col of databaseTableColumns(databasePreferences)) {
|
|
152
152
|
const { showWhen, ...colParams } = col;
|
|
153
153
|
if ((0, get_1.default)(databasePreferences, showWhen, false)) {
|
|
@@ -18,14 +18,14 @@ exports.hasCouplingConstant = hasCouplingConstant;
|
|
|
18
18
|
function getPascal(n, spin) {
|
|
19
19
|
if (n === undefined || n === 0 || spin === undefined)
|
|
20
20
|
return [1];
|
|
21
|
-
|
|
21
|
+
const mult = 2 * spin + 1;
|
|
22
22
|
let previousLine = [];
|
|
23
23
|
for (let j = 0; j < mult - 1; j++)
|
|
24
24
|
previousLine.push(1);
|
|
25
25
|
// complete with "1 1" or "1 1 1" for spin 1/2 and 1 respectively
|
|
26
26
|
for (let i = 0; i < n - 1; i++) {
|
|
27
27
|
// copy the line
|
|
28
|
-
|
|
28
|
+
const _line = previousLine.slice();
|
|
29
29
|
for (let j = 1; j < mult; j++) {
|
|
30
30
|
for (let k = 0; k < previousLine.length - 1; k++) {
|
|
31
31
|
_line[k + j] += previousLine[k];
|
|
@@ -10,7 +10,7 @@ function useToggleStatus(key, data) {
|
|
|
10
10
|
const [status, setStatus] = (0, react_1.useState)({});
|
|
11
11
|
const oldIdRef = (0, react_1.useRef)();
|
|
12
12
|
(0, react_1.useEffect)(() => {
|
|
13
|
-
|
|
13
|
+
const statusflags = {};
|
|
14
14
|
if (data && Array.isArray(data)) {
|
|
15
15
|
for (const item of data) {
|
|
16
16
|
statusflags[item[key]] = false;
|
|
@@ -7,10 +7,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const fa_1 = require("react-icons/fa");
|
|
9
9
|
const react_inspector_1 = require("react-inspector");
|
|
10
|
+
const ui_1 = require("react-science/ui");
|
|
10
11
|
const ChartContext_1 = require("../../context/ChartContext");
|
|
11
12
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
12
13
|
const Button_1 = __importDefault(require("../../elements/Button"));
|
|
13
|
-
const CheckBox_1 = __importDefault(require("../../elements/CheckBox"));
|
|
14
14
|
const ColumnWrapper_1 = require("../../elements/ColumnWrapper");
|
|
15
15
|
const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
|
|
16
16
|
const Alert_1 = require("../../elements/popup/Alert");
|
|
@@ -114,7 +114,7 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
|
114
114
|
style: { width: '30px' },
|
|
115
115
|
Cell: ({ row }) => {
|
|
116
116
|
const { flag, id } = row.original;
|
|
117
|
-
return ((0, jsx_runtime_1.jsx)(ColumnWrapper_1.ColumnWrapper, { children: (0, jsx_runtime_1.jsx)(
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(ColumnWrapper_1.ColumnWrapper, { children: (0, jsx_runtime_1.jsx)(ui_1.Checkbox, { onChange: (checked) => handelFilterCheck(id, checked), checked: flag }) }));
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
{
|
|
@@ -46,6 +46,7 @@ const NUMBER_OF_POINTS_2D = (0, generateNumbersPowerOfX_1.default)(10, 10, {
|
|
|
46
46
|
const predictionFormValidation = Yup.object().shape({
|
|
47
47
|
name: Yup.string().label('Name'),
|
|
48
48
|
frequency: Yup.number().integer().required().label('Frequency'),
|
|
49
|
+
autoExtendRange: Yup.boolean(),
|
|
49
50
|
'1d': Yup.object({
|
|
50
51
|
'1H': Yup.object({
|
|
51
52
|
from: Yup.number().required().label("1H ' From ' "),
|
|
@@ -106,7 +107,7 @@ function PredictionOptionsPanel(props, ref) {
|
|
|
106
107
|
const { options, onSubmit, hideName = false } = props;
|
|
107
108
|
return ((0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: options, validationSchema: predictionFormValidation, enableReinitialize: true, onSubmit: onSubmit, innerRef: ref, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FormikErrorsSummary_1.default, {}), !hideName && ((0, jsx_runtime_1.jsx)(Label_1.default, { title: "Name", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "name", style: inputStyle }) })), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: styles.select, name: "frequency" }) }), (0, jsx_runtime_1.jsxs)(GroupPane_1.GroupPane, { text: "1D Options", style: {
|
|
108
109
|
header: styles.groupHeader,
|
|
109
|
-
}, children: [(0, jsx_runtime_1.jsxs)(Label_1.default, { title: "1H", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "13C", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: inputStyle }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Points", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "2D Options", style: {
|
|
110
|
+
}, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Auto extend range", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikCheckBox_1.default, { name: "autoExtendRange" }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "1H", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.1H.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "13C", renderTitle: (title) => ((0, jsx_runtime_1.jsx)(IsotopesViewer_1.default, { value: title, className: "custom-label" })), style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.13C.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "1d.lineWidth", type: "number", style: inputStyle }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Points", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_1D, name: "1d.nbPoints", style: styles.select }) })] }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "2D Options", style: {
|
|
110
111
|
header: styles.groupHeader,
|
|
111
112
|
}, children: (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Number of Points", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.x", style: { margin: 0, height: 30 } }), (0, jsx_runtime_1.jsx)("span", { style: { padding: '0 10px' }, children: " X " }), (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: NUMBER_OF_POINTS_2D, name: "2d.nbPoints.y", style: { margin: 0, height: 30 } })] }) }), (0, jsx_runtime_1.jsx)(GroupPane_1.GroupPane, { text: "Spectra", style: {
|
|
112
113
|
header: styles.groupHeader,
|
|
@@ -77,10 +77,11 @@ function PredictionPanel() {
|
|
|
77
77
|
}
|
|
78
78
|
const hideLoading = await alert.showLoading(`Predict ${predictedSpectra.join(',')} in progress`);
|
|
79
79
|
try {
|
|
80
|
-
const data = await (0, PredictionManager_1.predictSpectra)(molfile
|
|
80
|
+
const data = await (0, PredictionManager_1.predictSpectra)(molfile);
|
|
81
81
|
dispatch({
|
|
82
82
|
type: 'PREDICT_SPECTRA',
|
|
83
83
|
payload: {
|
|
84
|
+
logger,
|
|
84
85
|
predictedSpectra: data.spectra,
|
|
85
86
|
options: predictionPreferences,
|
|
86
87
|
molecule: { ...molecules[currentIndex], molfile },
|
|
@@ -123,7 +124,7 @@ function PredictionPanel() {
|
|
|
123
124
|
}, children: molecules && molecules.length > 0 ? (molecules.map((mol, molIndex) => ((0, jsx_runtime_1.jsxs)("div", { style: styles.flexColumnContainer, children: [(0, jsx_runtime_1.jsx)(MoleculeHeader_1.default, { currentMolecule: mol, molecules: molecules }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
124
125
|
...styles.slider,
|
|
125
126
|
height: height - 31,
|
|
126
|
-
}, children: molIndex === currentIndex && ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
|
|
127
|
+
}, children: molIndex === currentIndex && ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { width: width, initialMolfile: mol.molfile, svgMenu: true, fragment: false, onChange: changeHandler })) })] }, mol.id)))) : ((0, jsx_runtime_1.jsx)(full_1.StructureEditor, { initialMolfile: molfile || '', width: width, height: height, svgMenu: true, fragment: false, onChange: changeHandler })) }));
|
|
127
128
|
} }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', padding: '5px' }, children: [(0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: () => predictHandler('save'), disabled: !molfile, children: isPredictedBefore ? 'Replace prediction' : 'Predict spectra' }), isPredictedBefore && ((0, jsx_runtime_1.jsx)(Button_1.default.Action, { style: { marginLeft: '5px' }, onClick: () => predictHandler('add'), children: "Add prediction" }))] })] })] }))] }));
|
|
128
129
|
}
|
|
129
130
|
exports.default = PredictionPanel;
|
|
@@ -53,7 +53,7 @@ function PredictionSimpleOptions() {
|
|
|
53
53
|
const { dispatch } = (0, PreferencesContext_1.usePreferences)();
|
|
54
54
|
const predictionPreferences = (0, usePanelPreferences_1.usePanelPreferences)('prediction');
|
|
55
55
|
const optionsChangeHandler = (0, react_1.useCallback)((values) => {
|
|
56
|
-
const value = (0, merge_1.default)({}, PredictionManager_1.
|
|
56
|
+
const value = (0, merge_1.default)({}, (0, PredictionManager_1.getDefaultPredictionOptions)(), values);
|
|
57
57
|
dispatch({
|
|
58
58
|
type: 'SET_PANELS_PREFERENCES',
|
|
59
59
|
payload: { key: 'prediction', value },
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource @emotion/react */
|
|
8
|
+
const react_1 = require("@emotion/react");
|
|
9
|
+
const formik_1 = require("formik");
|
|
10
|
+
const react_2 = require("react");
|
|
11
|
+
const spectrumSimulation_1 = require("../../../data/data1d/spectrumSimulation");
|
|
12
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
13
|
+
const Button_1 = __importDefault(require("../../elements/Button"));
|
|
14
|
+
const FormikOnChange_1 = __importDefault(require("../../elements/formik/FormikOnChange"));
|
|
15
|
+
const AboutSpectrumSimulationModal_1 = __importDefault(require("../../modal/AboutSpectrumSimulationModal"));
|
|
16
|
+
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
17
|
+
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
18
|
+
const PreferencesHeader_1 = __importDefault(require("../header/PreferencesHeader"));
|
|
19
|
+
const SpectrumSimulationPreferences_1 = __importDefault(require("./SpectrumSimulationPreferences"));
|
|
20
|
+
const SpectrumSimulationSimpleOptions_1 = __importDefault(require("./SpectrumSimulationSimpleOptions"));
|
|
21
|
+
const SpinSystemTable_1 = require("./SpinSystemTable");
|
|
22
|
+
function SpectrumSimulation() {
|
|
23
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
24
|
+
const [isFlipped, setFlipStatus] = (0, react_2.useState)(false);
|
|
25
|
+
const [spinSystem, setSpinSystem] = (0, react_2.useState)('AB');
|
|
26
|
+
const spinSystemRef = (0, react_2.useRef)('AB');
|
|
27
|
+
const formRef = (0, react_2.useRef)(null);
|
|
28
|
+
const settingRef = (0, react_2.useRef)(null);
|
|
29
|
+
const settingsPanelHandler = (0, react_2.useCallback)(() => {
|
|
30
|
+
setFlipStatus(!isFlipped);
|
|
31
|
+
}, [isFlipped]);
|
|
32
|
+
const saveSettingHandler = (0, react_2.useCallback)(() => {
|
|
33
|
+
settingRef.current?.saveSetting();
|
|
34
|
+
setFlipStatus(false);
|
|
35
|
+
}, []);
|
|
36
|
+
function spinSystemChangeHandler(system) {
|
|
37
|
+
spinSystemRef.current = system;
|
|
38
|
+
setSpinSystem(system);
|
|
39
|
+
}
|
|
40
|
+
const data = (0, react_2.useMemo)(() => {
|
|
41
|
+
const rows = [];
|
|
42
|
+
const spinLength = spinSystem.length;
|
|
43
|
+
for (let i = 1; i <= spinLength; i++) {
|
|
44
|
+
const columns = [];
|
|
45
|
+
for (let j = 0; j < spinLength; j++) {
|
|
46
|
+
if (j < i && i !== 1) {
|
|
47
|
+
columns.push(0);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
columns.push(null);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
columns[0] = i;
|
|
54
|
+
rows.push(columns);
|
|
55
|
+
}
|
|
56
|
+
return rows;
|
|
57
|
+
}, [spinSystem]);
|
|
58
|
+
function simulateHandler(values, keepSpectrum = false) {
|
|
59
|
+
dispatch({
|
|
60
|
+
type: 'SIMULATE_SPECTRUM',
|
|
61
|
+
payload: { ...values, spinSystem: spinSystemRef.current, keepSpectrum },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function addSpectrumHandler() {
|
|
65
|
+
const values = formRef.current?.values;
|
|
66
|
+
if (values) {
|
|
67
|
+
simulateHandler(values, true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function saveSettingsHandler(values) {
|
|
71
|
+
simulateHandler(values);
|
|
72
|
+
formRef.current?.setValues(values);
|
|
73
|
+
}
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: { ...spectrumSimulation_1.defaultSimulationOptions, data }, enableReinitialize: true,
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
76
|
+
onSubmit: () => { }, innerRef: formRef, children: ({ values }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { css: [
|
|
77
|
+
BasicPanelStyle_1.tablePanelStyle,
|
|
78
|
+
isFlipped &&
|
|
79
|
+
(0, react_1.css) `
|
|
80
|
+
.table-container {
|
|
81
|
+
table,
|
|
82
|
+
th {
|
|
83
|
+
position: relative !important;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`,
|
|
87
|
+
], children: [!isFlipped && ((0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { showSettingButton: true, onSettingClick: settingsPanelHandler, canDelete: false, children: [(0, jsx_runtime_1.jsx)(AboutSpectrumSimulationModal_1.default, {}), (0, jsx_runtime_1.jsx)(SpectrumSimulationSimpleOptions_1.default, { onSpinSystemChange: spinSystemChangeHandler, spinSystem: spinSystem })] })), isFlipped && ((0, jsx_runtime_1.jsx)(PreferencesHeader_1.default, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: !isFlipped ? ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
88
|
+
display: 'flex',
|
|
89
|
+
flexDirection: 'column',
|
|
90
|
+
height: '100%',
|
|
91
|
+
overflow: 'auto',
|
|
92
|
+
}, children: [(0, jsx_runtime_1.jsx)(SpinSystemTable_1.SpinSystemTable, { spinSystem: spinSystem }), (0, jsx_runtime_1.jsx)("div", { style: { padding: '5px' }, children: (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: addSpectrumHandler, children: "Add Spectrum" }) })] })) : ((0, jsx_runtime_1.jsx)(SpectrumSimulationPreferences_1.default, { ref: settingRef, options: values, onSave: saveSettingsHandler })) })] }), (0, jsx_runtime_1.jsx)(FormikOnChange_1.default, { onChange: (values) => simulateHandler(values) }, Boolean(isFlipped).toString())] })) }));
|
|
93
|
+
}
|
|
94
|
+
exports.default = SpectrumSimulation;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const formik_1 = require("formik");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const PredictionManager_1 = require("../../../data/PredictionManager");
|
|
10
|
+
const generateNumbersPowerOfX_1 = __importDefault(require("../../../data/utilities/generateNumbersPowerOfX"));
|
|
11
|
+
const Label_1 = __importDefault(require("../../elements/Label"));
|
|
12
|
+
const FormikInput_1 = __importDefault(require("../../elements/formik/FormikInput"));
|
|
13
|
+
const FormikSelect_1 = __importDefault(require("../../elements/formik/FormikSelect"));
|
|
14
|
+
const PreferencesContainer_1 = require("../extra/preferences/PreferencesContainer");
|
|
15
|
+
const SIMULATION_NUMBER_OF_POINTS = (0, generateNumbersPowerOfX_1.default)(12, 19);
|
|
16
|
+
const selectStyles = {
|
|
17
|
+
width: '100%',
|
|
18
|
+
minWidth: '50px',
|
|
19
|
+
maxWidth: '280px',
|
|
20
|
+
height: 30,
|
|
21
|
+
margin: 0,
|
|
22
|
+
};
|
|
23
|
+
const labelStyle = {
|
|
24
|
+
label: { flex: 3, fontWeight: '500' },
|
|
25
|
+
wrapper: { flex: 9, display: 'flex', alignItems: 'center' },
|
|
26
|
+
container: { padding: '5px' },
|
|
27
|
+
};
|
|
28
|
+
const inputStyle = {
|
|
29
|
+
input: {
|
|
30
|
+
padding: '5px',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
function SpectrumSimulationPreferences({ options, onSave }, ref) {
|
|
34
|
+
const formRef = (0, react_1.useRef)(null);
|
|
35
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
36
|
+
saveSetting: () => {
|
|
37
|
+
void formRef.current?.submitForm();
|
|
38
|
+
},
|
|
39
|
+
}), []);
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(PreferencesContainer_1.PreferencesContainer, { style: { backgroundColor: 'white' }, children: (0, jsx_runtime_1.jsx)(formik_1.Formik, { initialValues: options, onSubmit: onSave, innerRef: formRef, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "Frequency", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: PredictionManager_1.FREQUENCIES, style: selectStyles, name: "options.frequency" }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "Number of Points", style: labelStyle, children: (0, jsx_runtime_1.jsx)(FormikSelect_1.default, { items: SIMULATION_NUMBER_OF_POINTS, name: "options.nbPoints", style: selectStyles }) }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Range", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(Label_1.default, { title: "From", children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "options.from", type: "number", style: inputStyle }) }), (0, jsx_runtime_1.jsx)(Label_1.default, { title: "To", style: { label: { padding: '0 10px' } }, children: (0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "options.to", type: "number", style: inputStyle }) })] }), (0, jsx_runtime_1.jsxs)(Label_1.default, { title: "Line Width", style: labelStyle, children: [(0, jsx_runtime_1.jsx)(FormikInput_1.default, { name: "options.lineWidth", type: "number", style: inputStyle }), (0, jsx_runtime_1.jsx)("span", { style: { paddingLeft: '0.4rem' }, children: " Hz " })] })] }) }) }));
|
|
41
|
+
}
|
|
42
|
+
exports.default = (0, react_1.forwardRef)(SpectrumSimulationPreferences);
|