nmrium 0.55.0 → 0.57.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 (202) hide show
  1. package/lib/component/1d/Chart1D.js +3 -1
  2. package/lib/component/1d/ExclusionZoneAnnotation.d.ts +0 -1
  3. package/lib/component/1d/Viewer1D.js +36 -11
  4. package/lib/component/1d/database/DatabaseSpectrum.js +14 -19
  5. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +0 -1
  6. package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
  7. package/lib/component/1d/matrix/Boxplot.js +97 -0
  8. package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
  9. package/lib/component/1d/matrix/Stocsy.js +101 -0
  10. package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
  11. package/lib/component/1d/matrix/useMatrix.js +93 -0
  12. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +0 -1
  13. package/lib/component/1d/peaks/PeakEditionManager.js +16 -10
  14. package/lib/component/1d/utilities/getDecimalsCount.js +1 -1
  15. package/lib/component/1d/utilities/intersectionResolver.js +1 -1
  16. package/lib/component/1d/utilities/scale.d.ts +2 -1
  17. package/lib/component/1d/utilities/scale.js +6 -1
  18. package/lib/component/1d-2d/FieldEdition.d.ts +3 -1
  19. package/lib/component/1d-2d/FieldEdition.js +26 -10
  20. package/lib/component/2d/1d-tracer/Left1DChart.d.ts +0 -1
  21. package/lib/component/2d/1d-tracer/Top1DChart.d.ts +0 -1
  22. package/lib/component/2d/XAxis.d.ts +0 -1
  23. package/lib/component/2d/YAxis.d.ts +0 -1
  24. package/lib/component/2d/ft/Contours.js +7 -7
  25. package/lib/component/assignment/AssignmentsContext.d.ts +0 -1
  26. package/lib/component/context/ChartContext.d.ts +0 -1
  27. package/lib/component/context/DispatchContext.d.ts +0 -1
  28. package/lib/component/context/GlobalContext.d.ts +0 -1
  29. package/lib/component/context/KeyModifierContext.js +1 -1
  30. package/lib/component/context/LoaderContext.d.ts +0 -1
  31. package/lib/component/context/PreferencesContext.d.ts +0 -1
  32. package/lib/component/context/PrepareExportContext.d.ts +21 -0
  33. package/lib/component/context/PrepareExportContext.js +124 -0
  34. package/lib/component/context/ScaleContext.d.ts +0 -1
  35. package/lib/component/elements/ActionButtons.d.ts +1 -0
  36. package/lib/component/elements/ActionButtons.js +4 -4
  37. package/lib/component/elements/ColorInput.d.ts +0 -1
  38. package/lib/component/elements/ColorPickerDropdownController.d.ts +2 -0
  39. package/lib/component/elements/ColorPickerDropdownController.js +8 -0
  40. package/lib/component/elements/ColumnWrapper.d.ts +0 -1
  41. package/lib/component/elements/ContextMenu.d.ts +0 -1
  42. package/lib/component/elements/Input.d.ts +1 -0
  43. package/lib/component/elements/Input.js +2 -1
  44. package/lib/component/elements/Input2.d.ts +13 -0
  45. package/lib/component/elements/Input2.js +118 -0
  46. package/lib/component/elements/Input2Controller.d.ts +12 -0
  47. package/lib/component/elements/Input2Controller.js +22 -0
  48. package/lib/component/elements/MoleculeSelection.js +1 -1
  49. package/lib/component/elements/NumberInput.js +1 -1
  50. package/lib/component/elements/NumberInput2.d.ts +12 -0
  51. package/lib/component/elements/NumberInput2.js +65 -0
  52. package/lib/component/elements/NumberInput2Controller.d.ts +8 -0
  53. package/lib/component/elements/NumberInput2Controller.js +15 -0
  54. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +3 -3
  55. package/lib/component/elements/ReactTable/Style.d.ts +3 -1
  56. package/lib/component/elements/ReactTable/Style.js +11 -1
  57. package/lib/component/elements/ReactTable/utility/ReactTableContext.d.ts +0 -1
  58. package/lib/component/elements/Select2.d.ts +26 -0
  59. package/lib/component/elements/Select2.js +25 -0
  60. package/lib/component/elements/Select2Controller.d.ts +7 -0
  61. package/lib/component/elements/Select2Controller.js +12 -0
  62. package/lib/component/elements/draggable/useDraggable.d.ts +0 -1
  63. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +2 -4
  64. package/lib/component/elements/dropDownButton/DropDownButton.js +11 -37
  65. package/lib/component/elements/dropDownButton/DropDownList.js +3 -32
  66. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  67. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +0 -1
  68. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  69. package/lib/component/elements/formik/FormikInput2.d.ts +11 -0
  70. package/lib/component/elements/formik/FormikInput2.js +26 -0
  71. package/lib/component/elements/formik/FormikOnChange.d.ts +0 -1
  72. package/lib/component/elements/popup/Modal/Context.d.ts +0 -1
  73. package/lib/component/elements/popup/Modal/ModalContent.d.ts +0 -1
  74. package/lib/component/elements/resizer/SVGResizer.d.ts +0 -1
  75. package/lib/component/elements/useFormValidateField.d.ts +1 -0
  76. package/lib/component/elements/useFormValidateField.js +9 -0
  77. package/lib/component/header/ApodizationOptionsPanel.js +26 -11
  78. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +1 -4
  79. package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -16
  80. package/lib/component/header/BaseLineCorrectionPanel.js +49 -27
  81. package/lib/component/header/Header.js +1 -1
  82. package/lib/component/header/PhaseCorrectionPanel.js +12 -24
  83. package/lib/component/header/RangesPickingOptionPanel.js +12 -12
  84. package/lib/component/header/ZeroFillingOptionsPanel.js +18 -7
  85. package/lib/component/header/Zones2DOptionPanel.js +19 -18
  86. package/lib/component/hooks/useExport.d.ts +1 -1
  87. package/lib/component/hooks/useExport.js +4 -4
  88. package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
  89. package/lib/component/hooks/usePanelPreferences.js +3 -1
  90. package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
  91. package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
  92. package/lib/component/hooks/useWorkspaceAction.d.ts +1 -1
  93. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +0 -1
  94. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +0 -1
  95. package/lib/component/modal/setting/GeneralSettings.d.ts +5 -1
  96. package/lib/component/modal/setting/GeneralSettings.js +107 -111
  97. package/lib/component/modal/setting/WorkspaceItem.js +4 -9
  98. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  99. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +95 -59
  100. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +33 -25
  101. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +15 -4
  102. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +56 -39
  103. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +36 -36
  104. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +44 -36
  105. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +16 -11
  106. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +47 -40
  107. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +50 -40
  108. package/lib/component/modal/setting/settingsValidation.js +8 -34
  109. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +0 -1
  110. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +0 -1
  111. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +0 -1
  112. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
  113. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
  114. package/lib/component/panels/Panels.js +32 -9
  115. package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +0 -1
  116. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +0 -1
  117. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +0 -1
  118. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +0 -1
  119. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
  120. package/lib/component/panels/SpectraPanel/SpectraPreferences.d.ts +0 -1
  121. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +32 -24
  122. package/lib/component/panels/SpectraPanel/SpectraTable.js +17 -2
  123. package/lib/component/panels/SpectraPanel/SpectrumListPanel.d.ts +0 -1
  124. package/lib/component/panels/SpectraPanel/base/ColorIndicator.d.ts +0 -1
  125. package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.d.ts +3 -3
  126. package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.js +25 -16
  127. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DHistogram.d.ts +0 -1
  128. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +15 -5
  129. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.d.ts +0 -1
  130. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +44 -6
  131. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.d.ts +0 -1
  132. package/lib/component/panels/SummaryPanel/Overview.d.ts +0 -1
  133. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts +0 -1
  134. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +1 -1
  135. package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +0 -1
  136. package/lib/component/panels/databasePanel/DatabasePanel.js +17 -3
  137. package/lib/component/panels/databasePanel/DatabasePreferences.d.ts +0 -1
  138. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +11 -4
  139. package/lib/component/panels/databasePanel/DatabaseTable.js +22 -7
  140. package/lib/component/panels/informationPanel/InformationEditionModal.d.ts +6 -0
  141. package/lib/component/panels/informationPanel/InformationEditionModal.js +105 -0
  142. package/lib/component/panels/informationPanel/InformationPanel.d.ts +1 -0
  143. package/lib/component/panels/{InformationPanel.js → informationPanel/InformationPanel.js} +2 -2
  144. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts +0 -1
  145. package/lib/component/panels/multipleAnalysisPanel/preferences/index.d.ts +0 -1
  146. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +0 -1
  147. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +1 -1
  148. package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +0 -1
  149. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +0 -1
  150. package/lib/component/reducer/Reducer.d.ts +7 -1
  151. package/lib/component/reducer/Reducer.js +2 -0
  152. package/lib/component/reducer/actions/DatabaseActions.js +22 -5
  153. package/lib/component/reducer/actions/DomainActions.d.ts +5 -2
  154. package/lib/component/reducer/actions/DomainActions.js +6 -4
  155. package/lib/component/reducer/actions/FiltersActions.js +2 -2
  156. package/lib/component/reducer/actions/LoadActions.js +5 -2
  157. package/lib/component/reducer/actions/SpectraActions.d.ts +9 -2
  158. package/lib/component/reducer/actions/SpectraActions.js +65 -23
  159. package/lib/component/reducer/actions/ToolsActions.js +3 -4
  160. package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
  161. package/lib/component/reducer/preferences/actions/matrixGeneration.js +62 -25
  162. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +11 -8
  163. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +19 -1
  164. package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -26
  165. package/lib/component/reducer/preferences/preferencesReducer.js +7 -1
  166. package/lib/component/toolbar/ToolBar.js +6 -7
  167. package/lib/component/utility/PathBuilder.d.ts +1 -0
  168. package/lib/component/utility/PathBuilder.js +8 -1
  169. package/lib/component/utility/checkUniqueByKey.d.ts +2 -0
  170. package/lib/component/utility/checkUniqueByKey.js +40 -0
  171. package/lib/component/utility/colorToHexWithAlpha.d.ts +9 -0
  172. package/lib/component/utility/colorToHexWithAlpha.js +4 -0
  173. package/lib/component/workspaces/exercise.js +2 -0
  174. package/lib/component/workspaces/process1D.js +0 -1
  175. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  176. package/lib/data/PredictionManager.js +3 -5
  177. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +13 -13
  178. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +9 -9
  179. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -13
  180. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +13 -13
  181. package/lib/data/data1d/database.d.ts +1 -0
  182. package/lib/data/data1d/database.js +4 -2
  183. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -22
  184. package/lib/data/data2d/Spectrum2D/contours.js +88 -67
  185. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +4 -2
  186. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +20 -20
  187. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +20 -20
  188. package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
  189. package/lib/data/initiateFilters.d.ts +1 -1
  190. package/lib/data/matrixGeneration.js +1 -2
  191. package/lib/data/types/common/DeepPartial.d.ts +3 -0
  192. package/lib/data/types/common/DeepPartial.js +1 -0
  193. package/lib/data/types/common/Keys.d.ts +3 -0
  194. package/lib/data/types/common/Keys.js +1 -0
  195. package/lib/data/utilities/generateNumbersPowerOfX.d.ts +2 -2
  196. package/lib/versionInfo.js +1 -1
  197. package/package.json +39 -38
  198. package/lib/component/elements/CustomToolTip.d.ts +0 -8
  199. package/lib/component/elements/CustomToolTip.js +0 -107
  200. package/lib/component/elements/formik/FormikSlider.d.ts +0 -6
  201. package/lib/component/elements/formik/FormikSlider.js +0 -15
  202. package/lib/component/panels/InformationPanel.d.ts +0 -1
