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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { newClipboardItem, read, readText, write, writeText, } from './clipboard';
|
|
3
|
+
export function useNavigatorPermission(now, permissionName, onGranted, onError = reportError) {
|
|
4
|
+
const [state, setState] = useState();
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
if (!now)
|
|
7
|
+
return;
|
|
8
|
+
let canceled = false;
|
|
9
|
+
let status;
|
|
10
|
+
function onPermissionChange() {
|
|
11
|
+
if (canceled)
|
|
12
|
+
return;
|
|
13
|
+
setState(status.state);
|
|
14
|
+
if (status.state === 'granted') {
|
|
15
|
+
onGranted?.();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
void navigator.permissions
|
|
19
|
+
.query({ name: permissionName })
|
|
20
|
+
.then((pStatus) => {
|
|
21
|
+
if (canceled)
|
|
22
|
+
return;
|
|
23
|
+
status = pStatus;
|
|
24
|
+
setState(status.state);
|
|
25
|
+
status.addEventListener('change', onPermissionChange);
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
if (canceled)
|
|
29
|
+
return;
|
|
30
|
+
onError(error);
|
|
31
|
+
});
|
|
32
|
+
return () => {
|
|
33
|
+
canceled = true;
|
|
34
|
+
if (status) {
|
|
35
|
+
status.removeEventListener('change', onPermissionChange);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [now, permissionName, onGranted, onError]);
|
|
39
|
+
return { state, isGranted: state === 'granted' };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Give you a wrapped clipboard api and a shouldFallback state.
|
|
43
|
+
* ignore if read and readText return promise filled with undefined, and rely on shouldFallback to display an alternative interaction.
|
|
44
|
+
* You should use ClipboardFallback component
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* const { readText, shouldFallback, setShouldFallback } = useClipboard();
|
|
49
|
+
*
|
|
50
|
+
* function handlePasteAction() {
|
|
51
|
+
* // yes you can safely ignore error here,
|
|
52
|
+
* // readText() will never throw, error is caught and set shouldFallback to corresponding mode
|
|
53
|
+
* void readText().then(handlePaste);
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* function handlePaste(text: string | undefined) {
|
|
57
|
+
* if (!text) return;
|
|
58
|
+
*
|
|
59
|
+
* setState(text);
|
|
60
|
+
* setShouldFallback(null);
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* return (
|
|
64
|
+
* <>
|
|
65
|
+
* <button onClick={handlePasteAction}>Paste</button>
|
|
66
|
+
* <ClipboardFallbackModal
|
|
67
|
+
* mode={shouldFallback}
|
|
68
|
+
* onDismiss={() => setShouldFallback(null)}
|
|
69
|
+
* onReadText={handlePaste}
|
|
70
|
+
* />
|
|
71
|
+
* </>
|
|
72
|
+
* )
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export function useClipboard() {
|
|
76
|
+
const [shouldFallback, setShouldFallback] = useState();
|
|
77
|
+
const [text, setText] = useState();
|
|
78
|
+
const [blobs, setBlobs] = useState();
|
|
79
|
+
const cleanShouldFallback = useCallback(() => {
|
|
80
|
+
setShouldFallback(undefined);
|
|
81
|
+
setText(undefined);
|
|
82
|
+
setBlobs(undefined);
|
|
83
|
+
}, []);
|
|
84
|
+
const clipboardAPI = useMemo(() => ({
|
|
85
|
+
async read() {
|
|
86
|
+
try {
|
|
87
|
+
return await read();
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
setShouldFallback('read');
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
async readText() {
|
|
94
|
+
try {
|
|
95
|
+
return await readText();
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
setShouldFallback('readText');
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
async write(data) {
|
|
102
|
+
try {
|
|
103
|
+
return await write(data);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
const blobs = await Promise.all(data.map((ci) => ci.getType(ci.types[0])));
|
|
107
|
+
setBlobs(blobs);
|
|
108
|
+
setShouldFallback('write');
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
async rawWriteWithType(data, type = 'text/plain') {
|
|
112
|
+
try {
|
|
113
|
+
const item = await newClipboardItem({
|
|
114
|
+
[type]: new Promise((resolve) => {
|
|
115
|
+
resolve(new Blob([data], { type }));
|
|
116
|
+
}),
|
|
117
|
+
});
|
|
118
|
+
return await write([item]);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
setText(data);
|
|
122
|
+
setShouldFallback('writeText');
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
async writeText(data) {
|
|
126
|
+
try {
|
|
127
|
+
return await writeText(data);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
setText(data);
|
|
131
|
+
setShouldFallback('writeText');
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
}), []);
|
|
135
|
+
return {
|
|
136
|
+
...clipboardAPI,
|
|
137
|
+
shouldFallback,
|
|
138
|
+
text,
|
|
139
|
+
blobs,
|
|
140
|
+
cleanShouldFallback,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ClipboardMode = 'read' | 'readText' | 'write' | 'writeText';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.41.0' };
|
|
@@ -81,8 +81,8 @@ const styles = (0, react_1.css) `
|
|
|
81
81
|
}
|
|
82
82
|
`;
|
|
83
83
|
function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, activeTab, }) {
|
|
84
|
-
|
|
85
|
-
const { startX, endX, step } = (0, BrushTracker_1.useBrushTracker)();
|
|
84
|
+
const position = (0, MouseTracker_1.useMouseTracker)();
|
|
85
|
+
const { startX, endX, step, mouseButton } = (0, BrushTracker_1.useBrushTracker)();
|
|
86
86
|
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
87
87
|
const format = (0, useFormatNumberByNucleus_1.useFormatNumberByNucleus)(activeTab);
|
|
88
88
|
if (!position ||
|
|
@@ -107,8 +107,9 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
|
|
|
107
107
|
}
|
|
108
108
|
return 1;
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const isBrushing = step === 'brushing' && mouseButton === 'main';
|
|
111
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsx)(bs_1.BsCursor, {}), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \uD835\uDEC5: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: format(scaleX().invert(position.x)) }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "ppm" }), activeSpectrum && spectrum?.info?.originFrequency && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("span", { className: "value", children: ["\u00A0(", format(scaleX().invert(position.x) * spectrum?.info?.originFrequency, 'hz')] }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "Hz" }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: ") " }), (0, jsx_runtime_1.jsxs)("span", { className: "small-width-none", children: [(0, jsx_runtime_1.jsx)("span", { children: "," }), (0, jsx_runtime_1.jsx)("span", { className: "label", children: " Index: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: getXIndex(position.x) })] })] }))] }), isBrushing && ((0, jsx_runtime_1.jsxs)("div", { className: "flex-row small-width-none", children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394ppm: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: (scaleX().invert(startX) - scaleX().invert(endX)).toPrecision(6) })] })), activeSpectrum && ((0, jsx_runtime_1.jsxs)("div", { className: " flex-row small-width-none", children: [spectrum?.info?.originFrequency && isBrushing && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394Hz: " }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: ((scaleX().invert(startX) - scaleX().invert(endX)) *
|
|
112
|
+
spectrum?.info?.originFrequency).toPrecision(5) })] })), isBrushing && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " ratio :" }), (0, jsx_runtime_1.jsxs)("span", { className: "value", children: [((getYValue(startX) / (getYValue(endX) || Number.MIN_VALUE)) *
|
|
112
113
|
100).toFixed(2), "%"] })] }))] })), activeSpectrum && ((0, jsx_runtime_1.jsxs)("div", { className: "flex-row small-width-none", children: [(0, jsx_runtime_1.jsx)("div", { className: "separator" }), (0, jsx_runtime_1.jsx)(io5_1.IoPulseSharp, {}), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Intensity: " }), (0, jsx_runtime_1.jsx)("span", { className: "value y-value", children: format(getYValue(position.x)) })] })] }))] }));
|
|
113
114
|
}
|
|
114
115
|
const MemoizedFooterBanner = (0, react_2.memo)(FooterBannerInner);
|
|
@@ -56,9 +56,11 @@ const FooterBanner_1 = __importDefault(require("./FooterBanner"));
|
|
|
56
56
|
const PeakPointer_1 = __importDefault(require("./tool/PeakPointer"));
|
|
57
57
|
const VerticalIndicator_1 = __importDefault(require("./tool/VerticalIndicator"));
|
|
58
58
|
const XLabelPointer_1 = __importDefault(require("./tool/XLabelPointer"));
|
|
59
|
+
const scale_1 = require("./utilities/scale");
|
|
59
60
|
function Viewer1D({ emptyText = undefined }) {
|
|
60
61
|
const state = (0, ChartContext_1.useChartData)();
|
|
61
62
|
const { toolOptions: { selectedTool }, isLoading, data, mode, width: widthProp, height: heightProp, margin, xDomain, xDomains, yDomain, yDomains, displayerKey, view: { spectra: { activeTab }, }, } = state;
|
|
63
|
+
const brushStartRef = (0, react_1.useRef)(null);
|
|
62
64
|
const verticalAlign = (0, useVerticalAlign_1.useVerticalAlign)();
|
|
63
65
|
const activeSpectrum = (0, useActiveSpectrum_1.useActiveSpectrum)();
|
|
64
66
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
@@ -94,123 +96,138 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
94
96
|
yDomain,
|
|
95
97
|
yDomains,
|
|
96
98
|
]);
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const endXPPM = scaleState.scaleX().invert(endX);
|
|
104
|
-
Events_1.default.emit('brushEnd', {
|
|
105
|
-
...brushData,
|
|
106
|
-
range: [startXPPM, endXPPM].sort((a, b) => a - b),
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
if (brushData.altKey) {
|
|
110
|
-
switch (selectedTool) {
|
|
111
|
-
case ToolTypes_1.options.rangePicking.id: {
|
|
112
|
-
modal.show((0, jsx_runtime_1.jsx)(MultipletAnalysisModal_1.default, { data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }), {
|
|
113
|
-
onClose: () => {
|
|
114
|
-
modal.close();
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
default:
|
|
120
|
-
break;
|
|
99
|
+
function handelBrush(brushData) {
|
|
100
|
+
const { startX: startXInPixel, endX: endXInPixel, mouseButton } = brushData;
|
|
101
|
+
if (mouseButton === 'secondary') {
|
|
102
|
+
const scaleX = (0, scale_1.getXScale)(state);
|
|
103
|
+
if (!brushStartRef.current) {
|
|
104
|
+
brushStartRef.current = scaleX.invert(startXInPixel);
|
|
121
105
|
}
|
|
106
|
+
const shiftX = scaleX.invert(endXInPixel) - brushStartRef.current;
|
|
107
|
+
dispatch({ type: 'MOVE', payload: { shiftX, shiftY: 0 } });
|
|
122
108
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
109
|
+
}
|
|
110
|
+
const handelBrushEnd = (0, react_1.useCallback)((brushData) => {
|
|
111
|
+
//reset the brush start
|
|
112
|
+
brushStartRef.current = null;
|
|
113
|
+
if (brushData.mouseButton === 'main') {
|
|
114
|
+
const propagateEvent = () => {
|
|
115
|
+
if (!scaleState.scaleX || !scaleState.scaleY)
|
|
116
|
+
return;
|
|
117
|
+
const { startX, endX } = brushData;
|
|
118
|
+
const startXPPM = scaleState.scaleX().invert(startX);
|
|
119
|
+
const endXPPM = scaleState.scaleX().invert(endX);
|
|
120
|
+
Events_1.default.emit('brushEnd', {
|
|
121
|
+
...brushData,
|
|
122
|
+
range: [startXPPM, endXPPM].sort((a, b) => a - b),
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
if (brushData.altKey) {
|
|
126
|
+
switch (selectedTool) {
|
|
127
|
+
case ToolTypes_1.options.rangePicking.id: {
|
|
128
|
+
modal.show((0, jsx_runtime_1.jsx)(MultipletAnalysisModal_1.default, { data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }), {
|
|
129
|
+
onClose: () => {
|
|
130
|
+
modal.close();
|
|
131
|
+
},
|
|
132
|
+
});
|
|
137
133
|
break;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
}
|
|
135
|
+
default:
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (brushData.shiftKey) {
|
|
140
|
+
switch (selectedTool) {
|
|
141
|
+
case ToolTypes_1.options.integral.id:
|
|
141
142
|
dispatch({
|
|
142
|
-
type: '
|
|
143
|
+
type: 'ADD_INTEGRAL',
|
|
143
144
|
payload: brushData,
|
|
144
145
|
});
|
|
146
|
+
break;
|
|
147
|
+
case ToolTypes_1.options.rangePicking.id: {
|
|
148
|
+
const [from, to] = (0, getRange_1.default)(state, {
|
|
149
|
+
startX: brushData.startX,
|
|
150
|
+
endX: brushData.endX,
|
|
151
|
+
});
|
|
152
|
+
if (!activeSpectrum)
|
|
153
|
+
break;
|
|
154
|
+
const { data: { x }, } = data[activeSpectrum.index];
|
|
155
|
+
const { fromIndex, toIndex } = (0, ml_spectra_processing_1.xGetFromToIndex)(x, { from, to });
|
|
156
|
+
if (toIndex - fromIndex <= detectSignal_1.MAX_LENGTH) {
|
|
157
|
+
dispatch({
|
|
158
|
+
type: 'ADD_RANGE',
|
|
159
|
+
payload: brushData,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
alert.error(`Advanced peak picking only available for area up to ${detectSignal_1.MAX_LENGTH} points`);
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
145
166
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
167
|
+
case ToolTypes_1.options.multipleSpectraAnalysis.id:
|
|
168
|
+
if (scaleState.scaleX) {
|
|
169
|
+
const { startX, endX } = brushData;
|
|
170
|
+
const start = scaleState.scaleX().invert(startX);
|
|
171
|
+
const end = scaleState.scaleX().invert(endX);
|
|
172
|
+
dispatchPreferences({
|
|
173
|
+
type: 'ANALYZE_SPECTRA',
|
|
174
|
+
payload: {
|
|
175
|
+
start,
|
|
176
|
+
end,
|
|
177
|
+
nucleus: activeTab,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
case ToolTypes_1.options.peakPicking.id:
|
|
183
|
+
dispatch({
|
|
184
|
+
type: 'ADD_PEAKS',
|
|
185
|
+
payload: brushData,
|
|
186
|
+
});
|
|
187
|
+
break;
|
|
188
|
+
case ToolTypes_1.options.baselineCorrection.id:
|
|
189
|
+
dispatch({
|
|
190
|
+
type: 'ADD_BASE_LINE_ZONE',
|
|
191
|
+
payload: {
|
|
192
|
+
startX: brushData.startX,
|
|
193
|
+
endX: brushData.endX,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
break;
|
|
197
|
+
case ToolTypes_1.options.exclusionZones.id:
|
|
198
|
+
dispatch({
|
|
199
|
+
type: 'ADD_EXCLUSION_ZONE',
|
|
200
|
+
payload: { startX: brushData.startX, endX: brushData.endX },
|
|
201
|
+
});
|
|
202
|
+
break;
|
|
203
|
+
case ToolTypes_1.options.matrixGenerationExclusionZones.id: {
|
|
204
|
+
const [from, to] = (0, getRange_1.default)(state, {
|
|
205
|
+
startX: brushData.startX,
|
|
206
|
+
endX: brushData.endX,
|
|
207
|
+
});
|
|
156
208
|
dispatchPreferences({
|
|
157
|
-
type: '
|
|
209
|
+
type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
158
210
|
payload: {
|
|
159
|
-
|
|
160
|
-
end,
|
|
211
|
+
zone: { from, to },
|
|
161
212
|
nucleus: activeTab,
|
|
213
|
+
range: { from: xDomain[0], to: xDomain[1] },
|
|
162
214
|
},
|
|
163
215
|
});
|
|
216
|
+
break;
|
|
164
217
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
type: 'ADD_PEAKS',
|
|
169
|
-
payload: brushData,
|
|
170
|
-
});
|
|
171
|
-
break;
|
|
172
|
-
case ToolTypes_1.options.baselineCorrection.id:
|
|
173
|
-
dispatch({
|
|
174
|
-
type: 'ADD_BASE_LINE_ZONE',
|
|
175
|
-
payload: {
|
|
176
|
-
startX: brushData.startX,
|
|
177
|
-
endX: brushData.endX,
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
break;
|
|
181
|
-
case ToolTypes_1.options.exclusionZones.id:
|
|
182
|
-
dispatch({
|
|
183
|
-
type: 'ADD_EXCLUSION_ZONE',
|
|
184
|
-
payload: { startX: brushData.startX, endX: brushData.endX },
|
|
185
|
-
});
|
|
186
|
-
break;
|
|
187
|
-
case ToolTypes_1.options.matrixGenerationExclusionZones.id: {
|
|
188
|
-
const [from, to] = (0, getRange_1.default)(state, {
|
|
189
|
-
startX: brushData.startX,
|
|
190
|
-
endX: brushData.endX,
|
|
191
|
-
});
|
|
192
|
-
dispatchPreferences({
|
|
193
|
-
type: 'ADD_MATRIX_GENERATION_EXCLUSION_ZONE',
|
|
194
|
-
payload: {
|
|
195
|
-
zone: { from, to },
|
|
196
|
-
nucleus: activeTab,
|
|
197
|
-
range: { from: xDomain[0], to: xDomain[1] },
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
break;
|
|
218
|
+
default:
|
|
219
|
+
propagateEvent();
|
|
220
|
+
break;
|
|
201
221
|
}
|
|
202
|
-
default:
|
|
203
|
-
propagateEvent();
|
|
204
|
-
break;
|
|
205
222
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
223
|
+
else {
|
|
224
|
+
switch (selectedTool) {
|
|
225
|
+
default:
|
|
226
|
+
if (selectedTool != null) {
|
|
227
|
+
dispatch({ type: 'BRUSH_END', payload: brushData });
|
|
228
|
+
}
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
214
231
|
}
|
|
215
232
|
}
|
|
216
233
|
}, [
|
|
@@ -277,7 +294,7 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
277
294
|
return ((0, jsx_runtime_1.jsx)(ScaleContext_1.ScaleProvider, { value: scaleState, children: (0, jsx_runtime_1.jsx)(react_d3_utils_1.ResponsiveChart, { children: ({ height, width }) => ((0, jsx_runtime_1.jsx)(Viewer2D_1.ViewerResponsiveWrapper, { height: height, width: width, children: (0, jsx_runtime_1.jsxs)("div", { style: { height: '100%', position: 'relative' }, children: [(0, jsx_runtime_1.jsx)(Spinner_1.default, { isLoading: isLoading, emptyText: emptyText }), scaleState.scaleX &&
|
|
278
295
|
scaleState.scaleY &&
|
|
279
296
|
data &&
|
|
280
|
-
data.length > 0 && ((0, jsx_runtime_1.jsx)(BrushTracker_1.BrushTracker, { onBrush: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
|
|
297
|
+
data.length > 0 && ((0, jsx_runtime_1.jsx)(BrushTracker_1.BrushTracker, { onBrush: handelBrush, onBrushEnd: handelBrushEnd, onDoubleClick: handelOnDoubleClick, onClick: mouseClick, onZoom: handleZoom, style: {
|
|
281
298
|
width: '100%',
|
|
282
299
|
height: '100%',
|
|
283
300
|
margin: 'auto',
|
|
@@ -29,7 +29,7 @@ function ResurrectedDatabaseRanges() {
|
|
|
29
29
|
const blockHight = fullHeight / 4;
|
|
30
30
|
const translateY = fullHeight - blockHight - marginBottom;
|
|
31
31
|
const { ranges = [] } = highlight.sourceData.extra || {};
|
|
32
|
-
|
|
32
|
+
const yDomain = [0, 0];
|
|
33
33
|
const spectra = ranges.map((range) => {
|
|
34
34
|
const { from, to } = range;
|
|
35
35
|
const diff = Math.abs(from - to) / 2;
|
|
@@ -12,7 +12,7 @@ function JsCouplingLinks(props) {
|
|
|
12
12
|
if (!scaleY)
|
|
13
13
|
return '';
|
|
14
14
|
const { from, to, couplings } = link;
|
|
15
|
-
|
|
15
|
+
const paths = [];
|
|
16
16
|
for (const coupling of couplings) {
|
|
17
17
|
paths.push(`M${scaleX()(from)},${scaleY(coupling.coupling)} L${scaleX()(to)},${scaleY(coupling.coupling)}`);
|
|
18
18
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TREE_LEVEL_COLORS = void 0;
|
|
4
|
-
exports.TREE_LEVEL_COLORS = [
|
|
5
|
-
'red',
|
|
6
|
-
'green',
|
|
7
|
-
'blue',
|
|
8
|
-
'magenta',
|
|
9
|
-
];
|
|
4
|
+
exports.TREE_LEVEL_COLORS = ['red', 'green', 'blue', 'magenta'];
|
|
@@ -31,13 +31,16 @@ const styles = (0, react_1.css) `
|
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
function BaseLineZones() {
|
|
34
|
-
const { toolOptions } = (0, ChartContext_1.useChartData)();
|
|
34
|
+
const { toolOptions: { selectedTool, data: { baselineCorrection }, }, } = (0, ChartContext_1.useChartData)();
|
|
35
35
|
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
36
36
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
37
37
|
const deleteRangeHandler = (id) => {
|
|
38
38
|
dispatch({ type: 'DELETE_BASE_LINE_ZONE', payload: { id } });
|
|
39
39
|
};
|
|
40
|
-
const baseLineZones =
|
|
41
|
-
|
|
40
|
+
const baseLineZones = baselineCorrection.zones;
|
|
41
|
+
if (selectedTool !== 'baselineCorrection' || baseLineZones.length === 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)("g", { children: baselineCorrection.zones.map((zone) => ((0, jsx_runtime_1.jsxs)("g", { transform: `translate(${scaleX()(zone.to)},0)`, css: styles, children: [(0, jsx_runtime_1.jsx)(DeleteButton_1.default, { x: -20, y: 10, onDelete: () => deleteRangeHandler(zone.id) }), (0, jsx_runtime_1.jsx)("rect", { x: "0", width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, className: "zone-area" })] }, zone.id))) }));
|
|
42
45
|
}
|
|
43
46
|
exports.default = BaseLineZones;
|
|
@@ -24,7 +24,7 @@ function PeakPointer() {
|
|
|
24
24
|
const { height, width, margin, data, mode, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
|
|
25
25
|
const { scaleX, scaleY, shiftY } = (0, ScaleContext_1.useScaleChecked)();
|
|
26
26
|
const activeSpectrum = (0, useActiveSpectrum_1.useActiveSpectrum)();
|
|
27
|
-
|
|
27
|
+
const position = (0, MouseTracker_1.useMouseTracker)();
|
|
28
28
|
const brushState = (0, BrushTracker_1.useBrushTracker)();
|
|
29
29
|
const [closePeakPosition, setPosition] = (0, react_1.useState)();
|
|
30
30
|
(0, react_1.useEffect)(() => {
|
|
@@ -28,9 +28,7 @@ exports.getYScale = getYScale;
|
|
|
28
28
|
function getIntegralYScale(state) {
|
|
29
29
|
const { height, margin, verticalAlign, integralsYDomains, activeSpectrum } = state;
|
|
30
30
|
const _height = verticalAlign === 'center' ? height / 2 : height;
|
|
31
|
-
return (0, d3_1.scaleLinear)(activeSpectrum?.id &&
|
|
32
|
-
integralsYDomains &&
|
|
33
|
-
integralsYDomains[activeSpectrum?.id]
|
|
31
|
+
return (0, d3_1.scaleLinear)(activeSpectrum?.id && integralsYDomains?.[activeSpectrum?.id]
|
|
34
32
|
? integralsYDomains[activeSpectrum?.id]
|
|
35
33
|
: [0, 0], [_height * 0.3, margin.top + _height * 0.1]);
|
|
36
34
|
}
|
|
@@ -41,10 +41,13 @@ const defaultDimensionBorder = {
|
|
|
41
41
|
startY: 0,
|
|
42
42
|
};
|
|
43
43
|
function BrushXY({ brushType = exports.BRUSH_TYPE.XY, dimensionBorder = defaultDimensionBorder, width: widthProps, height: heightProps, }) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const { width, height, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
|
|
45
|
+
const brushTracker = (0, BrushTracker_1.useBrushTracker)();
|
|
46
|
+
const { step, mouseButton } = brushTracker;
|
|
47
|
+
let { startX, endX, startY, endY } = brushTracker;
|
|
46
48
|
if (!allowTools.has(selectedTool) ||
|
|
47
49
|
step !== 'brushing' ||
|
|
50
|
+
mouseButton !== 'main' ||
|
|
48
51
|
!dimensionBorder ||
|
|
49
52
|
(dimensionBorder.startX && startX < dimensionBorder.startX) ||
|
|
50
53
|
(dimensionBorder.startY && startY < dimensionBorder.startY) ||
|
|
@@ -58,8 +61,8 @@ function BrushXY({ brushType = exports.BRUSH_TYPE.XY, dimensionBorder = defaultD
|
|
|
58
61
|
: endY < dimensionBorder.startY))) {
|
|
59
62
|
return null;
|
|
60
63
|
}
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
const finalWidth = widthProps || width;
|
|
65
|
+
const finalHeight = heightProps || height;
|
|
63
66
|
endX =
|
|
64
67
|
dimensionBorder.endX && endX > dimensionBorder.endX
|
|
65
68
|
? dimensionBorder.endX
|
|
@@ -73,12 +76,12 @@ function BrushXY({ brushType = exports.BRUSH_TYPE.XY, dimensionBorder = defaultD
|
|
|
73
76
|
? dimensionBorder.startY
|
|
74
77
|
: endY;
|
|
75
78
|
const scaleX = brushType === exports.BRUSH_TYPE.X || brushType === exports.BRUSH_TYPE.XY
|
|
76
|
-
? (endX - startX) /
|
|
79
|
+
? (endX - startX) / finalWidth
|
|
77
80
|
: 1;
|
|
78
81
|
startX =
|
|
79
82
|
brushType === exports.BRUSH_TYPE.X || brushType === exports.BRUSH_TYPE.XY ? startX : 0;
|
|
80
83
|
const scaleY = brushType === exports.BRUSH_TYPE.Y || brushType === exports.BRUSH_TYPE.XY
|
|
81
|
-
? (endY - startY) /
|
|
84
|
+
? (endY - startY) / finalHeight
|
|
82
85
|
: 1;
|
|
83
86
|
startY =
|
|
84
87
|
brushType === exports.BRUSH_TYPE.Y || brushType === exports.BRUSH_TYPE.XY ? startY : 0;
|
|
@@ -86,6 +89,6 @@ function BrushXY({ brushType = exports.BRUSH_TYPE.XY, dimensionBorder = defaultD
|
|
|
86
89
|
...styles.container,
|
|
87
90
|
transform: `translate(${startX}px, ${startY}px) scale(${scaleX},${scaleY})`,
|
|
88
91
|
willChange: 'transform',
|
|
89
|
-
}, children: (0, jsx_runtime_1.jsx)("svg", { width:
|
|
92
|
+
}, children: (0, jsx_runtime_1.jsx)("svg", { width: finalWidth, height: finalHeight, children: (0, jsx_runtime_1.jsx)("rect", { x: "0", y: "0", width: finalWidth, height: finalHeight, fill: "gray", opacity: "0.2" }) }) }));
|
|
90
93
|
}
|
|
91
94
|
exports.default = BrushXY;
|
|
@@ -31,7 +31,7 @@ const allowTools = new Set([
|
|
|
31
31
|
]);
|
|
32
32
|
function CrossLinePointer() {
|
|
33
33
|
const { height, width, margin, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
|
|
34
|
-
|
|
34
|
+
const position = (0, MouseTracker_1.useMouseTracker)();
|
|
35
35
|
const brushState = (0, BrushTracker_1.useBrushTracker)();
|
|
36
36
|
if (!allowTools.has(selectedTool) ||
|
|
37
37
|
brushState.step === 'brushing' ||
|
|
@@ -58,7 +58,7 @@ const styles = (0, react_1.css) `
|
|
|
58
58
|
`;
|
|
59
59
|
function FooterBanner({ layout, data1D }) {
|
|
60
60
|
const position = (0, MouseTracker_1.useMouseTracker)();
|
|
61
|
-
const { startX, endX, startY, endY, step } = (0, BrushTracker_1.useBrushTracker)();
|
|
61
|
+
const { startX, endX, startY, endY, step, mouseButton } = (0, BrushTracker_1.useBrushTracker)();
|
|
62
62
|
const { margin, width, height, xDomain, yDomain, yDomains, view: { spectra: { activeTab }, }, data, toolOptions: { selectedTool }, } = (0, ChartContext_1.useChartData)();
|
|
63
63
|
const activeSpectrum = (0, useActiveSpectrum_1.useActiveSpectrum)();
|
|
64
64
|
const trackID = position &&
|
|
@@ -214,6 +214,7 @@ function FooterBanner({ layout, data1D }) {
|
|
|
214
214
|
}
|
|
215
215
|
return 0;
|
|
216
216
|
};
|
|
217
|
-
|
|
217
|
+
const isBrushing = step === 'brushing' && mouseButton === 'main';
|
|
218
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: styles, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("span", { className: "label", children: [getLabel('F2', 'X', nuclei[0]), " :"] }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: formatX(getXValue()) }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "ppm" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("span", { className: "label", children: [getLabel('F1', 'Y', nuclei[1]), " :"] }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: formatY(getYValue()) }), (0, jsx_runtime_1.jsx)("span", { className: "unit", children: "ppm" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "small-width-none", children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Intensity :" }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: getZValue() })] }), isBrushing && ((0, jsx_runtime_1.jsxs)("div", { className: "small-width-none", children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " \u0394ppm :" }), (0, jsx_runtime_1.jsx)("span", { className: "value", children: getDeltaX() })] })), isBrushing && ((0, jsx_runtime_1.jsxs)("div", { className: "small-width-none", children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: " ratio :" }), (0, jsx_runtime_1.jsxs)("span", { className: "value", children: [getRation(), "%"] })] }))] }));
|
|
218
219
|
}
|
|
219
220
|
exports.default = FooterBanner;
|