nmrium 0.20.2 → 0.23.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 (253) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  2. package/lib/component/1d/FooterBanner.js +1 -1
  3. package/lib/component/1d/Integral.js +1 -6
  4. package/lib/component/1d/Viewer1D.js +4 -4
  5. package/lib/component/1d/ranges/RangeIntegral.js +2 -6
  6. package/lib/component/1d/utilities/scale.d.ts +1 -1
  7. package/lib/component/1d/utilities/scale.js +7 -6
  8. package/lib/component/2d/Viewer2D.js +5 -5
  9. package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
  10. package/lib/component/NMRium.d.ts +10 -6
  11. package/lib/component/NMRium.js +3 -9
  12. package/lib/component/elements/EditableColumn.d.ts +1 -1
  13. package/lib/component/header/Header.js +13 -10
  14. package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
  15. package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
  16. package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
  17. package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
  18. package/lib/component/hooks/useIntegralPath.js +53 -0
  19. package/lib/component/hooks/useToolsFunctions.js +6 -6
  20. package/lib/component/hooks/useXScale.d.ts +2 -0
  21. package/lib/component/hooks/useXScale.js +7 -0
  22. package/lib/component/loader/DropZone.js +87 -87
  23. package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
  24. package/lib/component/modal/PredictSpectraModal.js +2 -32
  25. package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
  26. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  27. package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
  28. package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
  29. package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
  30. package/lib/component/modal/editZone/EditZoneModal.js +96 -0
  31. package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
  32. package/lib/component/modal/editZone/SignalFormTab.js +6 -0
  33. package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
  34. package/lib/component/modal/editZone/SignalsForm.js +62 -0
  35. package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
  36. package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
  37. package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
  38. package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
  39. package/lib/component/modal/setting/ControllersTabContent.js +1 -1
  40. package/lib/component/modal/setting/DisplayTabContent.js +5 -1
  41. package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
  42. package/lib/component/modal/setting/GeneralSettings.js +13 -9
  43. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
  44. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
  45. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
  46. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
  47. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  48. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
  49. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
  50. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
  51. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
  52. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
  53. package/lib/component/panels/Panels.d.ts +1 -1
  54. package/lib/component/panels/Panels.js +17 -14
  55. package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  56. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
  57. package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
  58. package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
  59. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  60. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  61. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  62. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
  63. package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
  64. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
  65. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  66. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
  67. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  68. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
  69. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
  70. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
  71. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +1 -1
  72. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  73. package/lib/component/panels/SummaryPanel/SummaryPanel.js +39 -42
  74. package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
  75. package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
  76. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
  77. package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
  78. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
  79. package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
  80. package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
  81. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
  82. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
  83. package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
  84. package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
  85. package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
  86. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
  87. package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
  88. package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
  89. package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
  90. package/lib/component/reducer/IgnoreActions.js +2 -1
  91. package/lib/component/reducer/Reducer.d.ts +9 -23
  92. package/lib/component/reducer/Reducer.js +7 -8
  93. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  94. package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
  95. package/lib/component/reducer/actions/DomainActions.js +20 -1
  96. package/lib/component/reducer/actions/IntegralsActions.js +2 -0
  97. package/lib/component/reducer/actions/LoadActions.js +29 -1
  98. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  99. package/lib/component/reducer/actions/PreferencesActions.js +0 -2
  100. package/lib/component/reducer/actions/RangesActions.js +3 -1
  101. package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
  102. package/lib/component/reducer/actions/ToolsActions.js +43 -56
  103. package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
  104. package/lib/component/reducer/actions/ZonesActions.js +33 -2
  105. package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
  106. package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
  107. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
  108. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
  109. package/lib/component/reducer/preferencesReducer.d.ts +3 -8
  110. package/lib/component/reducer/preferencesReducer.js +86 -37
  111. package/lib/component/reducer/types/Types.d.ts +3 -1
  112. package/lib/component/reducer/types/Types.js +3 -1
  113. package/lib/component/toolbar/FunctionToolBar.js +7 -10
  114. package/lib/component/toolbar/ToolTypes.js +3 -3
  115. package/lib/component/workspaces/Workspace.d.ts +6 -0
  116. package/lib/component/workspaces/Workspace.js +1 -0
  117. package/lib/component/workspaces/basic.d.ts +2 -0
  118. package/lib/component/workspaces/basic.js +46 -0
  119. package/lib/component/workspaces/exercise1D.d.ts +2 -0
  120. package/lib/component/workspaces/exercise1D.js +46 -0
  121. package/lib/component/workspaces/index.d.ts +6 -0
  122. package/lib/component/workspaces/index.js +4 -0
  123. package/lib/component/workspaces/process1D.d.ts +2 -0
  124. package/lib/component/workspaces/process1D.js +44 -0
  125. package/lib/data/PredictionManager.d.ts +35 -3
  126. package/lib/data/PredictionManager.js +45 -7
  127. package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
  128. package/lib/data/constants/DefaultPathLengths.js +8 -0
  129. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
  130. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
  131. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  132. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
  133. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
  134. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  135. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
  136. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
  137. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
  138. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
  139. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
  140. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
  141. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  142. package/lib/data/migration/MigrationManager.js +3 -0
  143. package/lib/versionInfo.js +1 -1
  144. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  145. package/lib-cjs/component/1d/FooterBanner.js +1 -1
  146. package/lib-cjs/component/1d/Integral.js +1 -6
  147. package/lib-cjs/component/1d/Viewer1D.js +4 -4
  148. package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
  149. package/lib-cjs/component/1d/utilities/scale.js +7 -6
  150. package/lib-cjs/component/2d/Viewer2D.js +4 -4
  151. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
  152. package/lib-cjs/component/NMRium.js +3 -10
  153. package/lib-cjs/component/header/Header.js +13 -10
  154. package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
  155. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
  156. package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
  157. package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
  158. package/lib-cjs/component/hooks/useXScale.js +11 -0
  159. package/lib-cjs/component/loader/DropZone.js +87 -87
  160. package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
  161. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
  162. package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
  163. package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
  164. package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
  165. package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
  166. package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
  167. package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
  168. package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
  169. package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
  170. package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -1
  171. package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
  172. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
  173. package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
  174. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  175. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
  176. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
  177. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
  178. package/lib-cjs/component/panels/Panels.js +18 -15
  179. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  180. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
  181. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
  182. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
  183. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  184. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
  185. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
  186. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
  187. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
  188. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
  189. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
  190. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
  191. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
  192. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
  193. package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
  194. package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
  195. package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
  196. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
  197. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
  198. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
  199. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
  200. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
  201. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
  202. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
  203. package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
  204. package/lib-cjs/component/reducer/Reducer.js +7 -8
  205. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
  206. package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
  207. package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
  208. package/lib-cjs/component/reducer/actions/LoadActions.js +29 -1
  209. package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
  210. package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
  211. package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
  212. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
  213. package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
  214. package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
  215. package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
  216. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
  217. package/lib-cjs/component/reducer/preferencesReducer.js +87 -38
  218. package/lib-cjs/component/reducer/types/Types.js +6 -4
  219. package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
  220. package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
  221. package/lib-cjs/component/workspaces/Workspace.js +2 -0
  222. package/lib-cjs/component/workspaces/basic.js +49 -0
  223. package/lib-cjs/component/workspaces/exercise1D.js +49 -0
  224. package/lib-cjs/component/workspaces/index.js +6 -0
  225. package/lib-cjs/component/workspaces/process1D.js +47 -0
  226. package/lib-cjs/data/PredictionManager.js +46 -8
  227. package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
  228. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
  229. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
  230. package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
  231. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
  232. package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
  233. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
  234. package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
  235. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
  236. package/lib-cjs/data/migration/MigrationManager.js +3 -0
  237. package/lib-cjs/versionInfo.js +1 -1
  238. package/package.json +1 -1
  239. package/lib/component/1d/utilities/useIntegralPath.js +0 -63
  240. package/lib/component/nmriumMode/basic.d.ts +0 -38
  241. package/lib/component/nmriumMode/basic.js +0 -37
  242. package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
  243. package/lib/component/nmriumMode/exercise1D.js +0 -37
  244. package/lib/component/nmriumMode/process1D.d.ts +0 -38
  245. package/lib/component/nmriumMode/process1D.js +0 -37
  246. package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
  247. package/lib/component/reducer/actions/Zoom.d.ts +0 -16
  248. package/lib/component/reducer/actions/Zoom.js +0 -92
  249. package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
  250. package/lib-cjs/component/nmriumMode/basic.js +0 -39
  251. package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
  252. package/lib-cjs/component/nmriumMode/process1D.js +0 -39
  253. package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