@@ -1,42 +1,79 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
+ import { toScaleRatio } from '../../helper/Zoom1DManager';
3
+ import { getMatrixGenerationDefaultOptions } from '../panelsPreferencesDefaultValues';
2
4
  import { getActiveWorkspace } from '../utilities/getActiveWorkspace';
3
- function addExclusionZone(draft, action) {
4
- const { zone, range, nucleus } = action.payload;
5
+ function getMatrixGenerationPanelOptions(draft, nucleus) {
6
+ initMatrixGeneration(draft, nucleus);
7
+ const currentWorkspacePreferences = getActiveWorkspace(draft);
8
+ const panels = currentWorkspacePreferences.panels;
9
+ const matrixGeneration = panels.matrixGeneration?.[nucleus];
10
+ return matrixGeneration;
11
+ }
12
+ function initMatrixGeneration(draft, nucleus) {
5
13
  const currentWorkspacePreferences = getActiveWorkspace(draft);
6
14
  const panels = currentWorkspacePreferences.panels;
7
- const exclusionZone = {
8
- id: v4(),
9
- ...zone,
10
- };
11
15
  if (!panels.matrixGeneration?.[nucleus]) {
12
- const options = {
13
- exclusionsZones: [exclusionZone],
14
- filters: [],
15
- range,
16
- numberOfPoints: 1024,
17
- };
16
+ const options = getMatrixGenerationDefaultOptions();
18
17
  panels.matrixGeneration = {
19
18
  ...panels.matrixGeneration,
20
19
  [nucleus]: options,
21
20
  };
22
21
  }
23
- else {
24
- panels.matrixGeneration[nucleus].exclusionsZones.push(exclusionZone);
25
- }
22
+ return panels.matrixGeneration;
23
+ }
24
+ function addExclusionZone(draft, action) {
25
+ const { zone, range, nucleus } = action.payload;
26
+ const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
27
+ if (!matrixGeneration)
28
+ return;
29
+ const exclusionZone = {
30
+ id: v4(),
31
+ ...zone,
32
+ };
33
+ matrixGeneration.matrixOptions.range = range;
34
+ matrixGeneration.matrixOptions.exclusionsZones.push(exclusionZone);
26
35
  }
27
36
  function deleteExclusionZone(draft, action) {
28
37
  const { zone, nucleus } = action.payload;
29
- const currentWorkspacePreferences = getActiveWorkspace(draft);
30
- const panels = currentWorkspacePreferences.panels;
31
- if (panels.matrixGeneration?.[nucleus]) {
32
- const options = panels.matrixGeneration[nucleus];
33
- options.exclusionsZones = options.exclusionsZones.filter((_zone) => _zone.id !== zone.id);
34
- }
38
+ const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
39
+ if (!matrixGeneration)
40
+ return;
41
+ const options = matrixGeneration.matrixOptions;
42
+ options.exclusionsZones = options.exclusionsZones.filter((_zone) => _zone.id !== zone.id);
35
43
  }
36
44
  function setMatrixGenerationOptions(draft, action) {
37
45
  const { options, nucleus } = action.payload;
38
- const currentWorkspacePreferences = getActiveWorkspace(draft);
39
- const panels = currentWorkspacePreferences.panels;
40
- panels.matrixGeneration = { ...panels.matrixGeneration, [nucleus]: options };
46
+ const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
47
+ matrixGeneration.matrixOptions = options;
48
+ }
49
+ function toggleMatrixGenerationViewProperty(draft, action) {
50
+ const { key, nucleus } = action.payload;
51
+ const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
52
+ if (!matrixGeneration)
53
+ return;
54
+ matrixGeneration[key] = !matrixGeneration[key];
55
+ }
56
+ function resetDefaultViewMatrixGenerationOptions(draft, action) {
57
+ const { nucleus } = action.payload;
58
+ const matrixGeneration = initMatrixGeneration(draft, nucleus);
59
+ const currentOptions = getMatrixGenerationPanelOptions(draft, nucleus);
60
+ const { matrixOptions } = currentOptions;
61
+ const { matrixOptions: defaultMatrixOptions, ...vewOptions } = getMatrixGenerationDefaultOptions();
62
+ matrixGeneration[nucleus] = { matrixOptions, ...vewOptions };
63
+ }
64
+ function changeMatrixGenerationScale(draft, action) {
65
+ const { zoomOptions, nucleus } = action.payload;
66
+ const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
67
+ if (!matrixGeneration)
68
+ return;
69
+ const scaleRatio = toScaleRatio(zoomOptions);
70
+ matrixGeneration.scaleRatio *= scaleRatio;
71
+ }
72
+ function changeMatrixGenerationStocsyChemicalShift(draft, action) {
73
+ const { chemicalShift, nucleus } = action.payload;
74
+ const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
75
+ if (!matrixGeneration)
76
+ return null;
77
+ matrixGeneration.chemicalShift = chemicalShift;
41
78
  }
42
- export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions };
79
+ export { addExclusionZone, deleteExclusionZone, setMatrixGenerationOptions, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, resetDefaultViewMatrixGenerationOptions, };
@@ -1,9 +1,12 @@
1
- import { PanelsPreferences } from 'nmr-load-save';
2
- declare const getSpectraDefaultValues: (nucleus?: string) => PanelsPreferences['spectra'];
3
- declare const getIntegralDefaultValues: (nucleus?: string) => PanelsPreferences['integrals'];
4
- declare const getZoneDefaultValues: (nucleus?: string) => PanelsPreferences['zones'];
5
- declare const getRangeDefaultValues: (nucleus?: string) => PanelsPreferences['ranges'];
6
- declare const getPeaksDefaultValues: (nucleus?: string) => PanelsPreferences['peaks'];
1
+ import { MatrixGenerationOptions, PanelsPreferences } from 'nmr-load-save';
2
+ import { DeepPartial } from '../../../data/types/common/DeepPartial';
3
+ declare const getSpectraDefaultValues: (nucleus?: string) => PanelsPreferences["spectra"];
4
+ declare const getIntegralDefaultValues: (nucleus?: string) => PanelsPreferences["integrals"];
5
+ declare const getZoneDefaultValues: (nucleus?: string) => PanelsPreferences["zones"];
6
+ declare const getRangeDefaultValues: (nucleus?: string) => PanelsPreferences["ranges"];
7
+ declare const getPeaksDefaultValues: (nucleus?: string) => PanelsPreferences["peaks"];
7
8
  declare const databaseDefaultValues: PanelsPreferences['database'];
