nmrium 0.50.0 → 0.51.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/README.md +7 -7
- package/lib/component/1d/Chart1D.js +1 -1
- package/lib/component/1d/LinesSeries.js +2 -2
- package/lib/component/1d/Viewer1D.js +6 -11
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
- package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
- package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
- package/lib/component/2d/Viewer2D.js +16 -15
- package/lib/component/2d/ft/Contours.js +6 -3
- package/lib/component/2d/utilities/scale.d.ts +2 -1
- package/lib/component/2d/utilities/scale.js +12 -2
- package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +29 -15
- package/lib/component/context/ToasterContext.d.ts +13 -0
- package/lib/component/context/ToasterContext.js +34 -0
- package/lib/component/elements/CloseButton.d.ts +2 -2
- package/lib/component/elements/CloseButton.js +1 -1
- package/lib/component/elements/CounterLabel.d.ts +3 -3
- package/lib/component/elements/CounterLabel.js +3 -3
- package/lib/component/elements/PreferencesButton.d.ts +2 -2
- package/lib/component/elements/PreferencesButton.js +2 -4
- package/lib/component/elements/SaveButton.d.ts +2 -2
- package/lib/component/elements/SaveButton.js +1 -1
- package/lib/component/elements/Select.js +2 -2
- package/lib/component/elements/ToolBarButton.d.ts +1 -8
- package/lib/component/elements/ToolBarButton.js +2 -11
- package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
- package/lib/component/elements/ToolbarPopoverItem.js +10 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
- package/lib/component/header/Header.d.ts +1 -11
- package/lib/component/header/Header.js +5 -6
- package/lib/component/header/PhaseCorrectionPanel.js +24 -33
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
- package/lib/component/header/RangesPickingOptionPanel.js +6 -3
- package/lib/component/hooks/useDialogToggle.d.ts +5 -0
- package/lib/component/hooks/useDialogToggle.js +16 -0
- package/lib/component/hooks/useExport.d.ts +9 -1
- package/lib/component/hooks/useExport.js +34 -36
- package/lib/component/hooks/useSaveSettings.js +6 -3
- package/lib/component/hooks/useToolsFunctions.js +6 -4
- package/lib/component/loader/DropZone.js +14 -14
- package/lib/component/main/InnerNMRium.js +5 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
- package/lib/component/main/InnerNMRiumContents.js +5 -3
- package/lib/component/main/NMRium.js +2 -2
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ExportAsJcampModal.js +15 -15
- package/lib/component/modal/ImportPublicationStringModal.js +5 -3
- package/lib/component/modal/LoadJCAMPModal.js +6 -4
- package/lib/component/modal/PredictSpectraModal.js +11 -9
- package/lib/component/modal/SaveAsModal.d.ts +3 -4
- package/lib/component/modal/SaveAsModal.js +27 -27
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +2 -2
- package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
- package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
- package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
- package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
- package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
- package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
- package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
- package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
- package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +7 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +48 -14
- package/lib/component/panels/RangesPanel/RangesHeader.js +73 -13
- package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +49 -8
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
- package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
- package/lib/component/panels/filtersPanel/FilterPanel.js +6 -4
- package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
- package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +36 -7
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
- package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
- package/lib/component/reducer/Reducer.d.ts +2 -2
- package/lib/component/reducer/Reducer.js +23 -16
- package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
- package/lib/component/reducer/actions/FiltersActions.js +243 -91
- package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -2
- package/lib/component/reducer/actions/MoleculeActions.js +0 -1
- package/lib/component/reducer/actions/RangesActions.js +16 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
- package/lib/component/reducer/actions/ToolsActions.js +75 -14
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
- package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
- package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
- package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
- package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
- package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
- package/lib/component/toolbar/ToolBar.js +241 -8
- package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
- package/lib/component/toolbar/toolbarMenu.js +77 -0
- package/lib/component/utility/Events.d.ts +11 -0
- package/lib/component/utility/Events.js +22 -0
- package/lib/component/utility/booleanToString.d.ts +6 -0
- package/lib/component/utility/booleanToString.js +4 -0
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
- package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
- package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +3 -3
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
- package/lib/data/getDefaultMatrixFilters.js +2 -2
- package/lib/data/matrixGeneration.js +1 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
- package/lib/versionInfo.js +1 -1
- package/package.json +31 -30
- package/lib/component/elements/DeleteButton.d.ts +0 -6
- package/lib/component/elements/DeleteButton.js +0 -8
- package/lib/component/elements/DropdownMenu.d.ts +0 -9
- package/lib/component/elements/DropdownMenu.js +0 -7
- package/lib/component/elements/FilterButton.d.ts +0 -6
- package/lib/component/elements/FilterButton.js +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
- package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
- package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
- package/lib/component/elements/popup/Alert/Context.js +0 -10
- package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
- package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
- package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
- package/lib/component/elements/popup/Alert/Provider.js +0 -127
- package/lib/component/elements/popup/Alert/index.d.ts +0 -3
- package/lib/component/elements/popup/Alert/index.js +0 -3
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
- package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
- package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
- package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
- package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
- package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
- package/lib/component/modal/metaImportation/index.d.ts +0 -2
- package/lib/component/modal/metaImportation/index.js +0 -17
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
- package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
- package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
- package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
- package/lib/component/toolbar/BasicToolBar.js +0 -165
- package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
- package/lib/component/toolbar/FunctionToolBar.js +0 -148
|
@@ -90,5 +90,5 @@ export default function SetMolecularFormulaModal({ onClose, onSave, molecules, p
|
|
|
90
90
|
const onChangeHandlerMoleculeSelection = useCallback((index) => {
|
|
91
91
|
setCurrentIndex(index);
|
|
92
92
|
}, []);
|
|
93
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsx("div", { className: "header handle", children: _jsx(CloseButton, { onClick: onClose }) }), _jsx("div", { children: _jsx("p", { className: "info", children: "Please type in a molecular formula!" }) }), _jsx(MolecularFormulaInput, { onSave: onSaveHandlerMolecularFormulaInput, previousMF: previousMF }), _jsxs("div", { children: [_jsx("p", { className: "optional", children: "OR" }), _jsx("p", { className: "optional2", children: "Select a molecule as reference!" })] }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx("button", { type: "button", onClick: onSaveHandlerMoleculeSelection, children: "Set" })] }));
|
|
93
|
+
return (_jsxs("div", { css: modalContainer, children: [_jsx("div", { className: "header handle", children: _jsx(CloseButton, { title: "Close", onClick: onClose }) }), _jsx("div", { children: _jsx("p", { className: "info", children: "Please type in a molecular formula!" }) }), _jsx(MolecularFormulaInput, { onSave: onSaveHandlerMolecularFormulaInput, previousMF: previousMF }), _jsxs("div", { children: [_jsx("p", { className: "optional", children: "OR" }), _jsx("p", { className: "optional2", children: "Select a molecule as reference!" })] }), _jsx(MoleculeSelection, { molecules: molecules, onChange: onChangeHandlerMoleculeSelection }), _jsx("button", { type: "button", onClick: onSaveHandlerMoleculeSelection, children: "Set" })] }));
|
|
94
94
|
}
|
|
@@ -95,7 +95,7 @@ export default function SetShiftToleranceModal({ onClose, onSave, previousTolera
|
|
|
95
95
|
setIsValid({ ...isValid, [atomType]: false });
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Set Shift Tolerances" }), _jsx(CloseButton, { onClick: onClose })] }), _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Atom" }), _jsx("th", { children: "Value" })] }) }), _jsx("tbody", { children: _jsx(Rows, { onChange: onChangeHandler, isValid: isValid, tolerance: tolerance }) })] }), _jsx("button", { type: "button", onClick: onSaveHandler, disabled: Object.keys(isValid).some((atomType) => !isValid[atomType]), children: "Set" })] }));
|
|
98
|
+
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx("span", { children: "Set Shift Tolerances" }), _jsx(CloseButton, { title: "Close", onClick: onClose })] }), _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Atom" }), _jsx("th", { children: "Value" })] }) }), _jsx("tbody", { children: _jsx(Rows, { onChange: onChangeHandler, isValid: isValid, tolerance: tolerance }) })] }), _jsx("button", { type: "button", onClick: onSaveHandler, disabled: Object.keys(isValid).some((atomType) => !isValid[atomType]), children: "Set" })] }));
|
|
99
99
|
}
|
|
100
100
|
function Rows({ tolerance, onChange, isValid }) {
|
|
101
101
|
return Object.keys(tolerance).map((atomType) => {
|
|
@@ -4,14 +4,13 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { getLinkDelta, getLinkDim, } from 'nmr-correlation';
|
|
5
5
|
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
6
|
import { FaFlask, FaSlidersH } from 'react-icons/fa';
|
|
7
|
-
import { Toolbar } from 'react-science/ui';
|
|
8
7
|
import { findRange, findSignal1D, findSignal2D, findSpectrum, findZone, } from '../../../data/utilities/FindUtilities';
|
|
9
8
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
10
9
|
import { useChartData } from '../../context/ChartContext';
|
|
11
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
12
11
|
import Select from '../../elements/Select';
|
|
13
12
|
import { useModal } from '../../elements/popup/Modal';
|
|
14
|
-
import DefaultPanelHeader
|
|
13
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
15
14
|
import CorrelationTable from './CorrelationTable/CorrelationTable';
|
|
16
15
|
import Overview from './Overview';
|
|
17
16
|
import SetMolecularFormulaModal from './SetMolecularFormulaModal';
|
|
@@ -309,22 +308,33 @@ function SummaryPanel() {
|
|
|
309
308
|
const handleOnFilter = useCallback(() => {
|
|
310
309
|
setFilterIsActive(!filterIsActive);
|
|
311
310
|
}, [filterIsActive]);
|
|
312
|
-
const
|
|
313
|
-
return (_jsxs("div", { css: panelStyle, children: [
|
|
311
|
+
const total = correlationsData ? correlationsData.values.length : 0;
|
|
312
|
+
return (_jsxs("div", { css: panelStyle, children: [_jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
314
313
|
? 'Show all correlations'
|
|
315
|
-
: 'Hide correlations out of view',
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
314
|
+
: 'Hide correlations out of view', leftButtons: [
|
|
315
|
+
{
|
|
316
|
+
icon: _jsx(FaFlask, {}),
|
|
317
|
+
title: `Set molecular formula (${correlationsData.options.mf})`,
|
|
318
|
+
onClick: showSetMolecularFormulaModal,
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
icon: _jsx(FaSlidersH, {}),
|
|
322
|
+
title: 'Set shift tolerance',
|
|
323
|
+
onClick: showSetShiftToleranceModal,
|
|
324
|
+
},
|
|
325
|
+
], children: _jsxs("div", { className: "extra-header-content", children: [_jsx("div", { className: "overview-container", children: _jsx(Overview, { correlationsData: correlationsData }) }), _jsx("div", { className: "table-view-selection", children: _jsxs("span", { children: [_jsx("label", { children: "View:" }), _jsx(Select, { onChange: (selection) => {
|
|
326
|
+
setSelectedAdditionalColumnsAtomType(selection);
|
|
327
|
+
if (selection === 'H-H') {
|
|
328
|
+
setShowProtonsAsRows(true);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
setShowProtonsAsRows(false);
|
|
332
|
+
}
|
|
333
|
+
}, items: additionalColumnTypes, defaultValue: selectedAdditionalColumnsAtomType, style: {
|
|
334
|
+
fontSize: '12px',
|
|
335
|
+
width: '70px',
|
|
336
|
+
height: '18px',
|
|
337
|
+
border: '1px solid grey',
|
|
338
|
+
} })] }) })] }) }), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData })] }));
|
|
329
339
|
}
|
|
330
340
|
export default memo(SummaryPanel);
|
|
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { useState, useMemo, useCallback, useRef, memo } from 'react';
|
|
5
5
|
import { FaUnlink } from 'react-icons/fa';
|
|
6
|
-
import { Toolbar } from 'react-science/ui';
|
|
7
6
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
8
7
|
import { useChartData } from '../../context/ChartContext';
|
|
9
8
|
import { useDispatch } from '../../context/DispatchContext';
|
|
@@ -11,7 +10,7 @@ import { useModal } from '../../elements/popup/Modal';
|
|
|
11
10
|
import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
|
|
12
11
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
13
12
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
14
|
-
import DefaultPanelHeader
|
|
13
|
+
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
15
14
|
import PreferencesHeader from '../header/PreferencesHeader';
|
|
16
15
|
import ZonesPreferences from './ZonesPreferences';
|
|
17
16
|
import ZonesTable from './ZonesTable';
|
|
@@ -116,7 +115,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
116
115
|
payload: { key: 'showPeaks' },
|
|
117
116
|
});
|
|
118
117
|
};
|
|
119
|
-
const
|
|
118
|
+
const total = zones?.values?.length || 0;
|
|
120
119
|
return (_jsxs("div", { css: [
|
|
121
120
|
tablePanelStyle,
|
|
122
121
|
isFlipped &&
|
|
@@ -125,7 +124,32 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
125
124
|
position: relative;
|
|
126
125
|
}
|
|
127
126
|
`,
|
|
128
|
-
], children: [!isFlipped && (_jsx(DefaultPanelHeader, {
|
|
127
|
+
], children: [!isFlipped && (_jsx(DefaultPanelHeader, { total: total, counter: tableData?.length, onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', onSettingClick: settingsPanelHandler, leftButtons: [
|
|
128
|
+
{
|
|
129
|
+
disabled: !zones.values || zones.values.length === 0,
|
|
130
|
+
icon: _jsx(FaUnlink, {}),
|
|
131
|
+
title: 'Remove all assignments',
|
|
132
|
+
onClick: handleOnRemoveAssignments,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
icon: _jsx("span", { children: "z" }),
|
|
136
|
+
title: 'Show/Hide zones',
|
|
137
|
+
active: showZones,
|
|
138
|
+
onClick: handleSetShowZones,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
icon: _jsx("span", { children: "s" }),
|
|
142
|
+
title: 'Show/Hide signals',
|
|
143
|
+
active: showSignals,
|
|
144
|
+
onClick: handleSetShowSignals,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
icon: _jsx("span", { children: "p" }),
|
|
148
|
+
title: 'Show/Hide peaks',
|
|
149
|
+
active: showPeaks,
|
|
150
|
+
onClick: handleSetShowPeaks,
|
|
151
|
+
},
|
|
152
|
+
] })), isFlipped && (_jsx(PreferencesHeader, { onSave: saveSettingHandler, onClose: settingsPanelHandler })), _jsx("div", { className: "inner-container", children: !isFlipped ? (_jsx("div", { className: "table-container", children: _jsx(ZonesTable, { tableData: tableData, onUnlink: unlinkZoneHandler, nucleus: activeTab, info: info }) })) : (_jsx(ZonesPreferences, { ref: settingRef })) })] }));
|
|
129
153
|
}
|
|
130
154
|
const MemoizedZonesPanel = memo(ZonesPanelInner);
|
|
131
155
|
const emptyData = { zones: {}, info: {} };
|
|
@@ -12,7 +12,7 @@ import { initiateDatabase, prepareData, DATA_BASES, } from '../../../data/data1d
|
|
|
12
12
|
import { useChartData } from '../../context/ChartContext';
|
|
13
13
|
import { useDispatch } from '../../context/DispatchContext';
|
|
14
14
|
import { usePreferences } from '../../context/PreferencesContext';
|
|
15
|
-
import {
|
|
15
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
16
16
|
import { useFormatNumberByNucleus } from '../../hooks/useFormatNumberByNucleus';
|
|
17
17
|
import { options } from '../../toolbar/ToolTypes';
|
|
18
18
|
import Events from '../../utility/Events';
|
|
@@ -44,7 +44,7 @@ function mapKeywordsToArray(searchKeywords, solvent) {
|
|
|
44
44
|
}
|
|
45
45
|
function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase, }) {
|
|
46
46
|
const dispatch = useDispatch();
|
|
47
|
-
const
|
|
47
|
+
const toaster = useToaster();
|
|
48
48
|
const { item } = useAccordionContext('Databases');
|
|
49
49
|
const format = useFormatNumberByNucleus(nucleus);
|
|
50
50
|
const [isFlipped, setFlipStatus] = useState(false);
|
|
@@ -80,9 +80,11 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
80
80
|
}, [idCode, keywords]);
|
|
81
81
|
useEffect(() => {
|
|
82
82
|
const { solvent, searchKeywords } = keywords;
|
|
83
|
-
setTimeout(
|
|
83
|
+
setTimeout(() => {
|
|
84
84
|
if (databaseInstance.current) {
|
|
85
|
-
const hideLoading =
|
|
85
|
+
const hideLoading = toaster.showLoading({
|
|
86
|
+
message: 'Preparing of the Result',
|
|
87
|
+
});
|
|
86
88
|
if (solvent === '-1' && !searchKeywords) {
|
|
87
89
|
const solvents = mapSolventsToSelect(databaseInstance.current.getSolvents());
|
|
88
90
|
search(solvents);
|
|
@@ -93,7 +95,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
93
95
|
hideLoading();
|
|
94
96
|
}
|
|
95
97
|
}, 0);
|
|
96
|
-
}, [
|
|
98
|
+
}, [idCode, keywords, search, toaster]);
|
|
97
99
|
useEffect(() => {
|
|
98
100
|
function handle(event) {
|
|
99
101
|
if (selectedTool === options.databaseRangesSelection.id) {
|
|
@@ -116,21 +118,25 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
116
118
|
};
|
|
117
119
|
}, [format, selectedTool]);
|
|
118
120
|
useEffect(() => {
|
|
119
|
-
setTimeout(
|
|
121
|
+
setTimeout(() => {
|
|
120
122
|
if (databaseInstance.current) {
|
|
121
|
-
const hideLoading =
|
|
123
|
+
const hideLoading = toaster.showLoading({
|
|
124
|
+
message: 'Loading the database',
|
|
125
|
+
});
|
|
122
126
|
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
123
127
|
hideLoading();
|
|
124
128
|
setKeywords({ ...emptyKeywords });
|
|
125
129
|
}
|
|
126
130
|
}, 0);
|
|
127
|
-
}, [
|
|
131
|
+
}, [nucleus, toaster]);
|
|
128
132
|
const handleChangeDatabase = useCallback((databaseKey) => {
|
|
129
133
|
const database = databases.find((item) => item.key === databaseKey);
|
|
130
134
|
setTimeout(async () => {
|
|
131
135
|
if (database?.url) {
|
|
132
136
|
const { url, label } = database;
|
|
133
|
-
const hideLoading =
|
|
137
|
+
const hideLoading = toaster.showLoading({
|
|
138
|
+
message: `load ${label} database`,
|
|
139
|
+
});
|
|
134
140
|
try {
|
|
135
141
|
databaseDataRef.current = await fetch(url)
|
|
136
142
|
.then((response) => response.json())
|
|
@@ -140,7 +146,10 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
140
146
|
})));
|
|
141
147
|
}
|
|
142
148
|
catch {
|
|
143
|
-
|
|
149
|
+
toaster.show({
|
|
150
|
+
message: `Failed to load ${url}`,
|
|
151
|
+
intent: 'danger',
|
|
152
|
+
});
|
|
144
153
|
}
|
|
145
154
|
finally {
|
|
146
155
|
hideLoading();
|
|
@@ -150,12 +159,14 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
150
159
|
databaseDataRef.current = database
|
|
151
160
|
?.value;
|
|
152
161
|
}
|
|
153
|
-
const hideLoading =
|
|
162
|
+
const hideLoading = toaster.showLoading({
|
|
163
|
+
message: 'Loading the database',
|
|
164
|
+
});
|
|
154
165
|
databaseInstance.current = initiateDatabase(databaseDataRef.current, nucleus);
|
|
155
166
|
setKeywords({ ...emptyKeywords });
|
|
156
167
|
hideLoading();
|
|
157
168
|
}, 0);
|
|
158
|
-
}, [
|
|
169
|
+
}, [databases, nucleus, toaster]);
|
|
159
170
|
useEffect(() => {
|
|
160
171
|
if (item?.isOpen && defaultDatabase && !databaseInstance.current) {
|
|
161
172
|
handleChangeDatabase(defaultDatabase);
|
|
@@ -170,7 +181,9 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
170
181
|
if (jcampRelativeURL) {
|
|
171
182
|
const url = new URL(jcampRelativeURL, baseURL);
|
|
172
183
|
setTimeout(async () => {
|
|
173
|
-
const hideLoading =
|
|
184
|
+
const hideLoading = toaster.showLoading({
|
|
185
|
+
message: `load jcamp in progress...`,
|
|
186
|
+
});
|
|
174
187
|
try {
|
|
175
188
|
const { data } = await readFromWebSource({
|
|
176
189
|
entries: [{ baseURL: url.origin, relativePath: url.pathname }],
|
|
@@ -184,7 +197,7 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
184
197
|
}
|
|
185
198
|
}
|
|
186
199
|
catch {
|
|
187
|
-
|
|
200
|
+
toaster.show({ message: 'Failed to load Jcamp', intent: 'danger' });
|
|
188
201
|
}
|
|
189
202
|
finally {
|
|
190
203
|
hideLoading();
|
|
@@ -197,17 +210,22 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
197
210
|
payload: { ranges, info: { solvent, nucleus, name: names[0] } },
|
|
198
211
|
});
|
|
199
212
|
}
|
|
200
|
-
}, [
|
|
213
|
+
}, [dispatch, nucleus, result.data, toaster]);
|
|
201
214
|
const saveHandler = useCallback((row) => {
|
|
202
215
|
if (row?.jcampURL) {
|
|
203
216
|
setTimeout(async () => {
|
|
204
|
-
const hideLoading =
|
|
217
|
+
const hideLoading = toaster.showLoading({
|
|
218
|
+
message: `Download jcamp in progress...`,
|
|
219
|
+
});
|
|
205
220
|
try {
|
|
206
221
|
await saveJcampAsJson(row, result);
|
|
207
222
|
hideLoading();
|
|
208
223
|
}
|
|
209
224
|
catch {
|
|
210
|
-
|
|
225
|
+
toaster.show({
|
|
226
|
+
message: 'Failed to download the jcamp',
|
|
227
|
+
intent: 'danger',
|
|
228
|
+
});
|
|
211
229
|
}
|
|
212
230
|
finally {
|
|
213
231
|
hideLoading();
|
|
@@ -215,9 +233,9 @@ function DatabasePanelInner({ nucleus, selectedTool, databases, defaultDatabase,
|
|
|
215
233
|
}, 0);
|
|
216
234
|
}
|
|
217
235
|
else {
|
|
218
|
-
|
|
236
|
+
toaster.show({ message: 'No jcamp file to save', intent: 'danger' });
|
|
219
237
|
}
|
|
220
|
-
}, [
|
|
238
|
+
}, [result, toaster]);
|
|
221
239
|
const searchByStructureHandler = (idCodeValue) => {
|
|
222
240
|
setIdCode(idCodeValue);
|
|
223
241
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ToolbarItemProps } from 'react-science/ui';
|
|
2
2
|
import { DataBaseSearchResultEntry, DatabaseSearchKeywords, Databases } from './DatabasePanel';
|
|
3
3
|
interface DatabaseSearchOptionsProps {
|
|
4
4
|
databases: Databases;
|
|
@@ -8,8 +8,8 @@ interface DatabaseSearchOptionsProps {
|
|
|
8
8
|
idCode?: string;
|
|
9
9
|
total: number;
|
|
10
10
|
onKeywordsChange: (k: Partial<DatabaseSearchKeywords>) => void;
|
|
11
|
-
onSettingClick:
|
|
12
|
-
onStructureClick:
|
|
11
|
+
onSettingClick: ToolbarItemProps['onClick'];
|
|
12
|
+
onStructureClick: ToolbarItemProps['onClick'];
|
|
13
13
|
onDatabaseChange: (databaseKey: string) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }: DatabaseSearchOptionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,10 +9,10 @@ import { CounterLabel } from '../../elements/CounterLabel';
|
|
|
9
9
|
import Input from '../../elements/Input';
|
|
10
10
|
import { PreferencesButton } from '../../elements/PreferencesButton';
|
|
11
11
|
import Select from '../../elements/Select';
|
|
12
|
-
import { ToolBarButton
|
|
12
|
+
import { ToolBarButton } from '../../elements/ToolBarButton';
|
|
13
13
|
import useToolsFunctions from '../../hooks/useToolsFunctions';
|
|
14
14
|
import { options } from '../../toolbar/ToolTypes';
|
|
15
|
-
import {
|
|
15
|
+
import { formatCounterLabel } from '../header/DefaultPanelHeader';
|
|
16
16
|
import PanelHeader from '../header/PanelHeader';
|
|
17
17
|
export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, result, idCode, total, onKeywordsChange, onSettingClick, onStructureClick, onDatabaseChange, }) {
|
|
18
18
|
const { handleChangeOption } = useToolsFunctions();
|
|
@@ -43,10 +43,10 @@ export function DatabaseSearchOptions({ databases, defaultDatabase, keywords, re
|
|
|
43
43
|
display: 'flex',
|
|
44
44
|
justifyContent: 'space-between',
|
|
45
45
|
paddingBottom: '2px',
|
|
46
|
-
}, children: [_jsx(ToolBarButton, { title: `${showSimilarityTree ? 'Hide' : 'Show'} similarity tree`, icon: _jsx(TbBinaryTree, {}), active: showSimilarityTree, onClick: handleShowSimilarityTree
|
|
46
|
+
}, children: [_jsx(ToolBarButton, { title: `${showSimilarityTree ? 'Hide' : 'Show'} similarity tree`, icon: _jsx(TbBinaryTree, {}), active: showSimilarityTree, onClick: handleShowSimilarityTree }), _jsx(Select, { style: { flex: 6, marginLeft: '5px' }, items: databases, itemTextField: "label", itemValueField: "key", onChange: onDatabaseChange, placeholder: "Select database", defaultValue: defaultDatabase }), _jsx(Select, { style: { flex: 4, margin: '0px 5px' }, items: result.solvents, placeholder: "Solvent", onChange: handleSearch, value: keywords.solvent }), _jsxs("div", { style: {
|
|
47
47
|
display: 'flex',
|
|
48
48
|
alignItems: 'center',
|
|
49
49
|
flex: 2,
|
|
50
50
|
justifyContent: 'flex-end',
|
|
51
|
-
}, children: [_jsx(CounterLabel, {
|
|
51
|
+
}, children: [_jsx(CounterLabel, { value: formatCounterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { title: "Preferences", onClick: onSettingClick })] })] }), _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(ToolBarButton, { title: "Filter by select ranges", icon: _jsx(FaICursor, {}), active: selectedTool === options.databaseRangesSelection.id, onClick: enableFilterHandler }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3, margin: '0 5px' } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { title: "Search by substructure", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick })] })] }));
|
|
52
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useDispatch } from '../../context/DispatchContext';
|
|
3
|
-
import {
|
|
3
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
4
4
|
import { useModal } from '../../elements/popup/Modal/Context';
|
|
5
5
|
import { tablePanelStyle } from '../extra/BasicPanelStyle';
|
|
6
6
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
@@ -8,13 +8,15 @@ import FiltersTable from './FiltersTable';
|
|
|
8
8
|
export default function FiltersPanel() {
|
|
9
9
|
const dispatch = useDispatch();
|
|
10
10
|
const modal = useModal();
|
|
11
|
-
const
|
|
11
|
+
const toaster = useToaster();
|
|
12
12
|
function handelDeleteFilter() {
|
|
13
13
|
const buttons = [
|
|
14
14
|
{
|
|
15
15
|
text: 'Yes',
|
|
16
16
|
handler: async () => {
|
|
17
|
-
const hideLoading =
|
|
17
|
+
const hideLoading = toaster.showLoading({
|
|
18
|
+
message: 'Delete filters process in progress',
|
|
19
|
+
});
|
|
18
20
|
dispatch({ type: 'DELETE_FILTER', payload: {} });
|
|
19
21
|
hideLoading();
|
|
20
22
|
},
|
|
@@ -26,5 +28,5 @@ export default function FiltersPanel() {
|
|
|
26
28
|
buttons,
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
|
-
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, {
|
|
31
|
+
return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { deleteToolTip: "Delete all filters", onDelete: handelDeleteFilter }), _jsx("div", { className: "inner-container", children: _jsx(FiltersTable, {}) })] }));
|
|
30
32
|
}
|
|
@@ -5,10 +5,10 @@ import { FaRegTrashAlt } from 'react-icons/fa';
|
|
|
5
5
|
import { ObjectInspector } from 'react-inspector';
|
|
6
6
|
import { useChartData } from '../../context/ChartContext';
|
|
7
7
|
import { useDispatch } from '../../context/DispatchContext';
|
|
8
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
8
9
|
import Button from '../../elements/Button';
|
|
9
10
|
import { ColumnWrapper } from '../../elements/ColumnWrapper';
|
|
10
11
|
import ReactTable from '../../elements/ReactTable/ReactTable';
|
|
11
|
-
import { useAlert } from '../../elements/popup/Alert';
|
|
12
12
|
import { useModal } from '../../elements/popup/Modal';
|
|
13
13
|
import useSpectraByActiveNucleus from '../../hooks/useSpectraPerNucleus';
|
|
14
14
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
@@ -31,24 +31,26 @@ const rowColors = {
|
|
|
31
31
|
function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
32
32
|
const dispatch = useDispatch();
|
|
33
33
|
const modal = useModal();
|
|
34
|
-
const
|
|
34
|
+
const toaster = useToaster();
|
|
35
35
|
const selectedFilterIndex = useRef();
|
|
36
36
|
const handelFilterCheck = useCallback((id, event) => {
|
|
37
37
|
const { checked: enabled } = event.target;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})
|
|
45
|
-
}, [
|
|
38
|
+
const hideLoading = toaster.showLoading({
|
|
39
|
+
message: `${enabled ? 'Enable' : 'Disable'} filter in progress`,
|
|
40
|
+
});
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
dispatch({ type: 'ENABLE_FILTER', payload: { id, enabled } });
|
|
43
|
+
hideLoading();
|
|
44
|
+
}, 0);
|
|
45
|
+
}, [dispatch, toaster]);
|
|
46
46
|
const handelDeleteFilter = useCallback(({ id, name, label }) => {
|
|
47
47
|
const buttons = [
|
|
48
48
|
{
|
|
49
49
|
text: 'Yes',
|
|
50
|
-
handler:
|
|
51
|
-
const hideLoading =
|
|
50
|
+
handler: () => {
|
|
51
|
+
const hideLoading = toaster.showLoading({
|
|
52
|
+
message: 'Delete filter process in progress',
|
|
53
|
+
});
|
|
52
54
|
dispatch({ type: 'DELETE_FILTER', payload: { id } });
|
|
53
55
|
hideLoading();
|
|
54
56
|
},
|
|
@@ -58,8 +60,10 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
|
58
60
|
if (spectraCounter > 1) {
|
|
59
61
|
buttons.unshift({
|
|
60
62
|
text: 'Yes, for all spectra',
|
|
61
|
-
handler:
|
|
62
|
-
const hideLoading =
|
|
63
|
+
handler: () => {
|
|
64
|
+
const hideLoading = toaster.showLoading({
|
|
65
|
+
message: 'Delete all spectra filter process in progress',
|
|
66
|
+
});
|
|
63
67
|
dispatch({
|
|
64
68
|
type: 'DELETE_SPECTRA_FILTER',
|
|
65
69
|
payload: { filterName: name },
|
|
@@ -72,20 +76,20 @@ function FiltersTableInner({ filters, spectraCounter, activeFilterID, }) {
|
|
|
72
76
|
message: (_jsxs("span", { children: ["You are about to delete this processing step", _jsxs("span", { style: { color: 'black' }, children: [" ", label, " "] }), " , Are you sure?"] })),
|
|
73
77
|
buttons,
|
|
74
78
|
}, { height: 'auto', width: 'auto' });
|
|
75
|
-
}, [
|
|
79
|
+
}, [dispatch, modal, spectraCounter, toaster]);
|
|
76
80
|
const filterSnapShotHandler = useCallback((filter, index) => {
|
|
77
81
|
selectedFilterIndex.current =
|
|
78
82
|
selectedFilterIndex.current && index === selectedFilterIndex.current
|
|
79
83
|
? null
|
|
80
84
|
: index;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})
|
|
88
|
-
}, [
|
|
85
|
+
const hideLoading = toaster.showLoading({
|
|
86
|
+
message: 'Filter snapshot process in progress',
|
|
87
|
+
});
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
dispatch({ type: 'SET_FILTER_SNAPSHOT', payload: filter });
|
|
90
|
+
hideLoading();
|
|
91
|
+
}, 0);
|
|
92
|
+
}, [dispatch, toaster]);
|
|
89
93
|
const COLUMNS = useMemo(() => [
|
|
90
94
|
{
|
|
91
95
|
Header: '#',
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { ToolbarItemProps as BaseToolbarItemProps } from 'react-science/ui';
|
|
3
|
+
interface CustomToolbarItemProps {
|
|
4
|
+
component: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export type ToolbarItemProps = BaseToolbarItemProps | CustomToolbarItemProps;
|
|
2
7
|
interface DefaultPanelHeaderProps {
|
|
8
|
+
total?: number;
|
|
3
9
|
counter?: number;
|
|
4
|
-
counterLabel?: string;
|
|
5
10
|
deleteToolTip?: string;
|
|
6
11
|
filterToolTip?: string;
|
|
7
12
|
onDelete?: () => void;
|
|
8
13
|
onFilter?: () => void;
|
|
9
14
|
onSettingClick?: () => void;
|
|
10
|
-
canDelete?: boolean;
|
|
11
15
|
disableDelete?: boolean;
|
|
12
|
-
showSettingButton?: boolean;
|
|
13
16
|
children?: ReactNode;
|
|
14
17
|
style?: CSSProperties;
|
|
15
18
|
className?: string;
|
|
16
|
-
|
|
19
|
+
leftButtons?: ToolbarItemProps[];
|
|
20
|
+
rightButtons?: ToolbarItemProps[];
|
|
17
21
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
declare function DefaultPanelHeader(
|
|
22
|
+
export declare function formatCounterLabel(counter?: number, total?: number): string;
|
|
23
|
+
declare function DefaultPanelHeader(props: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
export default DefaultPanelHeader;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { Fragment, useState } from 'react';
|
|
3
|
+
import { FaFilter, FaRegTrashAlt } from 'react-icons/fa';
|
|
4
|
+
import { Toolbar, } from 'react-science/ui';
|
|
3
5
|
import { CounterLabel } from '../../elements/CounterLabel';
|
|
4
|
-
import { DeleteButton } from '../../elements/DeleteButton';
|
|
5
|
-
import { FilterButton } from '../../elements/FilterButton';
|
|
6
6
|
import { PreferencesButton } from '../../elements/PreferencesButton';
|
|
7
7
|
import PanelHeader from './PanelHeader';
|
|
8
8
|
const styles = {
|
|
@@ -12,18 +12,34 @@ const styles = {
|
|
|
12
12
|
flex: 1,
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function isCustomToolbarItem(item) {
|
|
16
|
+
return 'component' in item;
|
|
17
|
+
}
|
|
18
|
+
export function formatCounterLabel(counter, total) {
|
|
19
|
+
if (counter !== undefined &&
|
|
20
|
+
total !== undefined &&
|
|
21
|
+
counter >= 0 &&
|
|
22
|
+
total >= 0 &&
|
|
23
|
+
counter !== total) {
|
|
24
|
+
return `[ ${counter}/${total} ]`;
|
|
25
|
+
}
|
|
26
|
+
if (total !== undefined) {
|
|
27
|
+
return `[ ${total} ]`;
|
|
18
28
|
}
|
|
19
|
-
return
|
|
29
|
+
return '';
|
|
20
30
|
}
|
|
21
|
-
function DefaultPanelHeader(
|
|
31
|
+
function DefaultPanelHeader(props) {
|
|
32
|
+
const { total, counter, onDelete, deleteToolTip = 'Delete', onFilter, filterToolTip = '', children, onSettingClick, disableDelete = false, style = {}, className = '', rightButtons = [], leftButtons = [], } = props;
|
|
22
33
|
const [isFiltered, setFilterStatus] = useState(false);
|
|
23
34
|
function handleFilter() {
|
|
24
35
|
setFilterStatus((previousValue) => !previousValue);
|
|
25
|
-
onFilter();
|
|
36
|
+
onFilter?.();
|
|
26
37
|
}
|
|
27
|
-
return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [
|
|
38
|
+
return (_jsxs(PanelHeader, { style, className, children: [_jsxs("div", { style: styles.leftContainer, children: [_jsxs(Toolbar, { children: [onDelete && (_jsx(Toolbar.Item, { id: "delete-button", onClick: onDelete, title: deleteToolTip, icon: _jsx(FaRegTrashAlt, {}), intent: "danger", disabled: !total || disableDelete })), onFilter && (_jsx(Toolbar.Item, { id: "filter-button", onClick: handleFilter, title: filterToolTip, active: isFiltered, icon: _jsx(FaFilter, {}) })), mapToolbarButtons(leftButtons)] }), children] }), _jsx(Toolbar, { children: mapToolbarButtons(rightButtons) }), _jsx(CounterLabel, { value: formatCounterLabel(counter, total) }), onSettingClick && (_jsx(PreferencesButton, { title: "Preferences", onClick: onSettingClick }))] }));
|
|
39
|
+
}
|
|
40
|
+
function mapToolbarButtons(buttons) {
|
|
41
|
+
return buttons.map((props, index) => isCustomToolbarItem(props) ? (
|
|
42
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
43
|
+
_jsx(Fragment, { children: props.component }, `${index}`)) : (_jsx(Toolbar.Item, { ...props }, props.title)));
|
|
28
44
|
}
|
|
29
45
|
export default DefaultPanelHeader;
|
|
@@ -4,23 +4,25 @@ import { useCallback } from 'react';
|
|
|
4
4
|
import { Toolbar } from 'react-science/ui';
|
|
5
5
|
import { useChartData } from '../../context/ChartContext';
|
|
6
6
|
import { useDispatch } from '../../context/DispatchContext';
|
|
7
|
-
import {
|
|
7
|
+
import { useToaster } from '../../context/ToasterContext';
|
|
8
8
|
import { useCheckToolsVisibility } from '../../hooks/useCheckToolsVisibility';
|
|
9
9
|
export function SpectraAutomaticPickingButton() {
|
|
10
10
|
const dispatch = useDispatch();
|
|
11
|
-
const
|
|
11
|
+
const toaster = useToaster();
|
|
12
12
|
const { data } = useChartData();
|
|
13
13
|
const isToolVisible = useCheckToolsVisibility();
|
|
14
14
|
const automaticPickingHandler = useCallback(() => {
|
|
15
15
|
void (async () => {
|
|
16
|
-
const hideLoading =
|
|
16
|
+
const hideLoading = toaster.showLoading({
|
|
17
|
+
message: 'Automatic Ranges/Zones detection for all spectra in progress',
|
|
18
|
+
});
|
|
17
19
|
setTimeout(() => {
|
|
18
20
|
dispatch({ type: 'AUTO_RANGES_SPECTRA_PICKING' });
|
|
19
21
|
dispatch({ type: 'AUTO_ZONES_SPECTRA_PICKING' });
|
|
20
22
|
hideLoading();
|
|
21
23
|
}, 0);
|
|
22
24
|
})();
|
|
23
|
-
}, [
|
|
25
|
+
}, [toaster, dispatch]);
|
|
24
26
|
if ((Array.isArray(data) && data.length === 0) ||
|
|
25
27
|
!isToolVisible('autoRangeAndZonePicking')) {
|
|
26
28
|
return null;
|