@@ -0,0 +1,14 @@
1
+ import merge from 'lodash/merge';
2
+ import { mapRanges } from './mapRanges';
3
+ export function initiateRanges(options, datum) {
4
+ return merge({
5
+ values: [],
6
+ options: {
7
+ sum: undefined,
8
+ isSumConstant: true,
9
+ sumAuto: true,
10
+ },
11
+ }, options.ranges, {
12
+ values: mapRanges(options?.ranges?.values || [], datum),
13
+ });
14
+ }
@@ -1,19 +1,24 @@
1
1
  import { xyIntegration } from 'ml-spectra-processing';
2
2
  import { DatumKind } from '../../../constants/SignalsKinds';
3
3
  import generateID from '../../../utilities/generateID';
4
+ import { getSpectrumErrorValue } from '../getSpectrumErrorValue';
4
5
  import { getShiftX } from '../shift/getShiftX';
6
+ function checkRange(range, datum, error) {
7
+ // check if the range is already exists
8
+ for (const { from, to } of datum.ranges?.values || []) {
9
+ if (Math.abs(range.from - from) < error &&
10
+ Math.abs(range.to - to) < error) {
11
+ return true;
12
+ }
13
+ }
14
+ }
5
15
  export function mapRanges(ranges, datum) {
6
16
  const { x, re } = datum.data;
7
17
  const shiftX = getShiftX(datum);
8
- const error = (x[x.length - 1] - x[0]) / 10000;
18
+ const error = getSpectrumErrorValue(datum);
9
19
  return ranges.reduce((acc, newRange) => {
10
- // check if the range is already exists
11
- for (const { from, to } of datum.ranges.values) {
12
- if (Math.abs(newRange.from - from) < error &&
13
- Math.abs(newRange.to - to) < error) {
14
- return acc;
15
- }
16
- }
20
+ if (checkRange(newRange, datum, error))
21
+ return acc;
17
22
  const absolute = xyIntegration({ x, y: re }, { from: newRange.from, to: newRange.to, reverse: true });
18
23
  const signals = newRange.signals.map((signal) => {
19
24
  const { kind = null, id, ...resSignal } = signal;
@@ -10,5 +10,8 @@ export function migrate(data) {
10
10
  migrateToVersion2,
11
11
  ];
12
12
  let index = data?.version || 0;
13
+ if (index > CURRENT_EXPORT_VERSION) {
14
+ throw new Error('This file can not be imported using the current NMRium version, Please move to the new one !!! ');
15
+ }
13
16
  return migrationPipe(migrationsFuncs.slice(index))(data);
14
17
  }
@@ -1 +1 @@
1
- export default { version: 'v0.20.2' };
1
+ export default { version: 'v0.23.0' };
@@ -47,6 +47,5 @@ function ExclusionZonesAnnotations() {
47
47
  }
48
48
  exports.default = ExclusionZonesAnnotations;
49
49
  function getExclusionZones(data) {
50
- return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id)
51
- ?.value || []);
50
+ return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id && filter.flag)?.value || []);
52
51
  }