8
- declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences['multipleSpectraAnalysis'];
9
- export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, };
9
+ declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences["multipleSpectraAnalysis"];
10
+ declare function getMatrixGenerationDefaultOptions(): DeepPartial<MatrixGenerationOptions>;
11
+ declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences["matrixGeneration"];
12
+ export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
@@ -52,6 +52,7 @@ const getIntegralDefaultValues = (nucleus) => {
52
52
  strokeWidth: 1,
53
53
  showKind: true,
54
54
  showDeleteAction: true,
55
+ isSumConstant: true,
55
56
  };
56
57
  return getPreferences(preferences, nucleus);
57
58
  };
@@ -100,6 +101,7 @@ const getRangeDefaultValues = (nucleus) => {
100
101
  showZoomAction: true,
101
102
  showEditAction: true,
102
103
  showAssignmentLabel: false,
104
+ isSumConstant: true,
103
105
  };
104
106
  return getPreferences(preferences, nucleus);
105
107
  };
@@ -148,4 +150,20 @@ const getMultipleSpectraAnalysisDefaultValues = (nucleus) => {
148
150
  };
149
151
  return nucleus ? { [nucleus]: preferences } : {};
150
152
  };
151
- export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, };
153
+ function getMatrixGenerationDefaultOptions() {
154
+ return {
155
+ matrixOptions: {
156
+ exclusionsZones: [],
157
+ filters: [],
158
+ numberOfPoints: 1024,
159
+ },
160
+ chemicalShift: null,
161
+ scaleRatio: 1,
162
+ showBoxPlot: false,
163
+ showStocsy: false,
164
+ };
165
+ }
166
+ const getMatrixGenerationDefaultValues = (nucleus) => {
167
+ return nucleus ? { [nucleus]: getMatrixGenerationDefaultOptions() } : {};
168
+ };
169
+ export { getSpectraDefaultValues, getPeaksDefaultValues, getIntegralDefaultValues, getRangeDefaultValues, getZoneDefaultValues, databaseDefaultValues, getMultipleSpectraAnalysisDefaultValues, getMatrixGenerationDefaultOptions, getMatrixGenerationDefaultValues, };
@@ -1,9 +1,9 @@
1
1
  import { MultipleSpectraAnalysisPreferences, Workspace, WorkSpaceSource } from 'nmr-load-save';
