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.
Files changed (196) hide show
  1. package/README.md +7 -7
  2. package/lib/component/1d/Chart1D.js +1 -1
  3. package/lib/component/1d/LinesSeries.js +2 -2
  4. package/lib/component/1d/Viewer1D.js +6 -11
  5. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  6. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  7. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  15. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  16. package/lib/component/2d/Viewer2D.js +16 -15
  17. package/lib/component/2d/ft/Contours.js +6 -3
  18. package/lib/component/2d/utilities/scale.d.ts +2 -1
  19. package/lib/component/2d/utilities/scale.js +12 -2
  20. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  21. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  22. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +29 -15
  24. package/lib/component/context/ToasterContext.d.ts +13 -0
  25. package/lib/component/context/ToasterContext.js +34 -0
  26. package/lib/component/elements/CloseButton.d.ts +2 -2
  27. package/lib/component/elements/CloseButton.js +1 -1
  28. package/lib/component/elements/CounterLabel.d.ts +3 -3
  29. package/lib/component/elements/CounterLabel.js +3 -3
  30. package/lib/component/elements/PreferencesButton.d.ts +2 -2
  31. package/lib/component/elements/PreferencesButton.js +2 -4
  32. package/lib/component/elements/SaveButton.d.ts +2 -2
  33. package/lib/component/elements/SaveButton.js +1 -1
  34. package/lib/component/elements/Select.js +2 -2
  35. package/lib/component/elements/ToolBarButton.d.ts +1 -8
  36. package/lib/component/elements/ToolBarButton.js +2 -11
  37. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  38. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  39. package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
  40. package/lib/component/header/Header.d.ts +1 -11
  41. package/lib/component/header/Header.js +5 -6
  42. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  43. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  44. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  45. package/lib/component/header/RangesPickingOptionPanel.js +6 -3
  46. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  47. package/lib/component/hooks/useDialogToggle.js +16 -0
  48. package/lib/component/hooks/useExport.d.ts +9 -1
  49. package/lib/component/hooks/useExport.js +34 -36
  50. package/lib/component/hooks/useSaveSettings.js +6 -3
  51. package/lib/component/hooks/useToolsFunctions.js +6 -4
  52. package/lib/component/loader/DropZone.js +14 -14
  53. package/lib/component/main/InnerNMRium.js +5 -9
  54. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  55. package/lib/component/main/InnerNMRiumContents.js +5 -3
  56. package/lib/component/main/NMRium.js +2 -2
  57. package/lib/component/modal/AboutPredictionModal.js +1 -1
  58. package/lib/component/modal/CopyClipboardModal.js +1 -1
  59. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  60. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  61. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  62. package/lib/component/modal/LoadJCAMPModal.js +6 -4
  63. package/lib/component/modal/PredictSpectraModal.js +11 -9
  64. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  65. package/lib/component/modal/SaveAsModal.js +27 -27
  66. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  67. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  68. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  69. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  70. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  71. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  72. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  73. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  74. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  75. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  76. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  77. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  78. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  79. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  80. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  81. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  82. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  83. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  84. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  85. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  86. package/lib/component/modal/setting/GeneralSettings.js +7 -4
  87. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  88. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  89. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
  90. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  91. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
  92. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  93. package/lib/component/panels/PeaksPanel/PeaksPanel.js +48 -14
  94. package/lib/component/panels/RangesPanel/RangesHeader.js +73 -13
  95. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
  96. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +49 -8
  97. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
  98. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  99. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
  100. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
  101. package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
  102. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
  103. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  104. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
  105. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
  106. package/lib/component/panels/filtersPanel/FilterPanel.js +6 -4
  107. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  108. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  109. package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
  110. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
  111. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  112. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
  113. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +36 -7
  114. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
  115. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  116. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
  117. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  118. package/lib/component/reducer/Reducer.d.ts +2 -2
  119. package/lib/component/reducer/Reducer.js +23 -16
  120. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  121. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  122. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  123. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  124. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  125. package/lib/component/reducer/actions/RangesActions.js +16 -6
  126. package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
  127. package/lib/component/reducer/actions/ToolsActions.js +75 -14
  128. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  129. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  130. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  131. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  132. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  133. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  134. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  135. package/lib/component/toolbar/ToolBar.js +241 -8
  136. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  137. package/lib/component/toolbar/toolbarMenu.js +77 -0
  138. package/lib/component/utility/Events.d.ts +11 -0
  139. package/lib/component/utility/Events.js +22 -0
  140. package/lib/component/utility/booleanToString.d.ts +6 -0
  141. package/lib/component/utility/booleanToString.js +4 -0
  142. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  143. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  144. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  145. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  146. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  147. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  148. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  149. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  150. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  151. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  152. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  153. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  154. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  155. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  156. package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
  157. package/lib/data/getDefaultMatrixFilters.js +2 -2
  158. package/lib/data/matrixGeneration.js +1 -1
  159. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  160. package/lib/versionInfo.js +1 -1
  161. package/package.json +31 -30
  162. package/lib/component/elements/DeleteButton.d.ts +0 -6
  163. package/lib/component/elements/DeleteButton.js +0 -8
  164. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  165. package/lib/component/elements/DropdownMenu.js +0 -7
  166. package/lib/component/elements/FilterButton.d.ts +0 -6
  167. package/lib/component/elements/FilterButton.js +0 -8
  168. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  169. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  170. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  171. package/lib/component/elements/popup/Alert/Context.js +0 -10
  172. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  173. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  174. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  175. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  176. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  177. package/lib/component/elements/popup/Alert/index.js +0 -3
  178. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  179. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  180. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  181. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  182. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  183. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  184. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  185. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  186. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  187. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  188. package/lib/component/modal/metaImportation/index.js +0 -17
  189. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
  190. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
  191. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  192. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
  193. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  194. package/lib/component/toolbar/BasicToolBar.js +0 -165
  195. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  196. 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, { createFilterLabel, } from '../header/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 counter = correlationsData ? correlationsData.values.length : 0;
