nmrium 0.56.0 → 0.57.1

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 (167) hide show
  1. package/lib/component/1d/ExclusionZoneAnnotation.d.ts +0 -1
  2. package/lib/component/1d/database/DatabaseSpectrum.js +14 -19
  3. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +0 -1
  4. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +0 -1
  5. package/lib/component/1d/peaks/PeakEditionManager.js +16 -10
  6. package/lib/component/1d/utilities/getDecimalsCount.js +1 -1
  7. package/lib/component/1d/utilities/intersectionResolver.js +1 -1
  8. package/lib/component/1d-2d/FieldEdition.d.ts +3 -1
  9. package/lib/component/1d-2d/FieldEdition.js +26 -10
  10. package/lib/component/2d/1d-tracer/Left1DChart.d.ts +0 -1
  11. package/lib/component/2d/1d-tracer/Top1DChart.d.ts +0 -1
  12. package/lib/component/2d/XAxis.d.ts +0 -1
  13. package/lib/component/2d/YAxis.d.ts +0 -1
  14. package/lib/component/2d/ft/Contours.js +7 -7
  15. package/lib/component/assignment/AssignmentsContext.d.ts +0 -1
  16. package/lib/component/context/ChartContext.d.ts +0 -1
  17. package/lib/component/context/DispatchContext.d.ts +0 -1
  18. package/lib/component/context/GlobalContext.d.ts +0 -1
  19. package/lib/component/context/KeyModifierContext.js +1 -1
  20. package/lib/component/context/LoaderContext.d.ts +0 -1
  21. package/lib/component/context/PreferencesContext.d.ts +0 -1
  22. package/lib/component/context/ScaleContext.d.ts +0 -1
  23. package/lib/component/elements/ActionButtons.d.ts +1 -0
  24. package/lib/component/elements/ActionButtons.js +4 -4
  25. package/lib/component/elements/ColorInput.d.ts +0 -1
  26. package/lib/component/elements/ColorPickerDropdownController.d.ts +2 -0
  27. package/lib/component/elements/ColorPickerDropdownController.js +8 -0
  28. package/lib/component/elements/ColumnWrapper.d.ts +0 -1
  29. package/lib/component/elements/ContextMenu.d.ts +0 -1
  30. package/lib/component/elements/Input.d.ts +1 -0
  31. package/lib/component/elements/Input.js +2 -1
  32. package/lib/component/elements/Input2.d.ts +13 -0
  33. package/lib/component/elements/Input2.js +118 -0
  34. package/lib/component/elements/Input2Controller.d.ts +12 -0
  35. package/lib/component/elements/Input2Controller.js +22 -0
  36. package/lib/component/elements/MoleculeSelection.js +1 -1
  37. package/lib/component/elements/NumberInput.js +1 -1
  38. package/lib/component/elements/NumberInput2.d.ts +12 -0
  39. package/lib/component/elements/NumberInput2.js +65 -0
  40. package/lib/component/elements/NumberInput2Controller.d.ts +8 -0
  41. package/lib/component/elements/NumberInput2Controller.js +15 -0
  42. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +3 -3
  43. package/lib/component/elements/ReactTable/Style.d.ts +3 -1
  44. package/lib/component/elements/ReactTable/Style.js +11 -1
  45. package/lib/component/elements/ReactTable/utility/ReactTableContext.d.ts +0 -1
  46. package/lib/component/elements/Select2.d.ts +26 -0
  47. package/lib/component/elements/Select2.js +25 -0
  48. package/lib/component/elements/Select2Controller.d.ts +7 -0
  49. package/lib/component/elements/Select2Controller.js +12 -0
  50. package/lib/component/elements/draggable/useDraggable.d.ts +0 -1
  51. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +2 -4
  52. package/lib/component/elements/dropDownButton/DropDownButton.js +11 -37
  53. package/lib/component/elements/dropDownButton/DropDownList.js +3 -32
  54. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  55. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +0 -1
  56. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  57. package/lib/component/elements/formik/FormikInput2.d.ts +11 -0
  58. package/lib/component/elements/formik/FormikInput2.js +26 -0
  59. package/lib/component/elements/formik/FormikOnChange.d.ts +0 -1
  60. package/lib/component/elements/popup/Modal/Context.d.ts +0 -1
  61. package/lib/component/elements/popup/Modal/ModalContent.d.ts +0 -1
  62. package/lib/component/elements/resizer/SVGResizer.d.ts +0 -1
  63. package/lib/component/elements/useFormValidateField.d.ts +1 -0
  64. package/lib/component/elements/useFormValidateField.js +9 -0
  65. package/lib/component/header/ApodizationOptionsPanel.js +26 -11
  66. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +1 -4
  67. package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -16
  68. package/lib/component/header/BaseLineCorrectionPanel.js +49 -27
  69. package/lib/component/header/Header.js +1 -1
  70. package/lib/component/header/PhaseCorrectionPanel.js +12 -24
  71. package/lib/component/header/RangesPickingOptionPanel.js +12 -12
  72. package/lib/component/header/ZeroFillingOptionsPanel.js +18 -7
  73. package/lib/component/header/Zones2DOptionPanel.js +19 -18
  74. package/lib/component/hooks/useWorkspaceAction.d.ts +1 -1
  75. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +0 -1
  76. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +0 -1
  77. package/lib/component/modal/setting/GeneralSettings.d.ts +5 -1
  78. package/lib/component/modal/setting/GeneralSettings.js +107 -111
  79. package/lib/component/modal/setting/WorkspaceItem.js +4 -9
  80. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  81. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +95 -59
  82. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +33 -25
  83. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +15 -4
  84. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +56 -39
  85. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +36 -36
  86. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +44 -36
  87. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +16 -11
  88. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +47 -40
  89. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +50 -40
  90. package/lib/component/modal/setting/settingsValidation.js +8 -34
  91. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +0 -1
  92. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +0 -1
  93. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +0 -1
  94. package/lib/component/panels/Panels.js +31 -8
  95. package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +0 -1
  96. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +0 -1
  97. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +0 -1
  98. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +0 -1
  99. package/lib/component/panels/SpectraPanel/SpectraPreferences.d.ts +0 -1
  100. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +32 -24
  101. package/lib/component/panels/SpectraPanel/SpectraTable.js +17 -2
  102. package/lib/component/panels/SpectraPanel/SpectrumListPanel.d.ts +0 -1
  103. package/lib/component/panels/SpectraPanel/base/ColorIndicator.d.ts +0 -1
  104. package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.d.ts +3 -3
  105. package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.js +25 -16
  106. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DHistogram.d.ts +0 -1
  107. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +15 -5
  108. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.d.ts +0 -1
  109. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +44 -6
  110. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.d.ts +0 -1
  111. package/lib/component/panels/SummaryPanel/Overview.d.ts +0 -1
  112. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts +0 -1
  113. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +1 -1
  114. package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +0 -1
  115. package/lib/component/panels/databasePanel/DatabasePanel.js +17 -3
  116. package/lib/component/panels/databasePanel/DatabasePreferences.d.ts +0 -1
  117. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +11 -4
  118. package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
  119. package/lib/component/panels/informationPanel/InformationEditionModal.d.ts +6 -0
  120. package/lib/component/panels/informationPanel/InformationEditionModal.js +105 -0
  121. package/lib/component/panels/informationPanel/InformationPanel.d.ts +1 -0
  122. package/lib/component/panels/{InformationPanel.js → informationPanel/InformationPanel.js} +2 -2
  123. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts +0 -1
  124. package/lib/component/panels/multipleAnalysisPanel/preferences/index.d.ts +0 -1
  125. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +0 -1
  126. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +1 -1
  127. package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +0 -1
  128. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +0 -1
  129. package/lib/component/reducer/Reducer.d.ts +1 -1
  130. package/lib/component/reducer/Reducer.js +2 -0
  131. package/lib/component/reducer/actions/DatabaseActions.js +22 -5
  132. package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
  133. package/lib/component/reducer/actions/SpectraActions.js +58 -21
  134. package/lib/component/reducer/actions/ToolsActions.js +3 -4
  135. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +7 -7
  136. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +2 -0
  137. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  138. package/lib/component/utility/checkUniqueByKey.d.ts +2 -0
  139. package/lib/component/utility/checkUniqueByKey.js +40 -0
  140. package/lib/component/utility/colorToHexWithAlpha.d.ts +9 -0
  141. package/lib/component/utility/colorToHexWithAlpha.js +4 -0
  142. package/lib/component/workspaces/exercise.js +2 -0
  143. package/lib/component/workspaces/process1D.js +0 -1
  144. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  145. package/lib/data/PredictionManager.js +3 -5
  146. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +13 -13
  147. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +9 -9
  148. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -13
  149. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +13 -13
  150. package/lib/data/data1d/database.d.ts +1 -0
  151. package/lib/data/data1d/database.js +4 -2
  152. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -22
  153. package/lib/data/data2d/Spectrum2D/contours.js +88 -67
  154. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +4 -2
  155. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +20 -20
  156. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +20 -20
  157. package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
  158. package/lib/data/initiateFilters.d.ts +1 -1
  159. package/lib/data/matrixGeneration.js +1 -2
  160. package/lib/data/types/common/Keys.d.ts +3 -0
  161. package/lib/data/types/common/Keys.js +1 -0
  162. package/lib/data/utilities/generateNumbersPowerOfX.d.ts +2 -2
  163. package/lib/versionInfo.js +1 -1
  164. package/package.json +32 -31
  165. package/lib/component/elements/formik/FormikSlider.d.ts +0 -6
  166. package/lib/component/elements/formik/FormikSlider.js +0 -15
  167. package/lib/component/panels/InformationPanel.d.ts +0 -1