2
2
  import { Reducer } from 'react';
3
3
  import { SplitPaneSize } from 'react-science/ui';
4
- import { MatrixOptions } from '../../../data/types/data1d/MatrixOptions';
5
4
  import type { NMRiumWorkspace, NMRiumPreferences } from '../../main';
6
5
  import { ActionType } from '../types/ActionType';
6
+ import { MatrixGenerationActions } from './actions/matrixGeneration';
7
7
  export declare const WORKSPACES_KEYS: {
8
8
  componentKey: string;
9
9
  nmriumKey: string;
@@ -22,7 +22,7 @@ type InitPreferencesAction = ActionType<'INIT_PREFERENCES', {
22
22
  type SetPreferencesAction = ActionType<'SET_PREFERENCES', Partial<Workspace>> | ActionType<'SET_PREFERENCES'>;
23
23
  type SetPanelsPreferencesAction = ActionType<'SET_PANELS_PREFERENCES', {
24
24
  key: string;
25
- value: string;
25
+ value: any;
26
26
  }>;
27
27
  export type SetWorkspaceAction = ActionType<'SET_WORKSPACE', {
28
28
  workspaceSource: 'any';
@@ -60,33 +60,10 @@ export type SetSpectraAnalysisPanelPreferencesAction = ActionType<'SET_SPECTRA_A
60
60
  nucleus: string;
61
61
  data: MultipleSpectraAnalysisPreferences;
62
62
  }>;
63
- export type setMatrixGenerationOptionsAction = ActionType<'SET_MATRIX_GENERATION_OPTIONS', {
64
- nucleus: string;
65
- options: MatrixOptions;
66
- }>;
67
- export type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_EXCLUSION_ZONE', {
68
- zone: {
69
- from: number;
70
- to: number;
71
- };
72
- range: {
73
- from: number;
74
- to: number;
75
- };
76
- nucleus: string;
77
- }>;
78
- export type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
79
- zone: {
80
- id: string;
81
- from: number;
82
- to: number;
83
- };
84
- nucleus: string;
85
- }>;
86
63
  export type SetVerticalSplitterPositionAction = ActionType<'SET_VERTICAL_SPLITTER_POSITION', {
87
64
  value: SplitPaneSize;
88
65
  }>;