313
- return (_jsxs("div", { css: panelStyle, children: [_jsxs(DefaultPanelHeader, { canDelete: false, counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && filteredCorrelationsData?.values.length), onFilter: handleOnFilter, filterToolTip: filterIsActive
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', children: [_jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaFlask, {}), title: `Set molecular formula (${correlationsData.options.mf})`, onClick: showSetMolecularFormulaModal }), _jsx(Toolbar.Item, { icon: _jsx(FaSlidersH, {}), title: "Set shift tolerance", onClick: showSetShiftToleranceModal })] }), _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) => {
316
- setSelectedAdditionalColumnsAtomType(selection);
317
- if (selection === 'H-H') {
318
- setShowProtonsAsRows(true);
319
- }
320
- else {
321
- setShowProtonsAsRows(false);
322
- }
323
- }, items: additionalColumnTypes, defaultValue: selectedAdditionalColumnsAtomType, style: {
324
- fontSize: '12px',
325
- width: '70px',
326
- height: '18px',
327
- border: '1px solid grey',
328
- } })] }) })] })] }), _jsx(CorrelationTable, { correlationsData: correlationsData, filteredCorrelationsData: filteredCorrelationsData, additionalColumnData: additionalColumnData, editEquivalencesSaveHandler: editEquivalencesSaveHandler, onSaveEditNumericValues: editNumericValuesSaveHandler, onEditCorrelationTableCellHandler: editCorrelationTableCellHandler, showProtonsAsRows: showProtonsAsRows, spectraData: spectraData })] }));
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, { createFilterLabel, } from '../header/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 counter = zones?.values?.length || 0;
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, { counter: counter, counterLabel: createFilterLabel(counter, filterIsActive && tableData?.length), onDelete: handleDeleteAll, deleteToolTip: "Delete All Zones", onFilter: handleOnFilter, filterToolTip: filterIsActive ? 'Show all zones' : 'Hide zones out of view', showSettingButton: true, onSettingClick: settingsPanelHandler, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { disabled: !zones.values || zones.values.length === 0, icon: _jsx(FaUnlink, {}), title: "Remove all assignments", onClick: handleOnRemoveAssignments }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "z" }), title: "Show/Hide zones", active: showZones, onClick: handleSetShowZones }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "s" }), title: "Show/Hide signals", active: showSignals, onClick: handleSetShowSignals }), _jsx(Toolbar.Item, { icon: _jsx("span", { children: "p" }), title: "Show/Hide peaks", active: showPeaks, onClick: handleSetShowPeaks })] }) })), 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 })) })] }));
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 { useAlert } from '../../elements/popup/Alert';
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 alert = useAlert();
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(async () => {
83
+ setTimeout(() => {
84
84
  if (databaseInstance.current) {
85
- const hideLoading = await alert.showLoading(`Preparing of the Result`);
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
- }, [alert, idCode, keywords, search]);
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(async () => {
121
+ setTimeout(() => {
120
122
  if (databaseInstance.current) {
121
- const hideLoading = await alert.showLoading(`Loading the database`);
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
- }, [alert, nucleus]);
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 = await alert.showLoading(`load ${label} database`);
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
- alert.error(`Failed to load ${url}`);
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 = await alert.showLoading(`Loading the database`);
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
- }, [alert, databases, nucleus]);
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 = await alert.showLoading(`load jcamp in progress...`);
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
- alert.error(`Failed to load Jcamp`);
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
- }, [alert, dispatch, nucleus, result.data]);
213
+ }, [dispatch, nucleus, result.data, toaster]);
201
214
  const saveHandler = useCallback((row) => {
202
215
  if (row?.jcampURL) {
203
216
  setTimeout(async () => {
204
- const hideLoading = await alert.showLoading(`Download jcamp in progress...`);
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
- alert.error(`Failed to download the jcamp`);
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
- alert.error(`No jcamp file to save`);
236
+ toaster.show({ message: 'No jcamp file to save', intent: 'danger' });
219
237
  }
220
- }, [alert, result]);
238
+ }, [result, toaster]);
221
239
  const searchByStructureHandler = (idCodeValue) => {
222
240
  setIdCode(idCodeValue);
223
241
  };