@@ -91,7 +91,7 @@ function FooterBannerInner({ margin, width, height, activeSpectrum, spectrum, ac
91
91
  100).toFixed(2), "%"] }, void 0)] }, void 0))] }, void 0)), activeSpectrum && ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "separator" }, void 0), (0, jsx_runtime_1.jsx)(io5_1.IoPulseSharp, {}, void 0), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Intensity: " }, void 0), (0, jsx_runtime_1.jsx)("span", { className: "value yvalue", children: format(getYValue(position.x)) }, void 0)] }, void 0)] }, void 0))] }, void 0));
92
92
  }
93
93
  const MemoizedFooterBanner = (0, react_2.memo)(FooterBannerInner);
94
- const emptyData = { info: {}, data: {} };
94
+ const emptyData = { info: {}, data: null };
95
95
  function FooterBanner() {
96
96
  const { margin, width, height, activeSpectrum, activeTab } = (0, ChartContext_1.useChartData)();
97
97
  const spectrum = (0, useSpectrum_1.default)(emptyData);
@@ -4,26 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- // import { xyReduce, xyIntegral } from 'ml-spectra-processing';
8
7
  const react_1 = require("react");
9
- const ChartContext_1 = require("../context/ChartContext");
10
8
  const PreferencesContext_1 = require("../context/PreferencesContext");
9
+ const useIntegralPath_1 = __importDefault(require("../hooks/useIntegralPath"));
11
10
  const defaultValues_1 = require("../panels/extra/preferences/defaultValues");
12
11
  const LocalStorage_1 = require("../utility/LocalStorage");
13
12
  const IntegralResizable_1 = __importDefault(require("./IntegralResizable"));
14
- const useIntegralPath_1 = __importDefault(require("./utilities/useIntegralPath"));
15
13
  function Integral({ integral, isActive }) {
16
14
  const preferences = (0, PreferencesContext_1.usePreferences)();
17
15
  const path = (0, useIntegralPath_1.default)(integral);
18
- const { height, margin } = (0, ChartContext_1.useChartData)();
19
16
  const integralSettings = (0, react_1.useMemo)(() => {
20
17
  let { color = defaultValues_1.integralDefaultValues.color, strokeWidth = defaultValues_1.integralDefaultValues.strokeWidth, } = (0, LocalStorage_1.getValue)(preferences, 'formatting.panels.integrals') || {};
21
18
  return { color, strokeWidth };
22
19
  }, [preferences]);
23
20
  return ((0, jsx_runtime_1.jsxs)("g", { children: [(0, jsx_runtime_1.jsx)("path", { className: "line", stroke: integralSettings.color, strokeWidth: integralSettings.strokeWidth, fill: "none", style: {
24
- transformOrigin: 'center top',
25
21
  opacity: isActive ? 1 : 0.2,
26
- transform: `translateY(-${margin.bottom + height * 0.3}px)`,
27
22
  }, d: path }, void 0), (0, jsx_runtime_1.jsx)(IntegralResizable_1.default, { integralData: integral }, void 0)] }, void 0));
28
23
  }
29
24
  exports.default = Integral;
@@ -38,7 +38,7 @@ const Alert_1 = require("../elements/popup/Alert");
38
38
  const Modal_1 = require("../elements/popup/Modal");
39
39
  const Spinner_1 = __importDefault(require("../loader/Spinner"));
40
40
  const MultipletAnalysisModal_1 = __importDefault(require("../modal/MultipletAnalysisModal"));
41
- const Zoom_1 = require("../reducer/actions/Zoom");
41
+ const Zoom1DManager_1 = require("../reducer/helper/Zoom1DManager");
42
42
  const getRange_1 = __importDefault(require("../reducer/helper/getRange"));
43
43
  const scaleReducer_1 = __importStar(require("../reducer/scaleReducer"));
44
44
  const Types_1 = require("../reducer/types/Types");
@@ -187,7 +187,7 @@ function Viewer1D({ emptyText = undefined }) {
187
187
  }, [
188
188
  scaleState,
189
189
  selectedTool,
190
- general.disableMultipletAnalysis,
190
+ general?.disableMultipletAnalysis,
191
191
  modal,
192
192
  data,
193
193
  activeSpectrum,
@@ -196,10 +196,10 @@ function Viewer1D({ emptyText = undefined }) {
196
196
  alert,
197
197
  ]);
198
198
  const handelOnDoubleClick = (0, react_1.useCallback)(() => {
199
- dispatch({ type: Types_1.FULL_ZOOM_OUT, zoomType: Zoom_1.ZoomType.STEP_HORIZONTAL });
199
+ dispatch({ type: Types_1.FULL_ZOOM_OUT, zoomType: Zoom1DManager_1.ZoomType.STEP_HORIZONTAL });
200
200
  }, [dispatch]);
201
201
  const handleZoom = (0, react_1.useCallback)((event) => {
202
- dispatch({ type: Types_1.SET_ZOOM_FACTOR, ...event, selectedTool });
202
+ dispatch({ type: Types_1.SET_ZOOM, event, selectedTool });
203
203
  }, [dispatch, selectedTool]);
204
204
  const mouseClick = (0, react_1.useCallback)((position) => {
205
205
  const propagateEvent = () => {
@@ -4,13 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const ChartContext_1 = require("../../context/ChartContext");
8
- const useIntegralPath_1 = __importDefault(require("../utilities/useIntegralPath"));
7
+ const useIntegralPath_1 = __importDefault(require("../../hooks/useIntegralPath"));
9
8
  function RangeIntegral({ range }) {
10
9
  const path = (0, useIntegralPath_1.default)(range);
11
- const { height, margin } = (0, ChartContext_1.useChartData)();
12
- return ((0, jsx_runtime_1.jsx)("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", style: {
13
- transform: `translateY(-${margin.bottom + height * 0.3}px)`,
14
- }, d: path }, void 0));
10
+ return ((0, jsx_runtime_1.jsx)("path", { className: "line", stroke: "black", strokeWidth: "1", fill: "none", d: path }, void 0));
15
11
  }
16
12
  exports.default = RangeIntegral;
@@ -25,13 +25,14 @@ function getYScale(state, spectrumId = null) {
25
25
  return (0, d3_1.scaleLinear)(domainY, [_height, margin.top]);
26
26
  }
27
27
  exports.getYScale = getYScale;
28
- function getIntegralYScale(state, spectrumId) {
29
- const { height, margin, verticalAlign, integralsYDomains } = state;
28
+ function getIntegralYScale(state) {
29
+ const { height, margin, verticalAlign, integralsYDomains, activeSpectrum } = state;
30
30
  const _height = verticalAlign.align === 'center' ? height / 2 : height;
31
- return (0, d3_1.scaleLinear)(integralsYDomains[spectrumId], [
32
- _height - (margin.bottom + _height * 0.3),
33
- margin.top,
34
- ]);
31
+ return (0, d3_1.scaleLinear)(activeSpectrum?.id &&
32
+ integralsYDomains &&
33
+ integralsYDomains[activeSpectrum?.id]
34
+ ? integralsYDomains[activeSpectrum?.id]
35
+ : [0, 0], [_height * 0.3, margin.top + _height * 0.1]);
35
36
  }
36
37
  exports.getIntegralYScale = getIntegralYScale;
37
38
  function reScaleY(scale, { domain, height, margin }) {
@@ -104,15 +104,15 @@ function Viewer2D({ emptyText = undefined }) {
104
104
  dispatch({ type: Types_1.FULL_ZOOM_OUT, trackID });
105
105
  }
106
106
  }, [DIMENSION, dispatch]);
107
- const handleZoom = (wheelData) => {
108
- const { x: startX, y: startY } = wheelData;
107
+ const handleZoom = (event) => {
108
+ const { x: startX, y: startY } = event;
109
109
  const trackID = (0, DimensionLayout_1.getLayoutID)(DIMENSION, { startX, startY });
110
110
  if (trackID) {
111
111
  if (trackID === 'CENTER_2D') {
112
- dispatch({ type: Types_1.SET_2D_LEVEL, ...wheelData });
112
+ dispatch({ type: Types_1.SET_2D_LEVEL, ...event });
113
113
  }
114
114
  else {
115
- dispatch({ type: Types_1.SET_ZOOM_FACTOR, ...wheelData, trackID });
115
+ dispatch({ type: Types_1.SET_ZOOM, event, trackID });
116
116
  }
117
117
  }
118
118
  };
@@ -17,7 +17,7 @@ const Constants_1 = require("../reducer/core/Constants");
17
17
  const Types_1 = require("../reducer/types/Types");
18
18
  const ToolTypes_1 = require("../toolbar/ToolTypes");
19
19
  function KeysListenerTracker() {
20
- const { keysPreferences, displayerMode, overDisplayer, data } = (0, ChartContext_1.useChartData)();
20
+ const { keysPreferences, displayerMode, overDisplayer, data, activeSpectrum, } = (0, ChartContext_1.useChartData)();
21
21
  const dispatch = (0, DispatchContext_1.useDispatch)();
22
22
  const alert = (0, Alert_1.useAlert)();
23
23
  const openLoader = (0, LoaderContext_1.useLoader)();
@@ -28,9 +28,6 @@ function KeysListenerTracker() {
28
28
  const allow1DTool = (0, react_1.useMemo)(() => {
29
29
  return displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && data && data.length > 0;
30
30
  }, [data, displayerMode]);
31
- const allow2DTool = (0, react_1.useMemo)(() => {
32
- return displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && data && data.length > 0;
33
- }, [data, displayerMode]);
34
31
  const deleteHandler = (0, react_1.useCallback)(async (sourceData) => {
35
32
  const { type, extra: { id }, } = sourceData;
36
33
  switch (type) {
@@ -125,106 +122,126 @@ function KeysListenerTracker() {
125
122
  }
126
123
  }, [alert, data, dispatch, keysPreferences]);
127
124
  const toolsListenerHandler = (0, react_1.useCallback)((e) => {
128
- if (!e.shiftKey && !e.metaKey) {
129
- switch (e.key) {
130
- case 'f':
131
- handleFullZoomOut();
132
- break;
133
- case 'z':
134
- case 'Escape':
135
- handleChangeOption(ToolTypes_1.options.zoom.id);
136
- break;
137
- case 'r': {
138
- const toolID = allow2DTool
139
- ? ToolTypes_1.options.zone2D.id
140
- : allow1DTool
141
- ? ToolTypes_1.options.rangesPicking.id
142
- : '';
143
- handleChangeOption(toolID);
144
- break;
145
- }
146
- case 'a': {
147
- if (allow1DTool) {
125
+ function check1DModeWithActiveSpectrum(label, checkSwitch = true) {
126
+ if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && !activeSpectrum) {
127
+ throw new Error(`Select a spectrum to proceed with ${label}`);
128
+ }
129
+ else if (checkSwitch && displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
130
+ throw new Error(`Switch to 1D Mode and select a spectrum to proceed with ${label}`);
131
+ }
132
+ }
133
+ function check2DModeWithActiveSpectrum(label, checkSwitch = true) {
134
+ if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && !activeSpectrum) {
135
+ throw new Error(`Select a spectrum to proceed with ${label}`);
136
+ }
137
+ else if (checkSwitch && displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
138
+ throw new Error(`Switch to 2D Mode and select a spectrum to proceed with ${label}`);
139
+ }
140
+ }
141
+ try {
142
+ if (!e.shiftKey && !e.metaKey) {
143
+ switch (e.key) {
144
+ case 'f':
145
+ handleFullZoomOut();
146
+ break;
147
+ case 'z':
148
+ case 'Escape':
149
+ handleChangeOption(ToolTypes_1.options.zoom.id);
150
+ break;
151
+ case 'r': {
152
+ if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
153
+ check2DModeWithActiveSpectrum(ToolTypes_1.options.zone2D.label, false);
154
+ handleChangeOption(ToolTypes_1.options.zone2D.id);
155
+ }
156
+ else {
157
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.rangesPicking.label, false);
158
+ handleChangeOption(ToolTypes_1.options.rangesPicking.id);
159
+ }
160
+ break;
161
+ }
162
+ case 'a': {
163
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.phaseCorrection.label);
148
164
  handleChangeOption(ToolTypes_1.options.phaseCorrection.id);
165
+ break;
149
166
  }
150
- break;
151
- }
152
- case 'b': {
153
- if (allow1DTool) {
167
+ case 'b': {
168
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.baseLineCorrection.label);
154
169
  handleChangeOption(ToolTypes_1.options.baseLineCorrection.id);
170
+ break;
155
171
  }
156
- break;
157
- }
158
- case 'p': {
159
- if (allow1DTool) {
172
+ case 'p': {
173
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.peakPicking.label);
160
174
  handleChangeOption(ToolTypes_1.options.peakPicking.id);
175
+ break;
161
176
  }
162
- break;
163
- }
164
- case 'i': {
165
- if (allow1DTool) {
177
+ case 'i': {
178
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.integral.label);
166
179
  handleChangeOption(ToolTypes_1.options.integral.id);
180
+ break;
167
181
  }
168
- break;
169
- }
170
- case 'e': {
171
- if (allow1DTool) {
182
+ case 'e': {
183
+ check1DModeWithActiveSpectrum(ToolTypes_1.options.exclusionZones.label);
172
184
  handleChangeOption(ToolTypes_1.options.exclusionZones.id);
185
+ break;
173
186
  }
174
- break;
187
+ default:
175
188
  }
176
- default:
177
189
  }
178
- }
179
- if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
180
- switch (e.key) {
181
- case 'c': {
182
- if (allow1DTool) {
183
- alignSpectrumsVerticallyHandler();
190
+ if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
191
+ switch (e.key) {
192
+ case 'c': {
193
+ if (allow1DTool) {
194
+ alignSpectrumsVerticallyHandler();
195
+ }
196
+ break;
184
197
  }
185
- break;
186
- }
187
- case 's': {
188
- if (allow1DTool) {
189
- changeDisplayViewModeHandler();
198
+ case 's': {
199
+ if (allow1DTool) {
200
+ changeDisplayViewModeHandler();
201
+ }
202
+ break;
190
203
  }
191
- break;
204
+ default:
192
205
  }
193
- default:
194
206
  }
195
- }
196
- if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
197
- switch (e.key) {
198
- case 'c':
199
- void saveToClipboardHandler();
200
- e.preventDefault();
201
- break;
202
- case 's':
203
- void saveAsJSONHandler();
204
- e.preventDefault();
205
- break;
206
- case 'o':
207
- openLoader();
208
- e.preventDefault();
209
- break;
210
- default:
207
+ if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
208
+ switch (e.key) {
209
+ case 'c':
210
+ void saveToClipboardHandler();
211
+ e.preventDefault();
212
+ break;
213
+ case 's':
214
+ void saveAsJSONHandler();
215
+ e.preventDefault();
216
+ break;
217
+ case 'o':
218
+ openLoader();
219
+ e.preventDefault();
220
+ break;
221
+ default:
222
+ }
211
223
  }
212
- }
213
- if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
214
- switch (e.key) {
215
- case 's':
216
- case 'S':
217
- void saveAsHandler();
218
- e.preventDefault();
219
- break;
220
- default:
224
+ if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
225
+ switch (e.key) {
226
+ case 's':
227
+ case 'S':
228
+ void saveAsHandler();
229
+ e.preventDefault();
230
+ break;
231
+ default:
232
+ }
221
233
  }
222
234
  }
235
+ catch (e) {
236
+ alert.error(e.message);
237
+ }
223
238
  }, [
239
+ activeSpectrum,
240
+ alert,
224
241
  alignSpectrumsVerticallyHandler,
225
242
  allow1DTool,
226
- allow2DTool,
227
243
  changeDisplayViewModeHandler,
244
+ displayerMode,
228
245
  handleChangeOption,
229
246
  handleFullZoomOut,
230
247
  openLoader,
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.NMRiumMode = void 0;
26
25
  const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
27
26
  /** @jsxImportSource @emotion/react */
28
27
  const react_1 = require("@emotion/react");
@@ -121,12 +120,6 @@ const containerStyles = (0, react_1.css) `
121
120
  border-right: 0.55px #bbbbbb solid;
122
121
  }
123
122
  `;
124
- var NMRiumMode;
125
- (function (NMRiumMode) {
126
- NMRiumMode["EXERCISE_1D"] = "exercise1D";
127
- NMRiumMode["PROCESS_1D"] = "process1D";
128
- NMRiumMode["DEFAULT"] = "default";
129
- })(NMRiumMode = exports.NMRiumMode || (exports.NMRiumMode = {}));
130
123
  const defaultPreferences = {};
131
124
  const defaultData = {
132
125
  spectra: [],
@@ -134,7 +127,7 @@ const defaultData = {
134
127
  function NMRium(props) {
135
128
  return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props }, void 0) }, void 0) }, void 0));
136
129
  }
137
- function InnerNMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, }) {
130
+ function InnerNMRium({ data: dataProp = defaultData, workspace = 'default', preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, }) {
138
131
  const rootRef = (0, react_2.useRef)(null);
139
132
  const elementsWraperRef = (0, react_2.useRef)(null);
140
133
  const [show, toggle] = (0, react_use_1.useToggle)(false);
@@ -162,11 +155,11 @@ function InnerNMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT,
162
155
  type: preferencesReducer_1.INIT_PREFERENCES,
163
156
  payload: {
164
157
  display: preferences,
165
- mode,
158
+ workspace,
166
159
  dispatch: dispatchPreferences,
167
160
  },
168
161
  });
169
- }, [preferences, mode]);
162
+ }, [preferences, workspace]);
170
163
  (0, react_2.useEffect)(() => {
171
164
  dispatchMiddleWare({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
172
165
  if (dataProp) {
@@ -10,7 +10,7 @@ const react_1 = require("react");
10
10
  const fa_1 = require("react-icons/fa");
11
11
  const constants_1 = require("../../constants");
12
12
  const ChartContext_1 = require("../context/ChartContext");
13
- const Alert_1 = require("../elements/popup/Alert");
13
+ const PreferencesContext_1 = require("../context/PreferencesContext");
14
14
  const Modal_1 = require("../elements/popup/Modal");
15
15
  const AboutUsModal_1 = __importDefault(require("../modal/AboutUsModal"));
16
16
  const GeneralSettings_1 = __importDefault(require("../modal/setting/GeneralSettings"));
@@ -22,8 +22,7 @@ const RangesPickingOptionPanel_1 = __importDefault(require("./RangesPickingOptio
22
22
  const ZeroFillingOptionsPanel_1 = __importDefault(require("./ZeroFillingOptionsPanel"));
23
23
  const Zones2DOptionPanel_1 = __importDefault(require("./Zones2DOptionPanel"));
24
24
  function HeaderInner(props) {
25
- const { isFullscreen, onMaximize = () => null, selectedOptionPanel } = props;
26
- const alert = (0, Alert_1.useAlert)();
25
+ const { isFullscreen, onMaximize = () => null, selectedOptionPanel, hideGeneralSettings, } = props;
27
26
  const modal = (0, Modal_1.useModal)();
28
27
  const selectedPanel = (0, react_1.useMemo)(() => {
29
28
  switch (selectedOptionPanel) {
@@ -44,15 +43,13 @@ function HeaderInner(props) {
44
43
  }
45
44
  }, [selectedOptionPanel]);
46
45
  const openGeneralSettingsHandler = (0, react_1.useCallback)(() => {
47
- modal.show((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, { onSave: () => {
48
- alert.success('Settings saved successfully');
49
- modal.close();
50
- } }, void 0), {
46
+ modal.show((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, {}, void 0), {
51
47
  position: Modal_1.positions.TOP_CENTER,
52
48
  enableResizing: true,
53
49
  width: 600,
50
+ height: 400,
54
51
  });
55
- }, [alert, modal]);
52
+ }, [modal]);
56
53
  const openAboutUs = (0, react_1.useCallback)(() => {
57
54
  modal.show((0, jsx_runtime_1.jsx)(AboutUsModal_1.default, {}, void 0), {
58
55
  isBackgroundBlur: false,
@@ -69,11 +66,17 @@ function HeaderInner(props) {
69
66
  display: 'flex',
70
67
  alignItems: 'center',
71
68
  justifyContent: 'center',
72
- }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}, void 0) }, void 0), !isFullscreen && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
69
+ }, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}, void 0) }, void 0), !hideGeneralSettings && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}, void 0) }, void 0)), !isFullscreen && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
73
70
  }