89
- type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction | setMatrixGenerationOptionsAction | addMatrixGenerationExclusionZoneAction | deleteMatrixGenerationExclusionZoneAction | SetVerticalSplitterPositionAction;
66
+ type PreferencesActions = InitPreferencesAction | SetPreferencesAction | SetPanelsPreferencesAction | SetWorkspaceAction | WorkspaceAction | AddWorkspaceAction | ApplyGeneralPreferences | AnalyzeSpectraAction | ChangeAnalysisColumnValueKeyAction | DeleteAnalysisColumn | SetSpectraAnalysisPanelPreferencesAction | MatrixGenerationActions | SetVerticalSplitterPositionAction;
90
67
  export declare const WORKSPACES: Array<{
91
68
  key: NMRiumWorkspace;
92
69
  label: string;
@@ -6,7 +6,7 @@ import { addWorkspace } from './actions/addWorkspace';
6
6
  import { analyzeSpectra, changeAnalysisColumnValueKey, deleteAnalysisColumn, setSpectraAnalysisPanelsPreferences, } from './actions/analyzeSpectra';
7
7
  import { applyGeneralPreferences } from './actions/applyGeneralPreferences';
8
8
  import { initPreferences } from './actions/initPreferences';
9
- import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, } from './actions/matrixGeneration';
9
+ import { setMatrixGenerationOptions, addExclusionZone, deleteExclusionZone, toggleMatrixGenerationViewProperty, changeMatrixGenerationScale, changeMatrixGenerationStocsyChemicalShift, } from './actions/matrixGeneration';
10
10
  import { removeWorkspace } from './actions/removeWorkspace';
11
11
  import { setActiveWorkspace } from './actions/setActiveWorkspace';
12
12
  import { setPanelsPreferences } from './actions/setPanelsPreferences';
@@ -125,8 +125,14 @@ function innerPreferencesReducer(draft, action) {
125
125
  return addExclusionZone(draft, action);
126
126
  case 'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE':
127
127
  return deleteExclusionZone(draft, action);
128
+ case 'TOGGLE_MATRIX_GENERATION_VIEW_PROPERTY':
129
+ return toggleMatrixGenerationViewProperty(draft, action);
128
130
  case 'SET_VERTICAL_SPLITTER_POSITION':
129
131
  return setVerticalSplitterPosition(draft, action);
132
+ case 'CHANGE_MATRIX_GENERATION_SCALE':
133
+ return changeMatrixGenerationScale(draft, action);
134
+ case 'CHANGE_MATRIX_GENERATION_STOCSY_CHEMICAL_SHIFT':
135
+ return changeMatrixGenerationStocsyChemicalShift(draft, action);
130
136
  default:
131
137
  return draft;
132
138
  }