@@ -1,4 +1,4 @@
1
- import { ToolBarButtonProps } from '../../elements/ToolBarButton';
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: ToolBarButtonProps['onClick'];
12
- onStructureClick: ToolBarButtonProps['onClick'];
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, } from '../../elements/ToolBarButton';
12
+ import { ToolBarButton } from '../../elements/ToolBarButton';
13
13
  import useToolsFunctions from '../../hooks/useToolsFunctions';
14
14
  import { options } from '../../toolbar/ToolTypes';
15
- import { createFilterLabel } from '../header/DefaultPanelHeader';
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, style: { marginRight: '5px' } }), _jsx(Select, { style: { flex: 6 }, 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: {
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, { children: createFilterLabel(total || 0, result.data.length) }), _jsx(PreferencesButton, { 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, style: { marginRight: '5px' } }), _jsx(Input, { value: keywords.searchKeywords, renderIcon: () => _jsx(IoSearchOutline, {}), style: { inputWrapper: { flex: 3 } }, className: "search-input", type: "text", debounceTime: 250, placeholder: "Search for parameter...", onChange: handleSearch, onClear: clearHandler, canClear: true }), _jsx(ToolBarButton, { title: "Search by stricture", icon: !idCode ? _jsx(BsHexagon, {}) : _jsx(BsHexagonFill, {}), intent: "success", active: !!idCode, onClick: onStructureClick, style: { marginLeft: '5px' } })] })] }));
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 { useAlert } from '../../elements/popup/Alert/Context';
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 alert = useAlert();
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 = await alert.showLoading('Delete filters process in progress');
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, { showSettingButton: false, deleteToolTip: "Delete all filters", onDelete: handelDeleteFilter }), _jsx("div", { className: "inner-container", children: _jsx(FiltersTable, {}) })] }));
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 alert = useAlert();
34
+ const toaster = useToaster();
35
35
  const selectedFilterIndex = useRef();
36
36
  const handelFilterCheck = useCallback((id, event) => {
37
37
  const { checked: enabled } = event.target;
38
- void (async () => {
39
- const hideLoading = await alert.showLoading(`${enabled ? 'Enable' : 'Disable'} filter in progress`);
40
- setTimeout(() => {
41
- dispatch({ type: 'ENABLE_FILTER', payload: { id, enabled } });
42
- hideLoading();
43
- }, 0);
44
- })();
45
- }, [alert, dispatch]);
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: async () => {
51
- const hideLoading = await alert.showLoading('Delete filter process in progress');
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: async () => {
62
- const hideLoading = await alert.showLoading('Delete all spectra filter process in progress');
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
- }, [alert, dispatch, modal, spectraCounter]);
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
- void (async () => {
82
- const hideLoading = await alert.showLoading('Filter snapshot process in progress');
83
- setTimeout(() => {
84
- dispatch({ type: 'SET_FILTER_SNAPSHOT', payload: filter });
85
- hideLoading();
86
- }, 0);
87
- })();
88
- }, [alert, dispatch]);
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
- renderRightButtons?: () => ReactNode;
19
+ leftButtons?: ToolbarItemProps[];
20
+ rightButtons?: ToolbarItemProps[];
17
21
  }
18
- export declare function createFilterLabel(total: number, counter: number | false): string;
19
- declare function DefaultPanelHeader({ counter, counterLabel, onDelete, deleteToolTip, onFilter, filterToolTip, children, onSettingClick, showSettingButton, canDelete, disableDelete, style, className, renderRightButtons, }: DefaultPanelHeaderProps): import("react/jsx-runtime").JSX.Element;
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
- export function createFilterLabel(total, counter) {
16
- if (typeof counter === 'boolean') {
17
- return `[ ${total || 0} ]`;
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 `[ ${counter}/${total} ]`;
29
+ return '';
20
30
  }
21
- function DefaultPanelHeader({ counter, counterLabel, onDelete = () => null, deleteToolTip = 'Delete', onFilter = () => null, filterToolTip = '', children, onSettingClick = () => null, showSettingButton = false, canDelete = true, disableDelete = false, style = {}, className = '', renderRightButtons, }) {
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: [canDelete && (_jsx(DeleteButton, { disabled: counter === 0 || disableDelete, title: deleteToolTip, onClick: onDelete })), filterToolTip && (_jsx(FilterButton, { onClick: handleFilter, active: isFiltered, title: filterToolTip })), children] }), renderRightButtons?.(), counterLabel && _jsx(CounterLabel, { children: counterLabel }), showSettingButton && _jsx(PreferencesButton, { onClick: onSettingClick })] }));
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 { useAlert } from '../../elements/popup/Alert';
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 alert = useAlert();
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 = await alert.showLoading('Automatic Ranges/Zones detection for all spectra in progress');
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
- }, [dispatch, alert]);
25
+ }, [toaster, dispatch]);
24
26
  if ((Array.isArray(data) && data.length === 0) ||
25
27
  !isToolVisible('autoRangeAndZonePicking')) {
26
28
  return null;