74
71
  const MemoizedHeader = (0, react_1.memo)(HeaderInner);
75
72
  function HeaderWrapper({ isFullscreen, onMaximize }) {
76
73
  const { toolOptions: { selectedOptionPanel }, } = (0, ChartContext_1.useChartData)();
77
- return ((0, jsx_runtime_1.jsx)(MemoizedHeader, { ...{ selectedOptionPanel, isFullscreen, onMaximize } }, void 0));
74
+ const { display: { general }, } = (0, PreferencesContext_1.usePreferences)();
75
+ return ((0, jsx_runtime_1.jsx)(MemoizedHeader, { ...{
76
+ selectedOptionPanel,
77
+ isFullscreen,
78
+ onMaximize,
79
+ hideGeneralSettings: general?.hideGeneralSettings || false,
80
+ } }, void 0));
78
81
  }
79
82
  exports.default = HeaderWrapper;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const get_1 = __importDefault(require("lodash/get"));
3
7
  const react_1 = require("react");
4
8
  const PreferencesContext_1 = require("../context/PreferencesContext");
5
9
  function useCheckExperimentalFeature() {
6
10
  const preferences = (0, PreferencesContext_1.usePreferences)();
7
11
  return (0, react_1.useMemo)(() => {
8
- return !preferences?.display.hideExperimentalFeatures === true;
12
+ return !(0, get_1.default)(preferences, 'display.general.hideExperimentalFeatures', false);
9
13
  }, [preferences]);
10
14
  }