@@ -3,12 +3,11 @@ import { SvgNmrAlignBottom, SvgNmrAlignCenter, SvgNmrApodization, SvgNmrBaseline
3
3
  import { useCallback } from 'react';
4
4
  import { FaSearchPlus, FaExpand, FaDiceFour, FaFileImport, FaFileExport, } from 'react-icons/fa';
5
5
  import { PiKnifeBold } from 'react-icons/pi';
6
- import { Toolbar } from 'react-science/ui';
6
+ import { Toolbar, TooltipHelpContent, } from 'react-science/ui';
7
7
  import { useChartData } from '../context/ChartContext';
8
8
  import { useDispatch } from '../context/DispatchContext';
9
9
  import { useLoader } from '../context/LoaderContext';
10
10
  import { usePreferences } from '../context/PreferencesContext';
11
- import { CustomToolTip } from '../elements/CustomToolTip';
12
11
  import { ToolbarPopoverItem, } from '../elements/ToolbarPopoverItem';
13
12
  import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
14
13
  import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
@@ -87,7 +86,7 @@ export default function ToolBar() {
87
86
  function exportHandler(data) {
88
87
  switch (data?.id) {
89
88
  case 'svg':
90
- void saveAsSVGHandler();
89
+ saveAsSVGHandler();
91
90
  break;
92
91
  case 'png':
93
92
  void saveAsPNGHandler();
@@ -112,8 +111,8 @@ export default function ToolBar() {
112
111
  title: options.zoom.label,
113
112
  subTitles: [
114
113
  { title: 'Vertical', shortcuts: ['Scroll wheel'] },
115
- { title: 'Horizontal', shortcuts: ['SHIFT', 'Scroll wheel'] },
116
- { title: 'Pan', shortcuts: ['Right mouse'] },
114
+ { title: 'Horizontal', shortcuts: ['⇧', 'Scroll wheel'] },
115
+ { title: 'Pan', shortcuts: ['Right button'] },
117
116
  ],
118
117
  },
119
118
  icon: _jsx(FaSearchPlus, {}),
@@ -325,12 +324,12 @@ export default function ToolBar() {
325
324
  return null;
326
325
  if (isPopoverToolItem(item)) {
327
326
  const { menuItems, onClick } = item;
328
- return (_jsx(ToolbarPopoverItem, { options: menuItems, tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(CustomToolTip, { ...tooltip })), tooltipProps: {
327
+ return (_jsx(ToolbarPopoverItem, { options: menuItems, tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(TooltipHelpContent, { ...tooltip })), tooltipProps: {
329
328
  minimal: true,
330
329
  }, id: id, active: selectedTool === id, icon: icon, onClick: onClick }, id));
331
330
  }
332
331
  const { onClick } = item;
333
- return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(CustomToolTip, { ...tooltip })), tooltipProps: {
332
+ return (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), tooltip: typeof tooltip === 'string' ? (tooltip) : (_jsx(TooltipHelpContent, { ...tooltip })), tooltipProps: {
334
333
  minimal: true,
335
334
  }, id: id, active: selectedTool === id, icon: icon }, id));
336
335
  }) })] }));
@@ -4,4 +4,5 @@ export declare class PathBuilder {
4
4
  lineTo(x: number, y: number): void;
5
5
  closePath(): void;
6
6
  toString(): string;
7
+ concatPath(pathBuilder: PathBuilder): string;
7
8
  }
@@ -19,11 +19,18 @@ export class PathBuilder {
19
19
  toString() {
20
20
  return this.array.join(' ');
21
21
  }
22
+ concatPath(pathBuilder) {
23
+ return this.array.concat(pathBuilder.array).join(' ');
24
+ }
22
25
  }
23
26
  /**
24
27
  * Clamp values to avoid rendering issues of the SVG.
25
28
  * This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
26
29
  */
27
30
  function clamp(value) {
28
- return Math.max(-1e5, Math.min(1e5, value));
31
+ if (value < -1e5)
32
+ return -1e5;
33
+ if (value > 1e5)
34
+ return 1e5;
35
+ return value;
29
36
  }
@@ -0,0 +1,2 @@
1
+ import { TestContext, ValidationError } from 'yup';
2
+ export declare function checkUniqueByKey<T>(data: T[] | undefined, checkKey: keyof T, context: TestContext): true | ValidationError;
@@ -0,0 +1,40 @@
1
+ import { ValidationError } from 'yup';
2
+ export function checkUniqueByKey(data, checkKey, context) {
3
+ if (!data)
4
+ return true;
5
+ const matchesFrequencies = {};
6
+ let index = 0;
7
+ for (const datum of data) {
8
+ let key;
9
+ const matchValue = datum[checkKey];
10
+ if (typeof matchValue === 'string') {
11
+ key = matchValue.toLowerCase();
12
+ }
13
+ if (key) {
14
+ if (matchesFrequencies[key]) {
15
+ ++matchesFrequencies[key].value;
16
+ matchesFrequencies[key].fieldsIndexes.push(index);
17
+ }
18
+ else {
19
+ matchesFrequencies[key] = { value: 1, fieldsIndexes: [index] };
20
+ }
21
+ }
22
+ index++;
23
+ }
24
+ const errors = [];
25
+ for (const key in matchesFrequencies) {
26
+ const { value, fieldsIndexes } = matchesFrequencies[key];
27
+ if (value > 1) {
28
+ for (const index of fieldsIndexes) {
29
+ errors.push(context.createError({
30
+ message: `${key} must be unique`,
31
+ path: `${context.path}[${index}].${String(checkKey)}`,
32
+ }));
33
+ }
34
+ }
35
+ }
36
+ if (errors.length > 0) {
37
+ return new ValidationError(errors);
38
+ }
39
+ return true;
40
+ }
@@ -0,0 +1,9 @@
1
+ export declare function colorToHexWithAlpha(color: {
2
+ hex: string;
3
+ rgb: {
4
+ r: number;
5
+ g: number;
6
+ b: number;
7
+ a: number;
8
+ };
9
+ }): string;
@@ -0,0 +1,4 @@
1
+ export function colorToHexWithAlpha(color) {
2
+ const alphaHex = Math.round(color.rgb.a * 255).toString(16);
3
+ return `${color.hex}${alphaHex}`;
4
+ }
@@ -49,6 +49,7 @@ export const exercise = {
49
49
  strokeWidth: 1,
50
50
  showKind: false,
51
51
  showDeleteAction: true,
52
+ isSumConstant: true,
52
53
  },
