nmrium 0.56.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 (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
@@ -7,6 +7,7 @@ import { getReferenceShift, isSpectrum1D, get1DColor, initiateDatum1D, generateS
7
7
  import { simulateSpectrum, } from '../../../data/data1d/spectrumSimulation';
8
8
  import { getMissingProjection, isSpectrum2D, get2DColor, } from '../../../data/data2d/Spectrum2D';
9
9
  import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
10
+ import { adjustAlpha, generateColor, } from '../../../data/utilities/generateColor';
10
11
  import groupByInfoKey from '../../utility/GroupByInfoKey';
11
12
  import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
12
13
  import { setZoom } from '../helper/Zoom1DManager';
@@ -232,16 +233,15 @@ function handleChangeSpectrumSetting(draft, action) {
232
233
  const spectrum = draft.data[index];
233
234
  spectrum.display = display;
234
235
  if (isSpectrum2D(spectrum)) {
235
- const contoursLevels = draft.view.zoom.levels;
236
- const { checkLevel } = contoursManager(spectrum.id, contoursLevels, spectrum.display.contourOptions);
237
- contoursLevels[spectrum.id] = checkLevel();
236
+ const { checkLevel } = contoursManager(spectrum);
237
+ checkLevel();
238
238
  }
239
239
  }
240
240
  }
241
241
  //action
242
242
  function handleDeleteSpectra(draft, action) {
243
243
  const state = original(draft);
244
- const { id: spectraId } = action?.payload || {};
244
+ const { id: spectraId, domainOptions } = action?.payload || {};
245
245
  if (spectraId) {
246
246
  const index = state.data.findIndex((d) => d.id === spectraId);
247
247
  draft.data.splice(index, 1);
@@ -261,6 +261,7 @@ function handleDeleteSpectra(draft, action) {
261
261
  setActiveTab(draft, {
262
262
  tab: draft.view.spectra.activeTab,
263
263
  refreshActiveTab: true,
264
+ domainOptions,
264
265
  });
265
266
  }
266
267
  //action
@@ -322,37 +323,66 @@ function handleImportSpectraMetaInfo(draft, action) {
322
323
  function handleToggleSpectraLegend(draft) {
323
324
  draft.view.spectra.showLegend = !draft.view.spectra.showLegend;
324
325
  }
326
+ function groupSpectraByClass(spectra, jpath) {
327
+ const spectraByClass = {};
328
+ for (const spectrum of spectra) {
329
+ const key = String(lodashGet(spectrum, jpath, ''))
330
+ .toLowerCase()
331
+ .trim()
332
+ .replace(/\r?\n|\r/, '');
333
+ if (spectraByClass[key]) {
334
+ spectraByClass[key].push(spectrum);
335
+ }
336
+ else {
337
+ spectraByClass[key] = [spectrum];
338
+ }
339
+ }
340
+ return spectraByClass;
341
+ }
325
342
  //action
326
343
  function handleRecolorSpectraBasedOnDistinctValue(draft, action) {
327
344
  const { data, view: { spectra: { activeTab }, }, } = draft;
328
345
  const { jpath = null, customColors } = action.payload;
329
- const spectra = getSpectraByNucleus(activeTab, data);
346
+ const spectraByNucleus = getSpectraByNucleus(activeTab, data);
330
347
  if (jpath) {
331
348
  //recolor spectra based on distinct value
332
- const spectraByClass = {};
333
- for (const spectrum of spectra) {
334
- const key = String(lodashGet(spectrum, jpath, ''))
335
- .toLowerCase()
336
- .trim()
337
- .replace(/\r?\n|\r/, '');
338
- if (spectraByClass[key]) {
339
- if (isSpectrum1D(spectrum)) {
340
- spectrum.display.color = spectraByClass[key].display.color;
341
- }
342
- else {
343
- spectrum.display.positiveColor = spectraByClass[key].display.positiveColor;
344
- spectrum.display.negativeColor = spectraByClass[key].display.negativeColor;
349
+ const spectraByClass = groupSpectraByClass(spectraByNucleus, jpath);
350
+ const usedColors = [];
351
+ for (const spectra of Object.values(spectraByClass)) {
352
+ let color;
353
+ if (isSpectrum1D(spectra[0])) {
354
+ color = spectra[0].display.color;
355
+ if (usedColors.includes(color)) {
356
+ color = generateColor({ usedColors });
345
357
  }
358
+ usedColors.push(color);
346
359
  }
347
360
  else {
348
- spectraByClass[key] = spectrum;
361
+ const { positiveColor: pColor, negativeColor: nColor } = spectra[0].display;
362
+ color = { positiveColor: pColor, negativeColor: nColor };
363
+ if (usedColors.includes(pColor)) {
364
+ const positiveColor = generateColor({
365
+ usedColors,
366
+ });
367
+ const negativeColor = adjustAlpha(positiveColor, 50);
368
+ color = { positiveColor, negativeColor };
369
+ }
370
+ usedColors.push(color.positiveColor);
371
+ }
372
+ for (const spectrum of spectra) {
373
+ if (typeof color === 'string') {
374
+ spectrum.display = { ...spectrum.display, color };
375
+ }
376
+ else {
377
+ spectrum.display = { ...spectrum.display, ...color };
378
+ }
349
379
  }
350
380
  }
351
381
  }
352
382
  else {
353
383
  //reset spectra colors
354
384
  const usedColors = { '1d': [], '2d': [] };
355
- for (const spectrum of spectra) {
385
+ for (const spectrum of spectraByNucleus) {
356
386
  if (isSpectrum1D(spectrum)) {
357
387
  spectrum.display.color = get1DColor(spectrum, {
358
388
  usedColors,
@@ -432,4 +462,11 @@ function handleSimulateSpectrum(draft, simulateSpectrumOptions) {
432
462
  setActiveTab(draft);
433
463
  }
434
464
  }
435
- export { handleChangeSpectrumVisibilityById, handleChangeSpectraVisibilityByNucleus, handleChangeActiveSpectrum, handleChangeSpectrumSetting, handleDeleteSpectra, handleAddMissingProjectionHandler, handleAlignSpectraHandler, handleGenerateSpectrumFromPublicationStringHandler, handleImportSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, handleSimulateSpectrum, setSpectraMetaInfo, };
465
+ function handleUpdateSpectrumMeta(draft, action) {
466
+ const { payload: { meta }, } = action;
467
+ const activeSpectrum = getActiveSpectrum(draft);
468
+ if (!activeSpectrum)
469
+ return null;
470
+ draft.data[activeSpectrum.index].customInfo = meta;
471
+ }
472
+ export { handleChangeSpectrumVisibilityById, handleChangeSpectraVisibilityByNucleus, handleChangeActiveSpectrum, handleChangeSpectrumSetting, handleDeleteSpectra, handleAddMissingProjectionHandler, handleAlignSpectraHandler, handleGenerateSpectrumFromPublicationStringHandler, handleImportSpectraMetaInfo, handleToggleSpectraLegend, handleRecolorSpectraBasedOnDistinctValue, handleOrderSpectra, handleSimulateSpectrum, setSpectraMetaInfo, handleUpdateSpectrumMeta, };
@@ -466,7 +466,7 @@ function handelSetActiveTab(draft, action) {
466
466
  }
467
467
  function levelChangeHandler(draft, action) {
468
468
  const { deltaY, altKey } = action.payload.options;
469
- const { data, view: { spectra: { activeTab }, zoom: { levels }, }, } = draft;
469
+ const { data, view: { spectra: { activeTab }, }, } = draft;
470
470
  const activeSpectra = getActiveSpectra(draft) || [];
471
471
  const activeSpectraObj = {};
472
472
  for (const activeSpectrum of activeSpectra) {
@@ -476,9 +476,8 @@ function levelChangeHandler(draft, action) {
476
476
  (activeSpectraObj?.[spectrum.id] || activeSpectra.length === 0));
477
477
  try {
478
478
  for (const spectrum of spectra) {
479
- const contourOptions = spectrum.display.contourOptions;
480
- const zoom = contoursManager(spectrum.id, levels, contourOptions);
481
- levels[spectrum.id] = zoom.wheel(deltaY, altKey);
479
+ const zoom = contoursManager(spectrum);
480
+ zoom.wheel(deltaY, altKey);
482
481
  }
483
482
  }
484
483
  catch (error) {
@@ -1,12 +1,12 @@
1
1
  import { MatrixGenerationOptions, PanelsPreferences } from 'nmr-load-save';
2
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'];
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"];
8
8
  declare const databaseDefaultValues: PanelsPreferences['database'];
9
- declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences['multipleSpectraAnalysis'];
9
+ declare const getMultipleSpectraAnalysisDefaultValues: (nucleus?: string) => PanelsPreferences["multipleSpectraAnalysis"];
10
10
  declare function getMatrixGenerationDefaultOptions(): DeepPartial<MatrixGenerationOptions>;
11
- declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences['matrixGeneration'];
11
+ declare const getMatrixGenerationDefaultValues: (nucleus?: string) => PanelsPreferences["matrixGeneration"];
12
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
  };
@@ -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';
@@ -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
  }
@@ -1,10 +1,11 @@
1
1
  import { Spectrum2D } from 'nmr-load-save';
2
2
  interface Level {
3
- positive: number;
4
- negative: number;
3
+ positive: ContourItem;
4
+ negative: ContourItem;
5
5
  }
6
+ type ContourLevels = [number, number];
6
7
  interface ContourItem {
7
- contourLevels: [number, number];
8
+ contourLevels: ContourLevels;
8
9
  numberOfLayers: number;
9
10
  }
10
11
  interface ContourOptions {
@@ -12,30 +13,15 @@ interface ContourOptions {
12
13
  negative: ContourItem;
13
14
  }
14
15
  type ContoursLevels = Record<string, Level>;
15
- declare const DEFAULT_CONTOURS_OPTIONS: {
16
- positive: {
17
- contourLevels: number[];
18
- numberOfLayers: number;
19
- };
20
- negative: {
21
- contourLevels: number[];
22
- numberOfLayers: number;
23
- };
24
- };
16
+ declare const DEFAULT_CONTOURS_OPTIONS: ContourOptions;
25
17
  type LevelSign = keyof Level;
26
18
  interface ReturnContoursManager {
27
19
  wheel: (value: number, shift: boolean) => Level;
28
20
  getLevel: () => Level;
29
21
  checkLevel: () => Level;
30
22
  }
31
- declare function getDefaultContoursLevel(options: ContourOptions): Level;
32
- declare function contoursManager(spectrumID: string, state: ContoursLevels, options: ContourOptions): ReturnContoursManager;
33
- declare function drawContours(level: number, spectrum: Spectrum2D, negative?: boolean, quadrant?: string): import("ml-conrec").DrawContourResult<"basic"> | {
34
- contours: {
35
- zValue: any;
36
- lines: never[];
37
- }[];
38
- timeout: boolean;
39
- };
23
+ declare function getDefaultContoursLevel(spectrum: Spectrum2D, quadrant?: string): ContourOptions;
24
+ declare function contoursManager(spectrum: Spectrum2D): ReturnContoursManager;
25
+ declare function drawContours(level: ContourItem, spectrum: Spectrum2D, negative?: boolean, quadrant?: string): import("ml-conrec").DrawContourResult<"basic">;
40
26
  export { drawContours, contoursManager, getDefaultContoursLevel, DEFAULT_CONTOURS_OPTIONS, };
41
27
  export type { ContoursLevels, ReturnContoursManager, Level, LevelSign };