nmrium 0.46.1 → 0.48.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 (81) hide show
  1. package/lib/component/1d/Line.js +1 -1
  2. package/lib/component/1d/LinesSeries.d.ts +1 -1
  3. package/lib/component/1d/LinesSeries.js +24 -3
  4. package/lib/component/1d/integral/Integration.js +2 -1
  5. package/lib/component/1d/peaks/Peaks.js +5 -4
  6. package/lib/component/1d/ranges/Range.js +3 -1
  7. package/lib/component/1d/utilities/scale.d.ts +1 -0
  8. package/lib/component/1d/utilities/scale.js +2 -1
  9. package/lib/component/context/KeyModifierContext.d.ts +1 -1
  10. package/lib/component/elements/formik/FormikColorPickerDropdown.d.ts +6 -0
  11. package/lib/component/elements/formik/FormikColorPickerDropdown.js +14 -0
  12. package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js +1 -0
  13. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
  14. package/lib/component/hooks/useExport.js +2 -2
  15. package/lib/component/hooks/useSetActiveSpectrumAction.d.ts +3 -0
  16. package/lib/component/hooks/useSetActiveSpectrumAction.js +16 -0
  17. package/lib/component/hooks/useVerticalAlign.d.ts +1 -1
  18. package/lib/component/loader/DropZone.js +4 -2
  19. package/lib/component/main/InnerNMRium.js +1 -1
  20. package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -4
  21. package/lib/component/modal/setting/GeneralSettings.js +2 -1
  22. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.d.ts +2 -0
  23. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +131 -0
  24. package/lib/component/modal/setting/settingsValidation.js +12 -1
  25. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +16 -2
  26. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +2 -2
  27. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -1
  28. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +2 -1
  29. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -5
  30. package/lib/component/panels/RangesPanel/RangesHeader.js +10 -2
  31. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +26 -38
  32. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -9
  33. package/lib/component/panels/SpectrumsPanel/base/RenderAsHTML.d.ts +7 -0
  34. package/lib/component/panels/SpectrumsPanel/base/RenderAsHTML.js +21 -0
  35. package/lib/component/panels/SpectrumsPanel/base/SpectrumName.js +0 -1
  36. package/lib/component/panels/databasePanel/DatabasePanel.js +6 -1
  37. package/lib/component/panels/databasePanel/DatabasePreferences.js +2 -2
  38. package/lib/component/panels/filtersPanel/FiltersTable.js +3 -2
  39. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +1 -1
  40. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -1
  41. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +15 -4
  42. package/lib/component/reducer/Reducer.js +2 -0
  43. package/lib/component/reducer/actions/DatabaseActions.js +1 -1
  44. package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
  45. package/lib/component/reducer/actions/DomainActions.js +2 -2
  46. package/lib/component/reducer/actions/FiltersActions.js +1 -2
  47. package/lib/component/reducer/actions/IntegralsActions.d.ts +8 -2
  48. package/lib/component/reducer/actions/IntegralsActions.js +10 -1
  49. package/lib/component/reducer/actions/LoadActions.d.ts +3 -1
  50. package/lib/component/reducer/actions/LoadActions.js +9 -4
  51. package/lib/component/reducer/actions/SpectrumsActions.js +14 -4
  52. package/lib/component/reducer/helper/getVerticalAlign.d.ts +1 -1
  53. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +0 -4
  54. package/lib/component/toolbar/FunctionToolBar.js +2 -1
  55. package/lib/component/utility/export.d.ts +3 -2
  56. package/lib/component/utility/export.js +42 -26
  57. package/lib/component/workspaces/exercise.js +1 -0
  58. package/lib/component/workspaces/prediction.js +5 -0
  59. package/lib/component/workspaces/simulation.js +5 -0
  60. package/lib/component/workspaces/workspaceDefaultProperties.js +41 -0
  61. package/lib/data/PredictionManager.js +1 -1
  62. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +9 -1
  63. package/lib/data/data1d/Spectrum1D/get1DColor.js +12 -4
  64. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts +2 -1
  65. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
  66. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +7 -6
  67. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +2 -76
  68. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +10 -0
  69. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +70 -0
  70. package/lib/data/data1d/multipleSpectraAnalysis.js +27 -40
  71. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +9 -2
  72. package/lib/data/data2d/Spectrum2D/get2DColor.js +13 -5
  73. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +10 -1
  74. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts +7 -2
  75. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -2
  76. package/lib/data/utilities/getCustomColor.d.ts +4 -0
  77. package/lib/data/utilities/getCustomColor.js +38 -0
  78. package/lib/versionInfo.js +1 -1
  79. package/package.json +25 -25
  80. package/lib/component/elements/formik/FormikColorInput.d.ts +0 -8
  81. package/lib/component/elements/formik/FormikColorInput.js +0 -15