53
54
  '13C': {
54
55
  showSerialNumber: true,
@@ -60,6 +61,7 @@ export const exercise = {
60
61
  strokeWidth: 1,
61
62
  showKind: false,
62
63
  showDeleteAction: true,
64
+ isSumConstant: true,
63
65
  },
64
66
  },
65
67
  },
@@ -9,7 +9,6 @@ export const process1D = {
9
9
  peaksPanel: { display: true },
10
10
  processingsPanel: { display: true },
11
11
  multipleSpectraAnalysisPanel: { display: true },
12
- matrixGenerationPanel: { display: true },
13
12
  },
14
13
  toolBarButtons: {
15
14
  zoom: true,
@@ -115,6 +115,7 @@ export const workspaceDefaultProperties = {
115
115
  format: '0',
116
116
  },
117
117
  ],
118
+ position: { x: 0, y: 0 },
118
119
  },
119
120
  onLoadProcessing: {
120
121
  autoProcessing: true,
@@ -55,13 +55,11 @@ export async function predictSpectra(molfile, options) {
55
55
  }
56
56
  function generateName(name, options) {
57
57
  const { frequency, experiment } = options;
58
- const freq = Array.isArray(frequency)
59
- ? frequency.map((f) => `${f}MHz`).join('_')
60
- : `${frequency}MHz`;
61
- return name || `${experiment.toUpperCase()}_${freq}_${v4()}`;
58
+ const freq = Array.isArray(frequency) ? frequency[0] : frequency;
59
+ return name || `${experiment.toUpperCase()}_${freq}MHz`;
62
60
  }
63
61
  export function generateSpectra(predictedSpectra, inputOptions, color, logger) {
64
- const options = JSON.parse(JSON.stringify(inputOptions));
62
+ const options = structuredClone(inputOptions);
65
63
  checkFromTo(predictedSpectra, options, logger);
66
64
  const spectra = [];
67
65
  for (const experiment in predictedSpectra) {
@@ -11,26 +11,26 @@ export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, '
11
11
  delta: number;
12
12
  multiplicity: string;
13
13
  js: import("nmr-processing").Jcoupling[];
14
- atoms?: number[] | undefined;
15
- assignment?: string | undefined;
16
- diaIDs?: string[] | undefined;
17
- nbAtoms?: number | undefined;
18
- integration?: number | undefined;
14
+ atoms?: number[];
15
+ assignment?: string;
16
+ diaIDs?: string[];
17
+ nbAtoms?: number;
18
+ integration?: number;
19
19
  statistic?: {
20
20
  mean: number;
21
21
  sd: number;
22
22
  min: number;
23
23
  max: number;
24
24
  nb: number;
25
- } | undefined;
25
+ };
26
26
  kind: string;
27
27
  id: string;
28
28
  peaks: {
29
29
  originalX: number;
30
30
  x: number;
31
31
  id: string;
32
- kind?: string | undefined;
33
- shape?: import("ml-peak-shape-generator").Shape1D | undefined;
32
+ kind?: string;
33
+ shape?: import("ml-peak-shape-generator").Shape1D;
34
34
  y: number;
35
35
  width: number;
36
36
  }[];
@@ -42,9 +42,9 @@ export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, '
42
42
  id: string;
43
43
  kind: string;
44
44
  integration: number;
45
- nbAtoms?: number | undefined;
46
- multiplicity?: string | undefined;
47
- assignment?: string | undefined;
48
- diaIDs?: string[] | undefined;
49
- pubIntegral?: number | undefined;
45
+ nbAtoms?: number;
46
+ multiplicity?: string;
47
+ assignment?: string;
48
+ diaIDs?: string[];
49
+ pubIntegral?: number;
50
50
  } | undefined;
@@ -24,21 +24,21 @@ export default function detectSignals(data: DataXY<Float64Array>, options: {
24
24
  diaIDs: never[];
25
25
  }[] | {
26
26
  delta: number;
27
- id?: string | undefined;
27
+ id?: string;
28
28
  js: import("nmr-processing").Jcoupling[];
29
- atoms?: number[] | undefined;
30
- assignment?: string | undefined;
31
- kind?: string | undefined;
29
+ atoms?: number[];
30
+ assignment?: string;
31
+ kind?: string;
32
32
  multiplicity: string;
33
- diaIDs?: string[] | undefined;
34
- nbAtoms?: number | undefined;
35
- integration?: number | undefined;
36
- peaks?: import("nmr-processing").NMRPeak1D[] | undefined;
33
+ diaIDs?: string[];
34
+ nbAtoms?: number;
35
+ integration?: number;
36
+ peaks?: import("nmr-processing").NMRPeak1D[];
37
37
  statistic?: {
38
38
  mean: number;
39
39
  sd: number;
40
40
  min: number;
41
41
  max: number;
42
42
  nb: number;
43
- } | undefined;
43
+ };
44
44
  }[];
@@ -11,26 +11,26 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
11
11
  delta: number;
12
12
  multiplicity: string;
13
13
  js: import("nmr-processing").Jcoupling[];
14
- atoms?: number[] | undefined;
15
- assignment?: string | undefined;
16
- diaIDs?: string[] | undefined;
17
- nbAtoms?: number | undefined;
18
- integration?: number | undefined;
14
+ atoms?: number[];
15
+ assignment?: string;
16
+ diaIDs?: string[];
17
+ nbAtoms?: number;
18
+ integration?: number;
19
19
  statistic?: {
20
20
  mean: number;
21
21
  sd: number;
22
22
  min: number;
23
23
  max: number;
24
24
  nb: number;
25
- } | undefined;
25
+ };
26
26
  kind: string;
