nmrium 0.26.0 → 0.27.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/Chart1D.js +3 -2
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/Integral.d.ts +2 -1
- package/lib/component/1d/Integral.js +5 -12
- package/lib/component/1d/IntegralResizable.d.ts +2 -1
- package/lib/component/1d/IntegralResizable.js +10 -5
- package/lib/component/1d/IntegralsSeries.js +3 -3
- package/lib/component/1d/Line.d.ts +2 -2
- package/lib/component/1d/PeakAnnotation.js +5 -4
- package/lib/component/1d/database/DatabaseElements.d.ts +3 -0
- package/lib/component/1d/database/DatabaseElements.js +18 -0
- package/lib/component/1d/database/DatabaseSpectrum.d.ts +3 -0
- package/lib/component/1d/database/DatabaseSpectrum.js +58 -0
- package/lib/component/1d/{ResurrectedDatabaseRanges.d.ts → database/ResurrectedDatabaseRanges.d.ts} +0 -0
- package/lib/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
- package/lib/component/1d/jCouplingGraph/JGraph.js +4 -10
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +10 -5
- package/lib/component/1d/ranges/Range.d.ts +2 -1
- package/lib/component/1d/ranges/Range.js +17 -9
- package/lib/component/1d/ranges/Ranges.js +6 -3
- package/lib/component/1d/tool/XLabelPointer.js +1 -1
- package/lib/component/2d/Chart2D.js +2 -1
- package/lib/component/2d/Contours.js +4 -1
- package/lib/component/2d/FooterBanner.js +1 -1
- package/lib/component/2d/tools/XYLabelPointer.js +1 -1
- package/lib/component/2d/tools/slicing/HorizontalSliceChart.d.ts +2 -2
- package/lib/component/2d/tools/slicing/SliceScale.d.ts +1 -1
- package/lib/component/2d/tools/slicing/VerticalSliceChart.d.ts +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +10 -4
- package/lib/component/NMRium.d.ts +5 -1
- package/lib/component/NMRium.js +6 -3
- package/lib/component/SplitPaneWrapper.d.ts +4 -0
- package/lib/component/SplitPaneWrapper.js +8 -0
- package/lib/component/context/GlobalContext.d.ts +3 -0
- package/lib/component/context/GlobalContext.js +1 -1
- package/lib/component/context/PreferencesContext.d.ts +15 -12
- package/lib/component/context/PreferencesContext.js +1 -1
- package/lib/component/elements/Button.js +1 -1
- package/lib/component/elements/ColorInput.js +2 -2
- package/lib/component/elements/ContextMenu.d.ts +8 -3
- package/lib/component/elements/EditableColumn.d.ts +3 -2
- package/lib/component/elements/EditableColumn.js +27 -20
- package/lib/component/elements/Input.d.ts +9 -1
- package/lib/component/elements/Input.js +18 -5
- package/lib/component/elements/Select.d.ts +1 -0
- package/lib/component/elements/Select.js +21 -15
- package/lib/component/elements/ToggleButton.d.ts +2 -1
- package/lib/component/elements/ToggleButton.js +2 -2
- package/lib/component/elements/draggble/SVGDraggable.d.ts +17 -0
- package/lib/component/elements/draggble/SVGDraggable.js +33 -0
- package/lib/component/elements/{resizer → draggble}/useDraggable.d.ts +9 -6
- package/lib/component/elements/draggble/useDraggable.js +70 -0
- package/lib/component/elements/formik/FormikColorPicker.d.ts +1 -0
- package/lib/component/elements/formik/FormikColorPicker.js +10 -7
- package/lib/component/elements/formik/FormikColumnFormatField.d.ts +5 -4
- package/lib/component/elements/formik/FormikColumnFormatField.js +2 -2
- package/lib/component/elements/formik/FormikInput.d.ts +1 -0
- package/lib/component/elements/formik/FormikInput.js +6 -3
- package/lib/component/elements/formik/FormikSlider.d.ts +1 -0
- package/lib/component/elements/formik/FormikSlider.js +6 -3
- package/lib/component/elements/popup/Alert/Provider.js +1 -1
- package/lib/component/elements/resizer/DivResizer.js +17 -62
- package/lib/component/elements/resizer/Resizer.d.ts +3 -1
- package/lib/component/elements/resizer/SVGResizer.js +24 -53
- package/lib/component/elements/resizer/useResizer.d.ts +11 -0
- package/lib/component/elements/resizer/useResizer.js +65 -0
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useFormatNumberByNucleus.d.ts +3 -0
- package/lib/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +0 -9
- package/lib/component/hooks/usePanelPreferences.d.ts +7 -0
- package/lib/component/hooks/usePanelPreferences.js +54 -0
- package/lib/component/hooks/useXYReduce.d.ts +2 -2
- package/lib/component/loader/DefaultSpinnerComponent.d.ts +3 -1
- package/lib/component/loader/DefaultSpinnerComponent.js +2 -2
- package/lib/component/loader/SpinnerContext.d.ts +3 -3
- package/lib/component/loader/SpinnerContext.js +2 -2
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -4
- package/lib/component/modal/MoleculeStructureEditorModal.js +22 -1
- package/lib/component/modal/editRange/EditRangeModal.js +6 -5
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +2 -0
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +3 -1
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +12 -9
- package/lib/component/modal/setting/DatabasesTabContent.d.ts +6 -0
- package/lib/component/modal/setting/DatabasesTabContent.js +75 -0
- package/lib/component/modal/setting/DisplayTabContent.js +11 -7
- package/lib/component/modal/setting/FormattingTabContent.js +5 -5
- package/lib/component/modal/setting/GeneralSettings.js +2 -1
- package/lib/component/modal/setting/settingsValidation.d.ts +48 -0
- package/lib/component/modal/setting/settingsValidation.js +33 -27
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
- package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +0 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
- package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -11
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +26 -74
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +8 -0
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +38 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +10 -2
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +12 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +11 -0
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -1
- package/lib/component/panels/Panels.js +2 -3
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +3 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +29 -82
- package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -5
- package/lib/component/panels/PeaksPanel/PeaksTable.js +18 -25
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +15 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +4 -10
- package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +1 -1
- package/lib/component/panels/RangesPanel/RangesPreferences.js +55 -66
- package/lib/component/panels/RangesPanel/RangesTable.d.ts +11 -6
- package/lib/component/panels/RangesPanel/RangesTable.js +3 -7
- package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +5 -2
- package/lib/component/panels/RangesPanel/RangesTableRow.js +3 -3
- package/lib/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.d.ts +2 -1
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.d.ts +2 -1
- package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
- package/lib/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.d.ts +13 -0
- package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +14 -0
- package/lib/component/panels/RangesPanel/TableColumns/format.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.d.ts +18 -0
- package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.js +18 -0
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.d.ts +1 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +7 -68
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.d.ts +1 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +7 -68
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
- package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.d.ts +6 -0
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +51 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +5 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
- package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +20 -84
- package/lib/component/panels/ZonesPanel/ZonesTable.js +4 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +5 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +73 -40
- package/lib/component/panels/databasePanel/DatabasePreferences.js +10 -42
- package/lib/component/panels/databasePanel/DatabaseTable.js +23 -11
- package/lib/component/panels/databasePanel/useDatabases.d.ts +5 -0
- package/lib/component/panels/databasePanel/useDatabases.js +10 -0
- package/lib/component/panels/extra/placeholder/NoTableData.d.ts +3 -1
- package/lib/component/panels/extra/placeholder/NoTableData.js +2 -2
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +3 -3
- package/lib/component/panels/extra/preferences/NucleusPreferences.d.ts +13 -0
- package/lib/component/panels/extra/preferences/NucleusPreferences.js +22 -0
- package/lib/component/panels/extra/preferences/PreferencesContainer.d.ts +6 -0
- package/lib/component/panels/extra/preferences/PreferencesContainer.js +10 -0
- package/lib/component/panels/extra/preferences/PreferencesGroup.d.ts +7 -0
- package/lib/component/panels/extra/preferences/PreferencesGroup.js +21 -0
- package/lib/component/reducer/Reducer.d.ts +358 -45
- package/lib/component/reducer/Reducer.js +5 -1
- package/lib/component/reducer/actions/LoadActions.js +2 -2
- package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -2
- package/lib/component/reducer/actions/MoleculeActions.js +15 -3
- package/lib/component/reducer/actions/PreferencesActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +1 -1
- package/lib/component/reducer/preferences/actions/addWorkspace.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -0
- package/lib/component/reducer/preferences/actions/initPreferences.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/initPreferences.js +60 -0
- package/lib/component/reducer/preferences/actions/removeWorkspace.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +20 -0
- package/lib/component/reducer/preferences/actions/resetPreferences.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/resetPreferences.js +14 -0
- package/lib/component/reducer/preferences/actions/setPanelsPreferences.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +13 -0
- package/lib/component/reducer/preferences/actions/setPreferences.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/setPreferences.js +34 -0
- package/lib/component/reducer/preferences/actions/setWorkspace.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/setWorkspace.js +8 -0
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +7 -0
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +55 -0
- package/lib/component/reducer/{preferencesReducer.d.ts → preferences/preferencesReducer.d.ts} +131 -7
- package/lib/component/reducer/preferences/preferencesReducer.js +80 -0
- package/lib/component/reducer/preferences/utilites/checkKeysExists.d.ts +1 -0
- package/lib/component/reducer/preferences/utilites/checkKeysExists.js +14 -0
- package/lib/component/reducer/preferences/utilites/filterObject.d.ts +1 -0
- package/lib/component/reducer/preferences/utilites/filterObject.js +7 -0
- package/lib/component/reducer/preferences/utilites/flatObject.d.ts +1 -0
- package/lib/component/reducer/preferences/utilites/flatObject.js +9 -0
- package/lib/component/reducer/preferences/utilites/getActiveWorkspace.d.ts +3 -0
- package/lib/component/reducer/preferences/utilites/getActiveWorkspace.js +3 -0
- package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.d.ts +2 -0
- package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +4 -0
- package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.d.ts +5 -0
- package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.js +8 -0
- package/lib/component/reducer/types/Types.d.ts +2 -0
- package/lib/component/reducer/types/Types.js +2 -0
- package/lib/component/tool/FloatMoleculeStructures/ActionsButton.d.ts +4 -0
- package/lib/component/tool/FloatMoleculeStructures/ActionsButton.js +7 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +14 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +43 -0
- package/lib/component/tool/FloatMoleculeStructures/index.d.ts +15 -0
- package/lib/component/tool/FloatMoleculeStructures/index.js +28 -0
- package/lib/component/utility/Export.js +6 -0
- package/lib/component/utility/PathBuilder.js +2 -1
- package/lib/component/utility/formatNumber.d.ts +3 -0
- package/lib/component/utility/formatNumber.js +10 -0
- package/lib/component/utility/getUniqueNuclei.d.ts +1 -0
- package/lib/component/utility/getUniqueNuclei.js +10 -0
- package/lib/component/workspaces/Workspace.d.ts +72 -1
- package/lib/component/workspaces/basic.js +9 -1
- package/lib/component/workspaces/embedded.d.ts +2 -0
- package/lib/component/workspaces/embedded.js +32 -0
- package/lib/component/workspaces/exercise.js +2 -0
- package/lib/component/workspaces/index.d.ts +1 -0
- package/lib/component/workspaces/index.js +2 -1
- package/lib/component/workspaces/prediction.js +2 -0
- package/lib/component/workspaces/process1D.js +2 -0
- package/lib/data/data1d/Data1DManager.js +4 -0
- package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.js +10 -0
- package/lib/data/data1d/Spectrum1D/get1DDataXY.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
- package/lib/data/data1d/database.d.ts +8 -13
- package/lib/data/data1d/database.js +14 -19
- package/lib/data/data1d/filter1d/absolute.d.ts +3 -2
- package/lib/data/data1d/filter1d/autoPhaseCorrection.d.ts +3 -2
- package/lib/data/data1d/filter1d/baselineCorrection.d.ts +3 -2
- package/lib/data/data1d/filter1d/centerMean.d.ts +3 -2
- package/lib/data/data1d/filter1d/digitalFilter.d.ts +3 -2
- package/lib/data/data1d/filter1d/equallySpaced.d.ts +3 -2
- package/lib/data/data1d/filter1d/exclusionZones.js +4 -4
- package/lib/data/data1d/filter1d/fft.d.ts +3 -2
- package/lib/data/data1d/filter1d/fft.js +2 -2
- package/lib/data/data1d/filter1d/fromTo.d.ts +3 -2
- package/lib/data/data1d/filter1d/lineBroadening.d.ts +3 -2
- package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib/data/data1d/filter1d/pareto.d.ts +3 -2
- package/lib/data/data1d/filter1d/pareto.js +2 -2
- package/lib/data/data1d/filter1d/phaseCorrection.d.ts +3 -2
- package/lib/data/data1d/filter1d/shiftX.d.ts +2 -1
- package/lib/data/data1d/filter1d/standardDeviation.d.ts +3 -2
- package/lib/data/data1d/filter1d/zeroFilling.d.ts +3 -2
- package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
- package/lib/data/data2d/Data2DManager.js +4 -0
- package/lib/data/data2d/filter2d/shiftX.d.ts +4 -3
- package/lib/data/data2d/filter2d/shiftX.js +2 -2
- package/lib/data/data2d/filter2d/shiftY.d.ts +4 -3
- package/lib/data/data2d/filter2d/shiftY.js +2 -2
- package/lib/data/molecules/Molecule.d.ts +3 -3
- package/lib/data/molecules/Molecule.js +7 -1
- package/lib/data/molecules/MoleculeManager.d.ts +4 -1
- package/lib/data/molecules/MoleculeManager.js +33 -2
- package/lib/data/types/data1d/Data1D.d.ts +3 -3
- package/lib/data/types/data1d/Info1D.d.ts +1 -0
- package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -2
- package/lib-cjs/component/1d/FooterBanner.js +2 -2
- package/lib-cjs/component/1d/Integral.js +5 -12
- package/lib-cjs/component/1d/IntegralResizable.js +10 -5
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -3
- package/lib-cjs/component/1d/PeakAnnotation.js +5 -4
- package/lib-cjs/component/1d/database/DatabaseElements.js +23 -0
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +60 -0
- package/lib-cjs/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +4 -10
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +10 -5
- package/lib-cjs/component/1d/ranges/Range.js +17 -9
- package/lib-cjs/component/1d/ranges/Ranges.js +6 -3
- package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
- package/lib-cjs/component/2d/Chart2D.js +2 -1
- package/lib-cjs/component/2d/Contours.js +4 -1
- package/lib-cjs/component/2d/FooterBanner.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +10 -4
- package/lib-cjs/component/NMRium.js +5 -2
- package/lib-cjs/component/SplitPaneWrapper.js +12 -0
- package/lib-cjs/component/context/GlobalContext.js +1 -1
- package/lib-cjs/component/context/PreferencesContext.js +1 -1
- package/lib-cjs/component/elements/Button.js +1 -1
- package/lib-cjs/component/elements/ColorInput.js +2 -2
- package/lib-cjs/component/elements/EditableColumn.js +27 -20
- package/lib-cjs/component/elements/Input.js +18 -5
- package/lib-cjs/component/elements/Select.js +20 -14
- package/lib-cjs/component/elements/ToggleButton.js +2 -2
- package/lib-cjs/component/elements/draggble/SVGDraggable.js +39 -0
- package/lib-cjs/component/elements/draggble/useDraggable.js +73 -0
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +10 -7
- package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +2 -2
- package/lib-cjs/component/elements/formik/FormikInput.js +6 -3
- package/lib-cjs/component/elements/formik/FormikSlider.js +6 -3
- package/lib-cjs/component/elements/popup/Alert/Provider.js +1 -1
- package/lib-cjs/component/elements/resizer/DivResizer.js +17 -62
- package/lib-cjs/component/elements/resizer/SVGResizer.js +24 -53
- package/lib-cjs/component/elements/resizer/useResizer.js +71 -0
- package/lib-cjs/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +1 -11
- package/lib-cjs/component/hooks/usePanelPreferences.js +62 -0
- package/lib-cjs/component/loader/DefaultSpinnerComponent.js +2 -2
- package/lib-cjs/component/loader/SpinnerContext.js +2 -2
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +6 -5
- package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
- package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +12 -9
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +80 -0
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +11 -7
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +4 -4
- package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +33 -27
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -11
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +24 -72
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +44 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +9 -1
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +11 -0
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib-cjs/component/panels/Panels.js +2 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -4
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +27 -80
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +18 -48
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +15 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +4 -10
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +53 -64
- package/lib-cjs/component/panels/RangesPanel/RangesTable.js +3 -7
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
- package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +16 -0
- package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/PlotChart.js +21 -0
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +10 -68
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +10 -68
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +55 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +18 -82
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +4 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +72 -39
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +10 -42
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +22 -10
- package/lib-cjs/component/panels/databasePanel/useDatabases.js +14 -0
- package/lib-cjs/component/panels/extra/placeholder/NoTableData.js +2 -2
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +3 -3
- package/lib-cjs/component/panels/extra/preferences/NucleusPreferences.js +29 -0
- package/lib-cjs/component/panels/extra/preferences/PreferencesContainer.js +14 -0
- package/lib-cjs/component/panels/extra/preferences/PreferencesGroup.js +25 -0
- package/lib-cjs/component/reducer/Reducer.js +5 -1
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -2
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +17 -3
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -1
- package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -1
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +26 -0
- package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +67 -0
- package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +24 -0
- package/lib-cjs/component/reducer/preferences/actions/resetPreferences.js +18 -0
- package/lib-cjs/component/reducer/preferences/actions/setPanelsPreferences.js +17 -0
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +38 -0
- package/lib-cjs/component/reducer/preferences/actions/setWorkspace.js +12 -0
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +62 -0
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +87 -0
- package/lib-cjs/component/reducer/preferences/utilites/checkKeysExists.js +18 -0
- package/lib-cjs/component/reducer/preferences/utilites/filterObject.js +11 -0
- package/lib-cjs/component/reducer/preferences/utilites/flatObject.js +13 -0
- package/lib-cjs/component/reducer/preferences/utilites/getActiveWorkspace.js +7 -0
- package/lib-cjs/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +11 -0
- package/lib-cjs/component/reducer/preferences/utilites/mapNucleiFormatting.js +12 -0
- package/lib-cjs/component/reducer/types/Types.js +5 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/ActionsButton.js +13 -0
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +50 -0
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +36 -0
- package/lib-cjs/component/utility/Export.js +6 -0
- package/lib-cjs/component/utility/PathBuilder.js +2 -1
- package/lib-cjs/component/utility/formatNumber.js +17 -0
- package/lib-cjs/component/utility/getUniqueNuclei.js +14 -0
- package/lib-cjs/component/workspaces/basic.js +9 -1
- package/lib-cjs/component/workspaces/embedded.js +35 -0
- package/lib-cjs/component/workspaces/exercise.js +2 -0
- package/lib-cjs/component/workspaces/index.js +2 -1
- package/lib-cjs/component/workspaces/prediction.js +2 -0
- package/lib-cjs/component/workspaces/process1D.js +2 -0
- package/lib-cjs/data/data1d/Data1DManager.js +4 -0
- package/lib-cjs/data/data1d/Spectrum1D/convertDataToFloat64Array.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
- package/lib-cjs/data/data1d/database.js +15 -21
- package/lib-cjs/data/data1d/filter1d/exclusionZones.js +4 -4
- package/lib-cjs/data/data1d/filter1d/fft.js +2 -2
- package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
- package/lib-cjs/data/data1d/filter1d/pareto.js +2 -2
- package/lib-cjs/data/data1d/filter1d/shiftX.js +2 -2
- package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
- package/lib-cjs/data/data2d/Data2DManager.js +4 -0
- package/lib-cjs/data/data2d/filter2d/shiftX.js +4 -4
- package/lib-cjs/data/data2d/filter2d/shiftY.js +4 -4
- package/lib-cjs/data/molecules/Molecule.js +7 -1
- package/lib-cjs/data/molecules/MoleculeManager.js +37 -3
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +42 -40
- package/lib/component/elements/resizer/useDraggable.js +0 -52
- package/lib/component/panels/extra/preferences/defaultValues.d.ts +0 -54
- package/lib/component/panels/extra/preferences/defaultValues.js +0 -54
- package/lib/component/reducer/preferencesReducer.js +0 -269
- package/lib/component/utility/FormatNumber.d.ts +0 -6
- package/lib-cjs/component/elements/resizer/useDraggable.js +0 -55
- package/lib-cjs/component/panels/extra/preferences/defaultValues.js +0 -61
- package/lib-cjs/component/reducer/preferencesReducer.js +0 -276
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.databaseDefaultValues = exports.zoneDefaultValues = exports.getRangeDefaultValues = exports.integralDefaultValues = exports.peaksDefaultValues = void 0;
|
|
4
|
-
const integralDefaultValues = {
|
|
5
|
-
showAbsolute: false,
|
|
6
|
-
absoluteFormat: '0.00',
|
|
7
|
-
showRelative: true,
|
|
8
|
-
relativeFormat: '0.00',
|
|
9
|
-
color: '#000000',
|
|
10
|
-
strokeWidth: 1,
|
|
11
|
-
};
|
|
12
|
-
exports.integralDefaultValues = integralDefaultValues;
|
|
13
|
-
const zoneDefaultValues = {
|
|
14
|
-
showFrom: false,
|
|
15
|
-
fromFormat: '0.00',
|
|
16
|
-
showTo: false,
|
|
17
|
-
toFormat: '0.00',
|
|
18
|
-
showAbsolute: false,
|
|
19
|
-
absoluteFormat: '0.00',
|
|
20
|
-
showRelative: true,
|
|
21
|
-
relativeFormat: '0.00',
|
|
22
|
-
};
|
|
23
|
-
exports.zoneDefaultValues = zoneDefaultValues;
|
|
24
|
-
const getRangeDefaultValues = (nucleus) => ({
|
|
25
|
-
showFrom: false,
|
|
26
|
-
fromFormat: '0.00',
|
|
27
|
-
showTo: false,
|
|
28
|
-
toFormat: '0.00',
|
|
29
|
-
showAbsolute: false,
|
|
30
|
-
absoluteFormat: '0.00',
|
|
31
|
-
showRelative: true,
|
|
32
|
-
relativeFormat: '0.00',
|
|
33
|
-
jGraphTolerance: nucleus === '1H' ? 0.2 : nucleus === '13C' ? 2 : 0, //J Graph tolerance for: 1H: 0.2Hz 13C: 2Hz
|
|
34
|
-
});
|
|
35
|
-
exports.getRangeDefaultValues = getRangeDefaultValues;
|
|
36
|
-
const peaksDefaultValues = {
|
|
37
|
-
showPeakNumber: true,
|
|
38
|
-
peakNumberFormat: '0',
|
|
39
|
-
showPeakIndex: false,
|
|
40
|
-
peakIndexFormat: '0.00',
|
|
41
|
-
showDeltaPPM: true,
|
|
42
|
-
deltaPPMFormat: '0.00',
|
|
43
|
-
showDeltaHz: false,
|
|
44
|
-
deltaHzFormat: '0.00',
|
|
45
|
-
showPeakWidth: false,
|
|
46
|
-
peakWidthFormat: '00.0000',
|
|
47
|
-
showIntensity: true,
|
|
48
|
-
intensityFormat: '0.00',
|
|
49
|
-
};
|
|
50
|
-
exports.peaksDefaultValues = peaksDefaultValues;
|
|
51
|
-
const databaseDefaultValues = {
|
|
52
|
-
showSmiles: true,
|
|
53
|
-
showSolvent: false,
|
|
54
|
-
showNames: true,
|
|
55
|
-
showRange: false,
|
|
56
|
-
showDelta: true,
|
|
57
|
-
showAssignment: false,
|
|
58
|
-
showCoupling: true,
|
|
59
|
-
showMultiplicity: true,
|
|
60
|
-
};
|
|
61
|
-
exports.databaseDefaultValues = databaseDefaultValues;
|
|
@@ -1,276 +0,0 @@
|
|
|
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
|
-
exports.initPreferencesState = exports.preferencesInitialState = exports.WORKSPACES = void 0;
|
|
7
|
-
const immer_1 = require("immer");
|
|
8
|
-
const merge_1 = __importDefault(require("lodash/merge"));
|
|
9
|
-
const generateID_1 = __importDefault(require("../../data/utilities/generateID"));
|
|
10
|
-
const LocalStorage_1 = require("../utility/LocalStorage");
|
|
11
|
-
const workspaces_1 = __importDefault(require("../workspaces"));
|
|
12
|
-
const LOCAL_STORAGE_VERSION = 6;
|
|
13
|
-
exports.WORKSPACES = [
|
|
14
|
-
{
|
|
15
|
-
key: 'default',
|
|
16
|
-
label: workspaces_1.default.default.label,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
key: 'process1D',
|
|
20
|
-
label: workspaces_1.default.process1D.label,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: 'exercise',
|
|
24
|
-
label: workspaces_1.default.exercise.label,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
key: 'prediction',
|
|
28
|
-
label: workspaces_1.default.prediction.label,
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
function getPreferencesByWorkspace(workspace) {
|
|
32
|
-
switch (workspace) {
|
|
33
|
-
case 'exercise':
|
|
34
|
-
return workspaces_1.default.exercise;
|
|
35
|
-
case 'process1D':
|
|
36
|
-
return workspaces_1.default.process1D;
|
|
37
|
-
case 'prediction':
|
|
38
|
-
return workspaces_1.default.prediction;
|
|
39
|
-
case 'default':
|
|
40
|
-
return workspaces_1.default.default;
|
|
41
|
-
default:
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function getActiveWorkspace(draft) {
|
|
46
|
-
return draft.workspaces[draft.workspace.current || 'default'];
|
|
47
|
-
}
|
|
48
|
-
exports.preferencesInitialState = {
|
|
49
|
-
version: LOCAL_STORAGE_VERSION,
|
|
50
|
-
workspaces: {},
|
|
51
|
-
dispatch: () => null,
|
|
52
|
-
workspace: {
|
|
53
|
-
current: 'default',
|
|
54
|
-
base: null,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
function filterObject(data) {
|
|
58
|
-
return JSON.parse(JSON.stringify(data), (key, value) => {
|
|
59
|
-
if (value?.hidden !== true) {
|
|
60
|
-
return value;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function FlatObject(data) {
|
|
65
|
-
let result = {};
|
|
66
|
-
JSON.parse(JSON.stringify(data), (key, value) => {
|
|
67
|
-
if (value?.hidden !== true && key) {
|
|
68
|
-
result[key] = result[key]++ || 1;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
function checkKeysExists(sourceObject, targetObject) {
|
|
74
|
-
const source = FlatObject(sourceObject);
|
|
75
|
-
const target = FlatObject(targetObject);
|
|
76
|
-
if (Object.keys(target).length === 0) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
for (const [key, value] of Object.entries(source)) {
|
|
80
|
-
if (!target[key] || target[key] !== value) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
function mapNucleiFormatting(formatting) {
|
|
87
|
-
const { nuclei, ...res } = formatting;
|
|
88
|
-
const _nuclei = Object.keys(nuclei).reduce((nucleusFormatting, key) => {
|
|
89
|
-
nucleusFormatting[nuclei[key].name.trim().toLowerCase()] = nuclei[key];
|
|
90
|
-
return nucleusFormatting;
|
|
91
|
-
}, {});
|
|
92
|
-
return { nuclei: _nuclei, ...res };
|
|
93
|
-
}
|
|
94
|
-
function initPreferencesState(state) {
|
|
95
|
-
const nmrLocalStorageVersion = (0, LocalStorage_1.getLocalStorage)('nmr-local-storage-version', false);
|
|
96
|
-
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
97
|
-
// remove old nmr-local-storage-version key
|
|
98
|
-
if (nmrLocalStorageVersion && localData?.version) {
|
|
99
|
-
(0, LocalStorage_1.removeData)('nmr-local-storage-version');
|
|
100
|
-
}
|
|
101
|
-
// if the local setting version != current settings version number
|
|
102
|
-
if (!localData?.version || localData?.version !== LOCAL_STORAGE_VERSION) {
|
|
103
|
-
(0, LocalStorage_1.removeData)('nmr-general-settings');
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
...state,
|
|
107
|
-
workspaces: localData?.workspaces || { default: workspaces_1.default.default },
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
exports.initPreferencesState = initPreferencesState;
|
|
111
|
-
function handleInit(draft, action) {
|
|
112
|
-
if (action.payload) {
|
|
113
|
-
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
114
|
-
const { dispatch, workspace, ...resProps } = action.payload;
|
|
115
|
-
/**
|
|
116
|
-
* set the current workspace what the user-defined in the setting if the workspace is not defined at the level of component, otherwise
|
|
117
|
-
* use the default workspace
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
|
-
draft.workspace =
|
|
121
|
-
!workspace && localData?.currentWorkspace
|
|
122
|
-
? { current: localData.currentWorkspace, base: null }
|
|
123
|
-
: { current: workspace || 'default', base: workspace };
|
|
124
|
-
const workspacePreferences = (0, merge_1.default)({}, getPreferencesByWorkspace(draft.workspace.current), resProps);
|
|
125
|
-
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
126
|
-
/**
|
|
127
|
-
* Update the local storage general preferences
|
|
128
|
-
* 1- if local storage is empty.
|
|
129
|
-
* 2- if predefine workspaces.
|
|
130
|
-
* 3- b) if workspace not exists in the local storage
|
|
131
|
-
* c) if the local setting workspace version != current workspace version number
|
|
132
|
-
* d) if hard code workspace parameters != current workspace parameters
|
|
133
|
-
*/
|
|
134
|
-
if ((workspaces_1.default[draft.workspace.current] &&
|
|
135
|
-
(!currentWorkspacePreferences ||
|
|
136
|
-
workspacePreferences?.version !==
|
|
137
|
-
currentWorkspacePreferences?.version ||
|
|
138
|
-
!checkKeysExists(workspacePreferences.display, currentWorkspacePreferences?.display))) ||
|
|
139
|
-
!localData) {
|
|
140
|
-
const { workspaces, version, workspace: { current }, } = draft || {};
|
|
141
|
-
const display = filterObject(workspacePreferences.display);
|
|
142
|
-
const data = {
|
|
143
|
-
version,
|
|
144
|
-
...(localData?.currentWorkspace && {
|
|
145
|
-
currentWorkspace: localData?.currentWorkspace,
|
|
146
|
-
}),
|
|
147
|
-
workspaces: {
|
|
148
|
-
...workspaces,
|
|
149
|
-
[current]: {
|
|
150
|
-
...workspacePreferences,
|
|
151
|
-
display,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
draft.workspaces[current] = (0, merge_1.default)({}, currentWorkspacePreferences, workspacePreferences);
|
|
156
|
-
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(data));
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
currentWorkspacePreferences.display = (0, merge_1.default)({}, workspacePreferences.display, currentWorkspacePreferences.display);
|
|
160
|
-
}
|
|
161
|
-
draft.dispatch = dispatch;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function handleSetPreferences(draft, action) {
|
|
165
|
-
if (action.payload) {
|
|
166
|
-
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
167
|
-
let { controllers, formatting, display } = action.payload;
|
|
168
|
-
formatting = mapNucleiFormatting(formatting);
|
|
169
|
-
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
170
|
-
localData.currentWorkspace = draft.workspace.current;
|
|
171
|
-
localData.workspaces = {
|
|
172
|
-
...localData.workspaces,
|
|
173
|
-
[draft.workspace.current]: {
|
|
174
|
-
...localData.workspaces[draft.workspace.current],
|
|
175
|
-
controllers,
|
|
176
|
-
formatting,
|
|
177
|
-
display,
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
181
|
-
currentWorkspacePreferences.controllers = controllers;
|
|
182
|
-
currentWorkspacePreferences.formatting = formatting;
|
|
183
|
-
currentWorkspacePreferences.display = {
|
|
184
|
-
...currentWorkspacePreferences.display,
|
|
185
|
-
panels: display.panels,
|
|
186
|
-
general: {
|
|
187
|
-
...(currentWorkspacePreferences.display.general || {}),
|
|
188
|
-
experimentalFeatures: display.general.experimentalFeatures,
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function handleSetPanelsPreferences(draft, action) {
|
|
194
|
-
if (action.payload) {
|
|
195
|
-
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
196
|
-
const { key, value } = action.payload;
|
|
197
|
-
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
198
|
-
localData.workspaces[draft.workspace.current].formatting.panels[key] =
|
|
199
|
-
value;
|
|
200
|
-
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
201
|
-
currentWorkspacePreferences.formatting.panels[key] = value;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
function handleResetPreferences(draft) {
|
|
205
|
-
const currentWorkspacePreferences = getActiveWorkspace(draft);
|
|
206
|
-
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
207
|
-
const workSpaceDisplayPreferences = getPreferencesByWorkspace(draft.workspace.current).display;
|
|
208
|
-
if (localData.workspaces[draft.workspace.current]) {
|
|
209
|
-
localData.workspaces[draft.workspace.current].display =
|
|
210
|
-
workSpaceDisplayPreferences;
|
|
211
|
-
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
212
|
-
}
|
|
213
|
-
currentWorkspacePreferences.display = workSpaceDisplayPreferences;
|
|
214
|
-
}
|
|
215
|
-
function handleSetWorkspace(draft, action) {
|
|
216
|
-
const workspaceKey = action.payload.workspace;
|
|
217
|
-
if (!draft.workspaces[workspaceKey]) {
|
|
218
|
-
draft.workspaces[workspaceKey] = getPreferencesByWorkspace(workspaceKey);
|
|
219
|
-
}
|
|
220
|
-
draft.workspace.current = workspaceKey;
|
|
221
|
-
}
|
|
222
|
-
function handleAddWorkspace(draft, action) {
|
|
223
|
-
const { workspace: workspaceName, data: { display, controllers, formatting }, } = action.payload;
|
|
224
|
-
const newWorkSpace = {
|
|
225
|
-
version: 1,
|
|
226
|
-
label: workspaceName,
|
|
227
|
-
display,
|
|
228
|
-
controllers,
|
|
229
|
-
formatting,
|
|
230
|
-
};
|
|
231
|
-
const newWorkspaceKey = (0, generateID_1.default)();
|
|
232
|
-
const localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
233
|
-
localData.workspaces[newWorkspaceKey] = newWorkSpace;
|
|
234
|
-
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
235
|
-
draft.workspaces[newWorkspaceKey] = newWorkSpace;
|
|
236
|
-
draft.workspace.current = newWorkspaceKey;
|
|
237
|
-
}
|
|
238
|
-
function handleRemoveWorkspace(draft, action) {
|
|
239
|
-
const { workspace } = action.payload;
|
|
240
|
-
if (workspace === draft.workspace.current) {
|
|
241
|
-
draft.workspace.current = 'default';
|
|
242
|
-
}
|
|
243
|
-
let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
|
|
244
|
-
const storedWorkspaces = (0, immer_1.original)(draft)?.workspaces || {};
|
|
245
|
-
const workspaces = Object.keys(storedWorkspaces).reduce((acc, key) => {
|
|
246
|
-
if (key !== workspace) {
|
|
247
|
-
acc[key] = storedWorkspaces[key];
|
|
248
|
-
}
|
|
249
|
-
return acc;
|
|
250
|
-
}, {});
|
|
251
|
-
draft.workspaces = workspaces;
|
|
252
|
-
localData.workspaces = filterObject(workspaces);
|
|
253
|
-
(0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
|
|
254
|
-
}
|
|
255
|
-
function innerPreferencesReducer(draft, action) {
|
|
256
|
-
switch (action.type) {
|
|
257
|
-
case 'INIT_PREFERENCES':
|
|
258
|
-
return handleInit(draft, action);
|
|
259
|
-
case 'SET_PREFERENCES':
|
|
260
|
-
return handleSetPreferences(draft, action);
|
|
261
|
-
case 'SET_PANELS_PREFERENCES':
|
|
262
|
-
return handleSetPanelsPreferences(draft, action);
|
|
263
|
-
case 'RESET_PREFERENCES':
|
|
264
|
-
return handleResetPreferences(draft);
|
|
265
|
-
case 'SET_WORKSPACE':
|
|
266
|
-
return handleSetWorkspace(draft, action);
|
|
267
|
-
case 'ADD_WORKSPACE':
|
|
268
|
-
return handleAddWorkspace(draft, action);
|
|
269
|
-
case 'REMOVE_WORKSPACE':
|
|
270
|
-
return handleRemoveWorkspace(draft, action);
|
|
271
|
-
default:
|
|
272
|
-
return draft;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
const preferencesReducer = (0, immer_1.produce)(innerPreferencesReducer);
|
|
276
|
-
exports.default = preferencesReducer;
|