@@ -1,88 +1,99 @@
1
1
  import { Conrec } from 'ml-conrec';
2
+ import { xMaxAbsoluteValue } from 'ml-spectra-processing';
2
3
  import { calculateSanPlot } from '../../utilities/calculateSanPlot';
3
4
  const DEFAULT_CONTOURS_OPTIONS = {
4
5
  positive: {
5
- contourLevels: [0, 21],
6
+ contourLevels: [15, 100],
6
7
  numberOfLayers: 10,
7
8
  },
8
9
  negative: {
9
- contourLevels: [0, 21],
10
+ contourLevels: [15, 100],
10
11
  numberOfLayers: 10,
11
12
  },
12
13
  };
13
14
  const LEVEL_SIGNS = ['positive', 'negative'];
14
- function getDefaultContoursLevel(options) {
15
- const defaultLevel = { negative: 10, positive: 10 };
16
- for (const sign of LEVEL_SIGNS) {
17
- const [min, max] = options[sign].contourLevels;
18
- defaultLevel[sign] = min + max / 2;
19
- }
15
+ function getDefaultContoursLevel(spectrum, quadrant = 'rr') {
16
+ const { data, info } = spectrum;
17
+ const quadrantData = data[quadrant];
18
+ //@ts-expect-error will be included in nexts versions
19
+ const { noise = calculateSanPlot('2D', quadrantData) } = info;
20
+ const { positive, negative } = noise;
21
+ const max = Math.max(Math.abs(quadrantData.minZ), Math.abs(quadrantData.maxZ));
22
+ const value = 3 * xMaxAbsoluteValue([positive, negative]);
23
+ const minLevel = calculateValueOfLevel(value, max, true);
24
+ const defaultLevel = {
25
+ negative: {
26
+ numberOfLayers: 10,
27
+ contourLevels: [minLevel, 100],
28
+ },
29
+ positive: {
30
+ numberOfLayers: 10,
31
+ contourLevels: [minLevel, 100],
32
+ },
33
+ };
20
34
  return defaultLevel;
21
35
  }
22
- function contoursManager(spectrumID, state, options) {
23
- const spectraLevels = { ...state };
24
- const contourOptions = { ...options };
25
- if (!state?.[spectrumID]) {
26
- const defaultLevel = getDefaultContoursLevel(contourOptions);
27
- spectraLevels[spectrumID] = defaultLevel;
28
- }
29
- const currentLevel = spectraLevels[spectrumID];
30
- const wheel = (value, altKey) => prepareWheel(value, { altKey, contourOptions, currentLevel });
31
- const getLevel = () => currentLevel;
32
- const checkLevel = () => prepareCheckLevel(currentLevel, contourOptions);
36
+ function contoursManager(spectrum) {
37
+ const contourOptions = { ...spectrum.display.contourOptions };
38
+ const wheel = (value, altKey) => prepareWheel(value, { altKey, contourOptions });
39
+ const getLevel = () => contourOptions;
40
+ const checkLevel = () => prepareCheckLevel(contourOptions);
33
41
  return { wheel, getLevel, checkLevel };
34
42
  }
35
43
  function prepareWheel(value, options) {
36
- const { altKey, currentLevel, contourOptions } = options;
44
+ const { altKey, contourOptions } = options;
37
45
  const sign = Math.sign(value);
38
- const positiveBoundary = contourOptions.positive.contourLevels;
39
- const negativeBoundary = contourOptions.negative.contourLevels;
46
+ const { positive, negative } = contourOptions;
47
+ const { contourLevels: [minPositiveLevel, maxPositiveLevel], } = positive;
48
+ const { contourLevels: [minNegativeLevel, maxNegativeLevel], } = negative;
40
49
  if (altKey) {
41
- if ((currentLevel.positive === positiveBoundary[0] && sign === -1) ||
42
- (currentLevel.positive >= positiveBoundary[1] && sign === 1)) {
43
- return currentLevel;
50
+ if ((minPositiveLevel === 0 && sign === -1) ||
51
+ (minPositiveLevel >= maxPositiveLevel - positive.numberOfLayers &&
52
+ sign === 1)) {
53
+ return contourOptions;
44
54
  }
45
- currentLevel.positive += sign;
55
+ contourOptions.positive.contourLevels[0] += sign * 2;
46
56
  }
47
57
  else {
48
- if ((currentLevel.positive > positiveBoundary[0] && sign === -1) ||
49
- (currentLevel.positive < positiveBoundary[1] && sign === 1)) {
50
- currentLevel.positive += sign;
58
+ if ((minPositiveLevel > 0 && sign === -1) ||
59
+ (minPositiveLevel <= maxPositiveLevel - positive.numberOfLayers &&
60
+ sign === 1)) {
61
+ contourOptions.positive.contourLevels[0] += sign * 2;
51
62
  }
52
- if ((currentLevel.negative > negativeBoundary[0] && sign === -1) ||
53
- (currentLevel.negative < negativeBoundary[1] && sign === 1)) {
54
- currentLevel.negative += sign;
63
+ if ((minNegativeLevel > 0 && sign === -1) ||
64
+ (minNegativeLevel <= maxNegativeLevel - negative.numberOfLayers &&
65
+ sign === 1)) {
66
+ contourOptions.negative.contourLevels[0] += sign * 2;
55
67
  }
56
68
  }
57
- return currentLevel;
69
+ return contourOptions;
58
70
  }
59
- function prepareCheckLevel(currentLevel, options) {
60
- const level = { ...currentLevel };
71
+ function prepareCheckLevel(options) {
61
72
  for (const sign of LEVEL_SIGNS) {
62
- const [min, max] = options[sign].contourLevels;
73
+ const { numberOfLayers, contourLevels: [min, max], } = options[sign];
63
74
  //check if the level is out of the boundary
64
- if (level[sign] > max) {
65
- level[sign] = max;
75
+ if (min >= max - numberOfLayers) {
76
+ const newMin = Math.min(100 - numberOfLayers, Math.max(0, min));
77
+ options[sign].contourLevels = [newMin, newMin + numberOfLayers];
66
78
  }
67
- else if (level[sign] < min) {
68
- level[sign] = min;
79
+ else if (min < 0) {
80
+ options[sign].contourLevels[0] = 0;
69
81
  }
70
82
  }
71
- return level;
83
+ return options;
72
84
  }
73
85
  function getRange(min, max, length, exp) {
74
86
  if (exp !== undefined) {
75
- const factors = [];
76
- factors[0] = 0;
77
- for (let i = 1; i <= length; i++) {
87
+ const factors = new Float64Array(length + 1);
88
+ for (let i = 1; i < length + 1; i++) {
78
89
  factors[i] = factors[i - 1] + (exp - 1) / exp ** i;
79
90
  }
80
- const lastFactor = factors[length];
81
- const result = new Array(length);
91
+ const scaleFactor = factors[length - 1];
92
+ const result = new Float64Array(length);
82
93
  for (let i = 0; i < length; i++) {
83
- result[i] = (max - min) * (1 - factors[i + 1] / lastFactor) + min;
94
+ result[i] = (max - min) * (1 - factors[i] / scaleFactor) + min;
84
95
  }
85
- return result;
96
+ return Array.from(result);
86
97
  }
87
98
  else {
88
99
  const step = (max - min) / (length - 1);
@@ -97,42 +108,52 @@ function range(from, to, step) {
97
108
  return result;
98
109
  }
99
110
  function drawContours(level, spectrum, negative = false, quadrant = 'rr') {
100
- const zoom = level / 2 + 1;
101
- const { positive: { numberOfLayers: numberOfPositiveLayer }, negative: { numberOfLayers: numberOfNegativeLayer }, } = spectrum.display.contourOptions;
102
- if (negative) {
103
- return getContours(zoom, {
104
- negative,
105
- nbLevels: numberOfNegativeLayer,
106
- data: spectrum.data[quadrant],
107
- });
108
- }
109
- return getContours(zoom, {
110
- nbLevels: numberOfPositiveLayer,
111
+ const { contourLevels, numberOfLayers } = level;
112
+ return getContours({
113
+ negative,
114
+ boundary: contourLevels,
115
+ nbLevels: numberOfLayers,
111
116
  data: spectrum.data[quadrant],
112
117
  });
113
118
  }
114
- function getContours(zoomLevel, options) {
115
- const { negative = false, timeout = 2000, nbLevels, data } = options;
119
+ function getContours(options) {
120
+ const { boundary, negative = false, timeout = 2000, nbLevels, data, } = options;
116
121
  const xs = getRange(data.minX, data.maxX, data.z[0].length);
117
122
  const ys = getRange(data.minY, data.maxY, data.z.length);
118
123
  const conrec = new Conrec(data.z, { xs, ys, swapAxes: false });
119
- const sanResult = calculateSanPlot('2D', data);
120
- const median = sanResult.positive;
121
- const max = Math.max(Math.abs(data.maxZ), Math.abs(data.minZ));
122
- let _range = getRange(median * 1 * 2 ** zoomLevel, max, nbLevels, 2);
124
+ const max = Math.max(Math.abs(data.minZ), Math.abs(data.maxZ));
125
+ const minLevel = calculateValueOfLevel(boundary[0], max);
126
+ const maxLevel = calculateValueOfLevel(boundary[1], max);
127
+ const diffRange = boundary[1] - boundary[0];
128
+ let _range = getRange(minLevel, maxLevel, Math.min(nbLevels, diffRange), 2);
123
129
  if (negative) {
124
130
  _range = _range.map((value) => -value);
125
131
  }
126
132
  if (_range.every((r) => r === 0)) {
133
+ const emptyLine = [];
127
134
  return {
128
- contours: _range.map((r) => ({ zValue: r, lines: [] })),
135
+ contours: _range.map((r) => ({ zValue: r, lines: emptyLine })),
129
136
  timeout: false,
130
137
  };
131
138
  }
132
139
  return conrec.drawContour({
133
140
  contourDrawer: 'basic',
134
- levels: _range,
141
+ levels: Array.from(_range),
135
142
  timeout,
136
143
  });
137
144
  }
145
+ /**
146
+ * calculate the intensity value in the Z matrix based in the max value of Z matrix
147
+ * and the contour level (0-100).
148
+ * max * (2 ** (level / 10) - 1)) / (2 ** 10 - 1)
149
+ * @param level - integer of the contour level
150
+ * @param max - max value of the Z matrix
151
+ * @param invert - if it is true it calculates the contour level.
152
+ */
153
+ function calculateValueOfLevel(level, max, invert = false) {
154
+ if (invert) {
155
+ return Math.ceil(10 * Math.log2(1 + (level * (2 ** 10 - 1)) / max));
156
+ }
157
+ return (max * (2 ** (level / 10) - 1)) / (2 ** 10 - 1);
158
+ }
138
159
  export { drawContours, contoursManager, getDefaultContoursLevel, DEFAULT_CONTOURS_OPTIONS, };
@@ -1,7 +1,7 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
2
  import { FiltersManager } from 'nmr-processing';
3
3
  import { initiateFilters } from '../../initiateFilters';
4
- import { DEFAULT_CONTOURS_OPTIONS } from './contours';
4
+ import { DEFAULT_CONTOURS_OPTIONS, getDefaultContoursLevel } from './contours';
5
5
  import { get2DColor } from './get2DColor';
6
6
  import { initiateZones } from './zones/initiateZones';
7
7
  const defaultMinMax = { z: [], minX: 0, minY: 0, maxX: 0, maxY: 0 };
@@ -13,7 +13,9 @@ export function initiateDatum2D(spectrum, options = {}) {
13
13
  isPositiveVisible: true,
14
14
  isNegativeVisible: true,
15
15
  isVisible: true,
16
- contourOptions: DEFAULT_CONTOURS_OPTIONS,
16
+ contourOptions: 'rr' in spectrum.data
17
+ ? getDefaultContoursLevel(spectrum)
18
+ : DEFAULT_CONTOURS_OPTIONS,
17
19
  dimension: 2,
18
20
  ...spectrum.display,
19
21
  ...get2DColor(spectrum, { usedColors, colors }),
@@ -17,50 +17,50 @@ export declare function detectZonesManual(datum: any, options: DetectionZonesOpt
17
17
  x: number;
18
18
  y: number;
19
19
  z: number;
20
- originalX?: number | undefined;
21
- originalY?: number | undefined;
22
- originalZ?: number | undefined;
20
+ originalX?: number;
21
+ originalY?: number;
22
+ originalZ?: number;
23
23
  width?: number | {
24
24
  x: number;
25
25
  y: number;
26
- } | undefined;
26
+ };
27
27
  }[] | undefined;
28
28
  id: string;
29
29
  kind: string;
30
30
  x: {
31
31
  originalDelta: number;
32
32
  delta: number;
33
- nbAtoms?: number | undefined;
34
- diaIDs?: string[] | undefined;
33
+ nbAtoms?: number;
34
+ diaIDs?: string[];
35
35
  };
36
36
  y: {
37
37
  originalDelta: number;
38
38
  delta: number;
39
- nbAtoms?: number | undefined;
40
- diaIDs?: string[] | undefined;
39
+ nbAtoms?: number;
40
+ diaIDs?: string[];
41
41
  };
42
- sign?: number | undefined;
42
+ sign?: number;
43
43
  j?: {
44
- pathLength?: number | import("cheminfo-types").FromTo | undefined;
45
- } | undefined;
44
+ pathLength?: number | import("cheminfo-types").FromTo;
45
+ };
46
46
  }[];
47
47
  kind: string;
48
48
  x: {
49
49
  from: number;
50
50
  to: number;
51
- nbAtoms?: number | undefined;
52
- diaIDs?: string[] | undefined;
53
- originalFrom?: number | undefined;
54
- originalTo?: number | undefined;
51
+ nbAtoms?: number;
52
+ diaIDs?: string[];
53
+ originalFrom?: number;
54
+ originalTo?: number;
55
55
  };
56
56
  y: {
57
57
  from: number;
58
58
  to: number;
59
- nbAtoms?: number | undefined;
60
- diaIDs?: string[] | undefined;
61
- originalFrom?: number | undefined;
62
- originalTo?: number | undefined;
59
+ nbAtoms?: number;
60
+ diaIDs?: string[];
61
+ originalFrom?: number;
62
+ originalTo?: number;
63
63
  };
64
64
  id: string;
65
- assignment?: string | undefined;
65
+ assignment?: string;
66
66
  }[];
@@ -17,51 +17,51 @@ export declare function initiateZones(options: Partial<{
17
17
  x: number;
18
18
  y: number;
19
19
  z: number;
20
- originalX?: number | undefined;
21
- originalY?: number | undefined;
22
- originalZ?: number | undefined;
20
+ originalX?: number;
21
+ originalY?: number;
22
+ originalZ?: number;
23
23
  width?: number | {
24
24
  x: number;
25
25
  y: number;
26
- } | undefined;
26
+ };
27
27
  }[] | undefined;
28
28
  id: string;
29
29
  kind: string;
30
30
  x: {
31
31
  originalDelta: number;
32
32
  delta: number;
33
- nbAtoms?: number | undefined;
34
- diaIDs?: string[] | undefined;
33
+ nbAtoms?: number;
34
+ diaIDs?: string[];
35
35
  };
36
36
  y: {
37
37
  originalDelta: number;
38
38
  delta: number;
39
- nbAtoms?: number | undefined;
40
- diaIDs?: string[] | undefined;
39
+ nbAtoms?: number;
40
+ diaIDs?: string[];
41
41
  };
42
- sign?: number | undefined;
42
+ sign?: number;
43
43
  j?: {
44
- pathLength?: number | import("cheminfo-types").FromTo | undefined;
45
- } | undefined;
44
+ pathLength?: number | import("cheminfo-types").FromTo;
45
+ };
46
46
  }[];
47
47
  kind: string;
48
48
  x: {
49
49
  from: number;
50
50
  to: number;
51
- nbAtoms?: number | undefined;
52
- diaIDs?: string[] | undefined;
53
- originalFrom?: number | undefined;
54
- originalTo?: number | undefined;
51
+ nbAtoms?: number;
52
+ diaIDs?: string[];
53
+ originalFrom?: number;
54
+ originalTo?: number;
55
55
  };
56
56
  y: {
57
57
  from: number;
58
58
  to: number;
59
- nbAtoms?: number | undefined;
60
- diaIDs?: string[] | undefined;
61
- originalFrom?: number | undefined;
62
- originalTo?: number | undefined;
59
+ nbAtoms?: number;
60
+ diaIDs?: string[];
61
+ originalFrom?: number;
62
+ originalTo?: number;
63
63
  };
64
64
  id: string;
65
- assignment?: string | undefined;
65
+ assignment?: string;
66
66
  }[];
67
67
  };
@@ -10,7 +10,7 @@ export type MatrixFilters = Array<{
10
10
  options: FiltersObjectRecord;
11
11
  }>;
12
12
  export declare function getDefaultMatrixFilters(): {
13
- name: "fromTo" | "centerMean" | "centerMedian" | "normed" | "divideBySD" | "rescale" | "paretoNormalization" | "airPLSBaseline" | "iterativePolynomialBaseline" | "rollingAverageBaseline" | "rollingBallBaseline" | "rollingMedianBaseline" | "firstDerivative" | "secondDerivative" | "thirdDerivative" | "savitzkyGolay" | "ensureGrowing" | "equallySpaced" | "filterX" | "calibrateX" | "xFunction" | "yFunction";
13
+ name: FilterXYType["name"];
14
14
  options: FiltersObjectRecord;
15
15
  }[];
16
16
  export {};
@@ -1,7 +1,7 @@
1
1
  import { Filter } from 'nmr-processing';
2
2
  export declare function initiateFilters(inputFilters: Filter[] | undefined): {
3
3
  id: string;
4
- error?: string | undefined;
4
+ error?: string;
5
5
  name: string;
6
6
  value: any;
7
7
  isDeleteAllow: boolean;
@@ -50,8 +50,7 @@ function flattenFields(filterName, data, properties, keysPath, parentObject, lev
50
50
  if (_keysPathObject?.type === 'list') {
51
51
  const previousKey = _keysPath.slice(0, -1).join('.');
52
52
  properties[previousKey] = _keysPathObject;
53
- properties[previousKey].properties[_keysPath.join('.')] =
54
- fieldData;
53
+ _keysPathObject.properties[_keysPath.join('.')] = fieldData;
55
54
  }
56
55
  else if (data[fieldKey].enum) {
57
56
  const { enum: choices, ...restProps } = fieldData;
@@ -0,0 +1,3 @@
1
+ export type Keys<T> = T extends object ? T extends infer O ? {
2
+ [K in keyof O]-?: K extends string | number | symbol ? `${K & string}${Keys<O[K]> extends '' ? '' : '.'}${Keys<O[K]>}` : never;
3
+ }[keyof O] | keyof O : never : '';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,7 @@
1
1
  export default function generateNumbersPowerOfX(start: number, end: number, options?: {
2
2
  power?: number;
3
- format?: (input: number) => string | number;
3
+ format?: (input: number) => string;
4
4
  }): {
5
- label: string | number;
5
+ label: string;
6
6
  value: number;
7
7
  }[];
@@ -1 +1 @@
1
- export default { version: 'v0.56.0' };
1
+ export default { version: 'v0.57.1' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.56.0",
4
+ "version": "0.57.1",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "url": "git+https://github.com/cheminfo/nmrium.git"
47
47
  },
48
48
  "volta": {
49
- "node": "20.14.0"
49
+ "node": "20.15.0"
50
50
  },
51
51
  "overrides": {
52
52
  "react": "$react",
@@ -57,11 +57,12 @@
57
57
  "react-dom": ">=18.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@blueprintjs/core": "^5.10.3",
61
- "@blueprintjs/icons": "^5.9.0",
62
- "@blueprintjs/select": "^5.1.5",
60
+ "@blueprintjs/core": "^5.10.4",
61
+ "@blueprintjs/icons": "^5.10.0",
62
+ "@blueprintjs/select": "^5.2.0",
63
63
  "@emotion/react": "^11.11.4",
64
64
  "@emotion/styled": "^11.11.5",
65
+ "@hookform/resolvers": "^3.6.0",
65
66
  "@lukeed/uuid": "^2.0.1",
66
67
  "cheminfo-font": "^1.13.0",
67
68
  "cheminfo-types": "^1.7.3",
@@ -83,33 +84,33 @@
83
84
  "ml-baseline-correction-regression": "^2.0.1",
84
85
  "ml-conrec": "^5.0.2",
85
86
  "ml-gsd": "^12.1.6",
86
- "ml-matrix": "^6.11.0",
87
+ "ml-matrix": "^6.11.1",
87
88
  "ml-signal-processing": "^1.0.4",
88
- "ml-spectra-processing": "^14.5.0",
89
+ "ml-spectra-processing": "^14.5.1",
89
90
  "ml-stat": "^1.3.3",
90
91
  "ml-tree-similarity": "^2.2.0",
91
92
  "multiplet-analysis": "^2.1.2",
92
93
  "nmr-correlation": "^2.3.3",
93
- "nmr-load-save": "^0.33.1",
94
- "nmr-processing": "^12.3.2",
95
- "nmredata": "^0.9.9",
94
+ "nmr-load-save": "^0.34.2",
95
+ "nmr-processing": "^12.5.0",
96
+ "nmredata": "^0.9.11",
96
97
  "numeral": "^2.0.6",
97
- "openchemlib": "^8.13.0",
98
- "openchemlib-utils": "^5.21.1",
98
+ "openchemlib": "^8.14.0",
99
+ "openchemlib-utils": "^6.1.0",
99
100
  "papaparse": "^5.4.1",
100
101
  "re-resizable": "6.9.17",
101
102
  "react-d3-utils": "^1.0.0",
102
103
  "react-dropzone": "^14.2.3",
103
104
  "react-error-boundary": "^4.0.13",
105
+ "react-hook-form": "^7.52.0",
104
106
  "react-icons": "^5.2.1",
105
107
  "react-inspector": "^6.0.2",
106
- "react-mf": "^2.0.2",
108
+ "react-mf": "^2.0.3",
107
109
  "react-ocl": "^6.1.0",
108
- "react-ocl-nmr": "^3.0.1",
110
+ "react-ocl-nmr": "^3.0.2",
109
111
  "react-plot": "^1.4.2",
110
112
  "react-rnd": "^10.4.11",
111
- "react-science": "^4.0.0",
112
- "react-slider": "^2.0.6",
113
+ "react-science": "^4.1.2",
113
114
  "react-table": "^7.8.0",
114
115
  "react-transition-group": "^4.4.5",
115
116
  "react-use": "^17.5.0",
@@ -117,14 +118,14 @@
117
118
  "yup": "^1.4.0"
118
119
  },
119
120
  "devDependencies": {
120
- "@babel/plugin-transform-modules-commonjs": "^7.24.6",
121
- "@babel/preset-react": "^7.24.6",
122
- "@babel/preset-typescript": "^7.24.6",
123
- "@playwright/test": "^1.44.1",
121
+ "@babel/plugin-transform-modules-commonjs": "^7.24.7",
122
+ "@babel/preset-react": "^7.24.7",
123
+ "@babel/preset-typescript": "^7.24.7",
124
+ "@playwright/test": "^1.45.0",
124
125
  "@simbathesailor/use-what-changed": "^2.0.0",
125
126
  "@types/d3": "^7.4.3",
126
- "@types/lodash": "^4.17.4",
127
- "@types/node": "^20.12.13",
127
+ "@types/lodash": "^4.17.6",
128
+ "@types/node": "^20.14.9",
128
129
  "@types/papaparse": "^5.3.14",
129
130
  "@types/react": "^18.3.3",
130
131
  "@types/react-dom": "^18.3.0",
@@ -132,24 +133,24 @@
132
133
  "@vitejs/plugin-react-swc": "^3.7.0",
133
134
  "@vitest/coverage-v8": "^1.6.0",
134
135
  "cross-env": "^7.0.3",
135
- "cspell": "^8.8.3",
136
+ "cspell": "^8.9.1",
136
137
  "eslint": "^8.57.0",
137
- "eslint-config-cheminfo-react": "^11.0.1",
138
- "eslint-config-cheminfo-typescript": "^12.4.0",
138
+ "eslint-config-cheminfo-react": "^12.0.0",
139
+ "eslint-config-cheminfo-typescript": "^13.0.0",
139
140
  "modern-normalize": "^2.0.0",
140
141
  "postcss-styled-syntax": "^0.6.4",
141
- "prettier": "^3.2.5",
142
- "rc-menu": "^9.14.0",
142
+ "prettier": "^3.3.2",
143
+ "rc-menu": "^9.14.1",
143
144
  "react": "^18.3.1",
144
145
  "react-dom": "^18.3.1",
145
- "react-router-dom": "^6.23.1",
146
+ "react-router-dom": "^6.24.0",
146
147
  "rimraf": "^5.0.7",
147
148
  "rollup-plugin-analyzer": "^4.0.0",
148
149
  "serve": "^14.2.3",
149
150
  "stylelint": "^16.6.1",
150
- "stylelint-config-standard": "^36.0.0",
151
- "typescript": "^5.4.5",
152
- "vite": "^5.2.12",
151
+ "stylelint-config-standard": "^36.0.1",
152
+ "typescript": "^5.5.2",
153
+ "vite": "^5.3.2",
153
154
  "vitest": "^1.6.0"
154
155
  }
155
156
  }
@@ -1,6 +0,0 @@
1
- interface FormikSliderProps {
2
- name: string;
3
- debounceTime?: number;
4
- }
5
- declare function FormikSlider(props: FormikSliderProps): import("react/jsx-runtime").JSX.Element;
6
- export default FormikSlider;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useFormikContext } from 'formik';
3
- import debounce from 'lodash/debounce';
4
- import lodashGet from 'lodash/get';
5
- import { useRef } from 'react';
6
- import ReactSlider from 'react-slider';
7
- function FormikSlider(props) {
8
- const { name, debounceTime = 0 } = props;
9
- const { values, setFieldValue } = useFormikContext();
10
- const debounceOnChange = useRef(debounce((value) => {
11
- void setFieldValue(name, value);
12
- }, debounceTime)).current;
13
- return (_jsx(ReactSlider, { className: "horizontal-slider", thumbClassName: "thumb", trackClassName: "track", defaultValue: lodashGet(values, name, [0, 100]), onAfterChange: (value) => debounceOnChange(value), renderThumb: (props, state) => (_jsx("div", { ...props, children: _jsx("span", { children: state.valueNow }) })), pearling: true, minDistance: 10 }));
14
- }
15
- export default FormikSlider;
@@ -1 +0,0 @@
1
- export default function InformationPanel(): import("react/jsx-runtime").JSX.Element;