@@ -33,7 +33,9 @@ export function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
33
33
  if (index === -1)
34
34
  index = 0;
35
35
  const info = {
36
- nucleus: datumInfo.nucleus[index], // 1H, 13C, 19F, ...
36
+ ...getInfo(datumInfo, index),
37
+ experiment: '1d',
38
+ pulseSequence: 'projection',
37
39
  isFid: false,
38
40
  isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
39
41
  dimension: 1,
@@ -41,3 +43,10 @@ export function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
41
43
  const data = getProjection(datum, index);
42
44
  return initiateDatum1D({ info, data }, { usedColors });
43
45
  }
46
+ function getInfo(info, index) {
47
+ const newInfo = {};
48
+ for (const key in info) {
49
+ newInfo[key] = Array.isArray(info[key]) ? info[key][index] : info[key];
50
+ }
51
+ return newInfo;
52
+ }
@@ -1,2 +1,7 @@
1
- import { Spectrum2D } from 'nmr-load-save';
2
- export declare function initiateDatum2D(spectrum: any, usedColors?: {}): Spectrum2D;
1
+ import { Spectrum2D, SpectrumTwoDimensionsColor } from 'nmr-load-save';
2
+ import { UsedColors } from '../../../types/UsedColors';
3
+ export interface InitiateDatum2DOptions {
4
+ usedColors?: UsedColors;
5
+ colors?: SpectrumTwoDimensionsColor[];
6
+ }
7
+ export declare function initiateDatum2D(spectrum: any, options?: InitiateDatum2DOptions): Spectrum2D;
@@ -5,7 +5,8 @@ import { DEFAULT_CONTOURS_OPTIONS } 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 };
8
- export function initiateDatum2D(spectrum, usedColors = {}) {
8
+ export function initiateDatum2D(spectrum, options = {}) {
9
+ const { usedColors, colors } = options;
9
10
  const datum = { ...spectrum };
10
11
  datum.id = spectrum.id || v4();
11
12
  datum.display = {
@@ -15,7 +16,7 @@ export function initiateDatum2D(spectrum, usedColors = {}) {
15
16
  contourOptions: DEFAULT_CONTOURS_OPTIONS,
16
17
  dimension: 2,
17
18
  ...spectrum.display,
18
- ...get2DColor(spectrum, usedColors),
19
+ ...get2DColor(spectrum, { usedColors, colors }),
19
20
  };
20
21
  datum.info = {
21
22
  nucleus: ['1H', '1H'],
@@ -0,0 +1,4 @@
1
+ import { Color2D, Spectrum1D, Spectrum2D, SpectrumOneDimensionColor, SpectrumTwoDimensionsColor } from 'nmr-load-save';
2
+ type ReturnColor<ColorType> = ColorType extends SpectrumOneDimensionColor ? string : Color2D;
3
+ export declare function getCustomColor<SpectrumType extends Spectrum1D | Spectrum2D, ColorType extends SpectrumOneDimensionColor | SpectrumTwoDimensionsColor>(spectrum: SpectrumType, colors?: ColorType[]): ReturnColor<ColorType> | null;
4
+ export {};
@@ -0,0 +1,38 @@
1
+ import lodashGet from 'lodash/get';
2
+ function getValue(spectrum, jpath) {
3
+ const value = lodashGet(spectrum, jpath);
4
+ if (typeof value === 'string') {
5
+ return value;
6
+ }
7
+ if (['number', 'boolean'].includes(typeof value)) {
8
+ return String(value);
9
+ }
10
+ if (value) {
11
+ return JSON.stringify(value);
12
+ }
13
+ return value;
14
+ }
15
+ function isInstanceOfOneDimensionColor(item) {
16
+ return 'color' in item;
17
+ }
18
+ export function getCustomColor(spectrum, colors) {
19
+ if (!colors || colors.length === 0)
20
+ return null;
21
+ let color = null;
22
+ for (const item of colors) {
23
+ const value = getValue(spectrum, item.jpath);
24
+ if (value &&
25
+ item.value &&
26
+ value.toLocaleLowerCase().includes(item.value.toLocaleLowerCase())) {
27
+ if (isInstanceOfOneDimensionColor(item)) {
28
+ color = item.color;
29
+ }
30
+ else {
31
+ const { negativeColor, positiveColor } = item;
32
+ color = { negativeColor, positiveColor };
33
+ }
34
+ break;
35
+ }
36
+ }
37
+ return color;
38
+ }
@@ -1 +1 @@
1
- export default { version: 'v0.46.1' };
1
+ export default { version: 'v0.48.0' };
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.46.1",
4
+ "version": "0.48.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  "url": "git+https://github.com/cheminfo/nmrium.git"
46
46
  },
47
47
  "volta": {
48
- "node": "20.10.0"
48
+ "node": "20.11.0"
49
49
  },
50
50
  "overrides": {
51
51
  "react": "$react",
@@ -56,20 +56,20 @@
56
56
  "react-dom": ">=18.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@blueprintjs/core": "^5.7.2",
60
- "@blueprintjs/icons": "^5.5.0",
61
- "@emotion/react": "^11.11.1",
59
+ "@blueprintjs/core": "^5.8.2",
60
+ "@blueprintjs/icons": "^5.7.0",
61
+ "@emotion/react": "^11.11.3",
62
62
  "@emotion/styled": "^11.11.0",
63
63
  "@lukeed/uuid": "^2.0.1",
64
- "cheminfo-font": "^1.12.0",
64
+ "cheminfo-font": "^1.13.0",
65
65
  "cheminfo-types": "^1.7.2",
66
- "clipboard-polyfill": "^4.0.1",
66
+ "clipboard-polyfill": "^4.0.2",
67
67
  "convert-to-jcamp": "^5.4.9",
68
68
  "d3": "^7.8.5",
69
69
  "eventemitter3": "^5.0.1",
70
70
  "fifo-logger": "^0.6.1",
71
71
  "file-saver": "^2.0.5",
72
- "filelist-utils": "^1.10.2",
72
+ "filelist-utils": "^1.11.0",
73
73
  "formik": "^2.4.5",
74
74
  "immer": "^10.0.3",
75
75
  "jszip": "^3.10.1",
@@ -86,7 +86,7 @@
86
86
  "ml-stat": "^1.3.3",
87
87
  "multiplet-analysis": "^2.1.2",
88
88
  "nmr-correlation": "^2.3.3",
89
- "nmr-load-save": "^0.23.11",
89
+ "nmr-load-save": "^0.24.0",
90
90
  "nmr-processing": "^11.7.0",
91
91
  "nmredata": "^0.9.9",
92
92
  "numeral": "^2.0.6",
@@ -97,7 +97,7 @@
97
97
  "react-d3-utils": "^1.0.0",
98
98
  "react-dropzone": "^14.2.3",
99
99
  "react-error-boundary": "^4.0.12",
100
- "react-icons": "^4.12.0",
100
+ "react-icons": "^5.0.1",
101
101
  "react-inspector": "^6.0.2",
102
102
  "react-mf": "^2.0.2",
103
103
  "react-ocl": "^6.1.0",
@@ -108,7 +108,7 @@
108
108
  "react-slider": "^2.0.6",
109
109
  "react-table": "^7.8.0",
110
110
  "react-transition-group": "^4.4.5",
111
- "react-use": "^17.4.2",
111
+ "react-use": "^17.5.0",
112
112
  "smart-array-filter": "^4.0.2",
113
113
  "yup": "^1.3.3"
114
114
  },
@@ -116,36 +116,36 @@
116
116
  "@babel/plugin-transform-modules-commonjs": "^7.23.3",
117
117
  "@babel/preset-react": "^7.23.3",
118
118
  "@babel/preset-typescript": "^7.23.3",
119
- "@playwright/test": "^1.40.1",
119
+ "@playwright/test": "^1.41.1",
120
120
  "@simbathesailor/use-what-changed": "^2.0.0",
121
121
  "@types/d3": "^7.4.3",
122
122
  "@types/lodash": "^4.14.202",
123
- "@types/node": "^20.10.5",
123
+ "@types/node": "^20.11.5",
124
124
  "@types/papaparse": "^5.3.14",
125
- "@types/react": "^18.2.45",
125
+ "@types/react": "^18.2.48",
126
126
  "@types/react-dom": "^18.2.18",
127
- "@types/react-table": "^7.7.18",
127
+ "@types/react-table": "^7.7.19",
128
128
  "@vitejs/plugin-react-swc": "^3.5.0",
129
- "@vitest/coverage-v8": "^1.0.4",
129
+ "@vitest/coverage-v8": "^1.2.1",
130
130
  "cross-env": "^7.0.3",
131
- "cspell": "^8.1.3",
131
+ "cspell": "^8.3.2",
132
132
  "eslint": "^8.56.0",
133
133
  "eslint-config-cheminfo-react": "^10.1.0",
134
134
  "eslint-config-cheminfo-typescript": "^12.1.0",
135
135
  "modern-normalize": "^2.0.0",
136
- "postcss-styled-syntax": "^0.5.0",
137
- "prettier": "^3.1.1",
136
+ "postcss-styled-syntax": "^0.6.4",
137
+ "prettier": "^3.2.4",
138
138
  "rc-menu": "^9.12.4",
139
139
  "react": "^18.2.0",
140
140
  "react-dom": "^18.2.0",
141
- "react-router-dom": "^6.21.0",
141
+ "react-router-dom": "^6.21.3",
142
142
  "rimraf": "^5.0.5",
143
143
  "rollup-plugin-analyzer": "^4.0.0",
144
144
  "serve": "^14.2.1",
145
- "stylelint": "^16.0.2",
146
- "stylelint-config-standard": "^35.0.0",
145
+ "stylelint": "^16.2.0",
146
+ "stylelint-config-standard": "^36.0.0",
147
147
  "typescript": "^5.3.3",
148
- "vite": "^5.0.10",
149
- "vitest": "^1.0.4"
148
+ "vite": "^5.0.12",
149
+ "vitest": "^1.2.1"
150
150
  }
151
- }
151
+ }
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { ColorInputProps } from '../ColorInput';
3
- interface FormikColorPickerProps extends ColorInputProps {
4
- name: string;
5
- }
6
- declare function FormikColorPicker(props: FormikColorPickerProps): import("react/jsx-runtime").JSX.Element;
7
- declare const _default: import("react").MemoExoticComponent<typeof FormikColorPicker>;
8
- export default _default;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useFormikContext } from 'formik';
3
- import lodashGet from 'lodash/get';
4
- import { useCallback, memo } from 'react';
5
- import ColorInput from '../ColorInput';
6
- function FormikColorPicker(props) {
7
- const { onColorChange = () => null, name, ...colorPickerProps } = props;
8
- const { values, setFieldValue } = useFormikContext();
9
- const colorChangeHandler = useCallback((color) => {
10
- onColorChange(color);
11
- void setFieldValue(name, color.hex);
12
- }, [name, onColorChange, setFieldValue]);
13
- return (_jsx(ColorInput, { ...colorPickerProps, name: name, onColorChange: colorChangeHandler, value: lodashGet(values, name) }));
14
- }
15
- export default memo(FormikColorPicker);