11
15
  exports.default = useCheckExperimentalFeature;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useCheckToolsVisibility = void 0;
7
+ const get_1 = __importDefault(require("lodash/get"));
8
+ const PreferencesContext_1 = require("../context/PreferencesContext");
9
+ function useCheckToolsVisibility() {
10
+ const preferences = (0, PreferencesContext_1.usePreferences)();
11
+ return (toolKey) => !(0, get_1.default)(preferences, `display.toolBarButtons.${toolKey}`, false);
12
+ }
13
+ exports.useCheckToolsVisibility = useCheckToolsVisibility;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ml_spectra_processing_1 = require("ml-spectra-processing");
4
+ const react_1 = require("react");
5
+ const scale_1 = require("../1d/utilities/scale");
6
+ const ChartContext_1 = require("../context/ChartContext");
7
+ const PathBuilder_1 = require("../utility/PathBuilder");
8
+ const useXScale_1 = require("./useXScale");
9
+ function useIntegralYDomain() {
10
+ const { height, margin, verticalAlign, activeSpectrum, integralsYDomains } = (0, ChartContext_1.useChartData)();
11
+ return (0, react_1.useMemo)(() => (0, scale_1.getIntegralYScale)({
12
+ height,
13
+ margin,
14
+ verticalAlign,
15
+ activeSpectrum,
16
+ integralsYDomains,
17
+ }), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
18
+ }
19
+ function useIntegralPath(integralOptions) {
20
+ const { data, activeSpectrum } = (0, ChartContext_1.useChartData)();
21
+ const scaleX = (0, useXScale_1.useXScale)();
22
+ const scaleY = useIntegralYDomain();
23
+ const integral = (0, react_1.useMemo)(() => {
24
+ if (activeSpectrum) {
25
+ const { x, re } = data[activeSpectrum?.index].data;
26
+ const { from, to } = integralOptions;
27
+ return (0, ml_spectra_processing_1.xyIntegral)({ x, y: re }, {
28
+ from,
29
+ to,
30
+ reverse: true,
31
+ });
32
+ }
33
+ return { x: [], y: [] };
34
+ }, [activeSpectrum, data, integralOptions]);
35
+ const paths = (0, react_1.useMemo)(() => {
36
+ if (integral) {
37
+ const xySeries = (0, ml_spectra_processing_1.xyReduce)(integral, {
38
+ // from: xDomain[0],
39
+ // to: xDomain[1],
40
+ nbPoints: 200,
41
+ optimize: true,
42
+ });
43
+ const pathBuilder = new PathBuilder_1.PathBuilder();
44
+ pathBuilder.moveTo(scaleX(xySeries.x[0]), scaleY(xySeries.y[0]));
45
+ for (let i = 1; i < xySeries.x.length; i++) {
46
+ pathBuilder.lineTo(scaleX(xySeries.x[i]), scaleY(xySeries.y[i]));
47
+ }
48
+ return pathBuilder.toString();
49
+ }
50
+ else {
51
+ return '';
52
+ }
53
+ }, [integral, scaleX, scaleY]);
54
+ return paths;
55
+ }
56
+ exports.default = useIntegralPath;