27
27
  id: string;
28
28
  peaks: {
29
29
  originalX: number;
30
30
  x: number;
31
31
  id: string;
32
- kind?: string | undefined;
33
- shape?: import("ml-peak-shape-generator").Shape1D | undefined;
32
+ kind?: string;
33
+ shape?: import("ml-peak-shape-generator").Shape1D;
34
34
  y: number;
35
35
  width: number;
36
36
  }[];
@@ -42,10 +42,10 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
42
42
  id: string;
43
43
  kind: string;
44
44
  integration: number;
45
- nbAtoms?: number | undefined;
46
- multiplicity?: string | undefined;
47
- assignment?: string | undefined;
48
- diaIDs?: string[] | undefined;
49
- pubIntegral?: number | undefined;
45
+ nbAtoms?: number;
46
+ multiplicity?: string;
47
+ assignment?: string;
48
+ diaIDs?: string[];
49
+ pubIntegral?: number;
50
50
  }[];
51
51
  };
@@ -13,26 +13,26 @@ export declare function resizeRange(spectrum: Spectrum1D, options: {
13
13
  delta: number;
14
14
  multiplicity: string;
15
15
  js: import("nmr-processing").Jcoupling[];
16
- atoms?: number[] | undefined;
17
- assignment?: string | undefined;
18
- diaIDs?: string[] | undefined;
19
- nbAtoms?: number | undefined;
20
- integration?: number | undefined;
16
+ atoms?: number[];
17
+ assignment?: string;
18
+ diaIDs?: string[];
19
+ nbAtoms?: number;
20
+ integration?: number;
21
21
  statistic?: {
22
22
  mean: number;
23
23
  sd: number;
24
24
  min: number;
25
25
  max: number;
26
26
  nb: number;
27
- } | undefined;
27
+ };
28
28
  kind: string;
29
29
  id: string;
30
30
  peaks: {
31
31
  originalX: number;
32
32
  x: number;
33
33
  id: string;
34
- kind?: string | undefined;
35
- shape?: import("ml-peak-shape-generator").Shape1D | undefined;
34
+ kind?: string;
35
+ shape?: import("ml-peak-shape-generator").Shape1D;
36
36
  y: number;
37
37
  width: number;
38
38
  }[];
@@ -44,9 +44,9 @@ export declare function resizeRange(spectrum: Spectrum1D, options: {
44
44
  id: string;
45
45
  kind: string;
46
46
  integration: number;
47
- nbAtoms?: number | undefined;
48
- multiplicity?: string | undefined;
49
- assignment?: string | undefined;
50
- diaIDs?: string[] | undefined;
51
- pubIntegral?: number | undefined;
47
+ nbAtoms?: number;
48
+ multiplicity?: string;
49
+ assignment?: string;
50
+ diaIDs?: string[];
51
+ pubIntegral?: number;
52
52
  };
@@ -4,6 +4,7 @@ export interface DataBaseSignal {
4
4
  delta: number;
5
5
  }
6
6
  export interface DataBaseBasic {
7
+ spectrumID: string;
7
8
  index: number;
8
9
  names: string[];
9
10
  solvent: string;
@@ -92,13 +92,14 @@ export function prepareData(data) {
92
92
  let index = 0;
93
93
  for (const item of data) {
94
94
  const ids = [];
95
- const { ranges, ...restItemKeys } = item;
95
+ const { ranges, id: spectrumID, ...restItemKeys } = item;
96
96
  if (!ranges) {
97
- ids.push(v4());
97
+ ids.push(spectrumID);
98
98
  result.push({
99
99
  ...restItemKeys,
100
100
  index,
101
101
  id: ids,
102
+ spectrumID,
102
103
  ranges: [],
103
104
  });
104
105
  }
@@ -117,6 +118,7 @@ export function prepareData(data) {
117
118
  index,
118
119
  id: ids,
119
120
  ranges,
121
+ spectrumID,
120
122
  };
121
123
  result.push(data);
122
124
  }