nmrium 1.10.0 → 1.11.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.
- package/lib/component/1d/BrushTracker1D.d.ts.map +1 -1
- package/lib/component/1d/BrushTracker1D.js +7 -0
- package/lib/component/1d/BrushTracker1D.js.map +1 -1
- package/lib/component/1d/FloatPublicationString.d.ts.map +1 -1
- package/lib/component/1d/FloatPublicationString.js +1 -1
- package/lib/component/1d/FloatPublicationString.js.map +1 -1
- package/lib/component/1d/FloatingRanges.d.ts.map +1 -1
- package/lib/component/1d/FloatingRanges.js +1 -1
- package/lib/component/1d/FloatingRanges.js.map +1 -1
- package/lib/component/1d/inset/DraggableInset.d.ts.map +1 -1
- package/lib/component/1d/inset/DraggableInset.js +1 -1
- package/lib/component/1d/inset/DraggableInset.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +11 -2
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js.map +1 -1
- package/lib/component/2d/useTracesSpectra.d.ts.map +1 -1
- package/lib/component/2d/useTracesSpectra.js +3 -2
- package/lib/component/2d/useTracesSpectra.js.map +1 -1
- package/lib/component/EventsTrackers/KeysListenerTracker.js +3 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js.map +1 -1
- package/lib/component/elements/NextPrev.d.ts.map +1 -1
- package/lib/component/elements/NextPrev.js +23 -4
- package/lib/component/elements/NextPrev.js.map +1 -1
- package/lib/component/elements/export/utilities/exportOptionValidationSchema.d.ts +1 -1
- package/lib/component/hooks/useExport.d.ts +7 -7
- package/lib/component/hooks/useExport.d.ts.map +1 -1
- package/lib/component/hooks/useExport.js +22 -42
- package/lib/component/hooks/useExport.js.map +1 -1
- package/lib/component/hooks/useSetActiveSpectrumAction.d.ts.map +1 -1
- package/lib/component/hooks/useSetActiveSpectrumAction.js +3 -1
- package/lib/component/hooks/useSetActiveSpectrumAction.js.map +1 -1
- package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
- package/lib/component/loader/useLoadFiles.js +81 -86
- package/lib/component/loader/useLoadFiles.js.map +1 -1
- package/lib/component/main/ErrorOverlay.d.ts.map +1 -1
- package/lib/component/main/ErrorOverlay.js +6 -1
- package/lib/component/main/ErrorOverlay.js.map +1 -1
- package/lib/component/main/InnerNMRiumContents.d.ts.map +1 -1
- package/lib/component/main/InnerNMRiumContents.js +1 -2
- package/lib/component/main/InnerNMRiumContents.js.map +1 -1
- package/lib/component/main/NMRiumViewer.js +1 -1
- package/lib/component/main/NMRiumViewer.js.map +1 -1
- package/lib/component/main/NMRiumViewerWrapper.d.ts.map +1 -1
- package/lib/component/main/NMRiumViewerWrapper.js +11 -3
- package/lib/component/main/NMRiumViewerWrapper.js.map +1 -1
- package/lib/component/modal/MoleculeAutoLabelsDatabaseModal.d.ts +6 -0
- package/lib/component/modal/MoleculeAutoLabelsDatabaseModal.d.ts.map +1 -0
- package/lib/component/modal/MoleculeAutoLabelsDatabaseModal.js +127 -0
- package/lib/component/modal/MoleculeAutoLabelsDatabaseModal.js.map +1 -0
- package/lib/component/modal/SaveAsModal.d.ts.map +1 -1
- package/lib/component/modal/SaveAsModal.js +4 -8
- package/lib/component/modal/SaveAsModal.js.map +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js.map +1 -1
- package/lib/component/modal/changeSum/SelectMolecule.js +4 -1
- package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +71 -16
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +3 -12
- package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
- package/lib/component/panels/Panels.d.ts +0 -9
- package/lib/component/panels/Panels.d.ts.map +1 -1
- package/lib/component/panels/Panels.js +1 -29
- package/lib/component/panels/Panels.js.map +1 -1
- package/lib/component/panels/hooks/useTogglePanel.d.ts.map +1 -1
- package/lib/component/panels/hooks/useTogglePanel.js +4 -3
- package/lib/component/panels/hooks/useTogglePanel.js.map +1 -1
- package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -1
- package/lib/component/reducer/actions/LoadAction.js +6 -0
- package/lib/component/reducer/actions/LoadAction.js.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +23 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
- package/lib/component/reducer/actions/RangesActions.js +1 -1
- package/lib/component/reducer/actions/RangesActions.js.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.d.ts +2 -1
- package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.js +2 -2
- package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
- package/lib/component/reducer/preferences/actions/analyzeSpectra.d.ts +2 -1
- package/lib/component/reducer/preferences/actions/analyzeSpectra.d.ts.map +1 -1
- package/lib/component/reducer/preferences/actions/analyzeSpectra.js +10 -0
- package/lib/component/reducer/preferences/actions/analyzeSpectra.js.map +1 -1
- package/lib/component/reducer/preferences/actions/toggleOpenSplitPanel.d.ts +4 -0
- package/lib/component/reducer/preferences/actions/toggleOpenSplitPanel.d.ts.map +1 -0
- package/lib/component/reducer/preferences/actions/toggleOpenSplitPanel.js +9 -0
- package/lib/component/reducer/preferences/actions/toggleOpenSplitPanel.js.map +1 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +8 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +6 -1
- package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
- package/lib/component/toolbar/ToolBar.d.ts.map +1 -1
- package/lib/component/toolbar/ToolBar.js +6 -7
- package/lib/component/toolbar/ToolBar.js.map +1 -1
- package/lib/component/toolbar/toolbarMenu.d.ts +5 -1
- package/lib/component/toolbar/toolbarMenu.d.ts.map +1 -1
- package/lib/component/toolbar/toolbarMenu.js +1 -1
- package/lib/component/toolbar/toolbarMenu.js.map +1 -1
- package/lib/component/utility/export.d.ts +2 -1
- package/lib/component/utility/export.d.ts.map +1 -1
- package/lib/component/utility/export.js +5 -1
- package/lib/component/utility/export.js.map +1 -1
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -0
- package/lib/data/data1d/multipleSpectraAnalysis.d.ts.map +1 -1
- package/lib/data/data1d/multipleSpectraAnalysis.js +14 -0
- package/lib/data/data1d/multipleSpectraAnalysis.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +13 -6
- package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +6 -1
- package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
- package/lib/data/molecules/MoleculeManager.js +3 -2
- package/lib/data/molecules/MoleculeManager.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +39 -39
- package/src/component/1d/BrushTracker1D.tsx +8 -0
- package/src/component/1d/FloatPublicationString.tsx +0 -1
- package/src/component/1d/FloatingRanges.tsx +0 -1
- package/src/component/1d/inset/DraggableInset.tsx +0 -1
- package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +11 -2
- package/src/component/2d/useTracesSpectra.ts +4 -3
- package/src/component/EventsTrackers/KeysListenerTracker.tsx +3 -3
- package/src/component/elements/NextPrev.tsx +28 -4
- package/src/component/hooks/useExport.tsx +34 -64
- package/src/component/hooks/useSetActiveSpectrumAction.ts +3 -2
- package/src/component/loader/useLoadFiles.ts +134 -111
- package/src/component/main/ErrorOverlay.tsx +11 -2
- package/src/component/main/InnerNMRiumContents.tsx +6 -9
- package/src/component/main/NMRiumViewer.tsx +2 -2
- package/src/component/main/NMRiumViewerWrapper.tsx +14 -6
- package/src/component/modal/MoleculeAutoLabelsDatabaseModal.tsx +219 -0
- package/src/component/modal/SaveAsModal.tsx +14 -41
- package/src/component/modal/changeSum/ChangeSumModal.tsx +1 -1
- package/src/component/modal/changeSum/SelectMolecule.tsx +23 -23
- package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +94 -15
- package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +3 -17
- package/src/component/panels/Panels.tsx +1 -53
- package/src/component/panels/hooks/useTogglePanel.ts +4 -3
- package/src/component/reducer/actions/LoadAction.ts +15 -1
- package/src/component/reducer/actions/MoleculeActions.ts +4 -2
- package/src/component/reducer/actions/RangesActions.ts +1 -1
- package/src/component/reducer/actions/SpectraActions.ts +6 -2
- package/src/component/reducer/preferences/actions/analyzeSpectra.ts +16 -0
- package/src/component/reducer/preferences/actions/toggleOpenSplitPanel.ts +18 -0
- package/src/component/reducer/preferences/preferencesReducer.ts +22 -1
- package/src/component/toolbar/ToolBar.tsx +9 -9
- package/src/component/toolbar/toolbarMenu.tsx +13 -2
- package/src/component/utility/export.ts +6 -0
- package/src/data/data1d/multipleSpectraAnalysis.ts +20 -0
- package/src/data/data2d/Spectrum2D/contours.ts +16 -6
- package/src/data/molecules/MoleculeManager.ts +7 -2
- package/src/versionInfo.ts +1 -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": "1.
|
|
4
|
+
"version": "1.11.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -68,48 +68,48 @@
|
|
|
68
68
|
"@emotion/react": "^11.14.0",
|
|
69
69
|
"@emotion/styled": "^11.14.1",
|
|
70
70
|
"@hookform/resolvers": "^5.2.2",
|
|
71
|
-
"@tanstack/react-form": "^1.
|
|
71
|
+
"@tanstack/react-form": "^1.27.7",
|
|
72
72
|
"@zakodium/nmr-types": "^0.5.0",
|
|
73
|
-
"@zakodium/nmrium-core": "^0.
|
|
74
|
-
"@zakodium/nmrium-core-plugins": "^0.6.
|
|
73
|
+
"@zakodium/nmrium-core": "^0.6.0",
|
|
74
|
+
"@zakodium/nmrium-core-plugins": "^0.6.29",
|
|
75
75
|
"@zakodium/pdnd-esm": "^1.0.2",
|
|
76
|
-
"@zip.js/zip.js": "^2.8.
|
|
76
|
+
"@zip.js/zip.js": "^2.8.15",
|
|
77
77
|
"cheminfo-font": "^1.13.1",
|
|
78
|
-
"cheminfo-types": "^1.
|
|
78
|
+
"cheminfo-types": "^1.10.0",
|
|
79
79
|
"clipboard-polyfill": "^4.1.1",
|
|
80
80
|
"d3-array": "^3.2.4",
|
|
81
81
|
"d3-scale": "^4.0.2",
|
|
82
82
|
"d3-zoom": "^3.0.0",
|
|
83
83
|
"dlv": "^1.1.3",
|
|
84
|
-
"eventemitter3": "^5.0.
|
|
84
|
+
"eventemitter3": "^5.0.4",
|
|
85
85
|
"fifo-logger": "^2.0.1",
|
|
86
|
-
"file-collection": "^6.
|
|
86
|
+
"file-collection": "^6.6.0",
|
|
87
87
|
"file-saver": "^2.0.5",
|
|
88
|
-
"get-jpaths": "^1.
|
|
89
|
-
"immer": "^11.
|
|
90
|
-
"lodash": "^4.17.
|
|
88
|
+
"get-jpaths": "^1.4.0",
|
|
89
|
+
"immer": "^11.1.3",
|
|
90
|
+
"lodash": "^4.17.23",
|
|
91
91
|
"mf-parser": "^3.6.0",
|
|
92
92
|
"ml-array-mean": "^1.1.6",
|
|
93
93
|
"ml-array-median": "^1.1.6",
|
|
94
94
|
"ml-conrec": "^5.0.3",
|
|
95
95
|
"ml-gsd": "^13.1.1",
|
|
96
|
-
"ml-signal-processing": "^2.
|
|
97
|
-
"ml-spectra-processing": "^14.
|
|
96
|
+
"ml-signal-processing": "^2.2.0",
|
|
97
|
+
"ml-spectra-processing": "^14.19.0",
|
|
98
98
|
"ml-tree-similarity": "^2.2.0",
|
|
99
99
|
"nmr-correlation": "2.3.3",
|
|
100
|
-
"nmr-processing": "^22.
|
|
100
|
+
"nmr-processing": "^22.1.0",
|
|
101
101
|
"numeral": "^2.0.6",
|
|
102
|
-
"openchemlib": "^9.
|
|
103
|
-
"openchemlib-utils": "^8.
|
|
102
|
+
"openchemlib": "^9.19.0",
|
|
103
|
+
"openchemlib-utils": "^8.12.1",
|
|
104
104
|
"papaparse": "^5.5.3",
|
|
105
105
|
"react-d3-utils": "^3.1.2",
|
|
106
106
|
"react-dropzone": "^14.3.8",
|
|
107
|
-
"react-error-boundary": "^6.
|
|
108
|
-
"react-hook-form": "^7.
|
|
107
|
+
"react-error-boundary": "^6.1.0",
|
|
108
|
+
"react-hook-form": "^7.71.1",
|
|
109
109
|
"react-icons": "^5.5.0",
|
|
110
110
|
"react-inspector": "^9.0.0",
|
|
111
111
|
"react-mf": "^3.1.1",
|
|
112
|
-
"react-ocl": "^8.
|
|
112
|
+
"react-ocl": "^8.5.0",
|
|
113
113
|
"react-ocl-nmr": "^4.1.1",
|
|
114
114
|
"react-plot": "^3.1.2",
|
|
115
115
|
"react-rnd": "^10.5.2",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"react-table": "^7.8.0",
|
|
118
118
|
"smart-array-filter": "^5.0.0",
|
|
119
119
|
"yup": "^1.7.1",
|
|
120
|
-
"zod": "^4.
|
|
120
|
+
"zod": "^4.3.5"
|
|
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
|
-
"@blueprintjs/core": "^6.
|
|
124
|
-
"@blueprintjs/icons": "^6.
|
|
125
|
-
"@blueprintjs/select": "^6.0.
|
|
123
|
+
"@blueprintjs/core": "^6.6.1",
|
|
124
|
+
"@blueprintjs/icons": "^6.5.0",
|
|
125
|
+
"@blueprintjs/select": "^6.0.13",
|
|
126
126
|
"@playwright/test": "^1.57.0",
|
|
127
127
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
128
128
|
"@types/d3-array": "^3.2.2",
|
|
@@ -130,40 +130,40 @@
|
|
|
130
130
|
"@types/d3-zoom": "^3.0.8",
|
|
131
131
|
"@types/dlv": "^1.1.5",
|
|
132
132
|
"@types/file-saver": "^2.0.7",
|
|
133
|
-
"@types/lodash": "^4.17.
|
|
134
|
-
"@types/node": "^
|
|
133
|
+
"@types/lodash": "^4.17.23",
|
|
134
|
+
"@types/node": "^25.0.10",
|
|
135
135
|
"@types/numeral": "^2.0.5",
|
|
136
|
-
"@types/papaparse": "^5.5.
|
|
136
|
+
"@types/papaparse": "^5.5.2",
|
|
137
137
|
"@types/react": "^18.3.13",
|
|
138
138
|
"@types/react-dom": "^18.3.1",
|
|
139
139
|
"@types/react-table": "^7.7.20",
|
|
140
|
-
"@vitejs/plugin-react": "^5.1.
|
|
141
|
-
"@vitest/coverage-v8": "^4.0.
|
|
140
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
141
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
142
142
|
"@zakodium/tsconfig": "^1.0.2",
|
|
143
143
|
"cross-env": "^10.1.0",
|
|
144
|
-
"cspell": "^9.
|
|
145
|
-
"eslint": "^9.39.
|
|
146
|
-
"eslint-config-cheminfo-react": "^19.0.
|
|
144
|
+
"cspell": "^9.6.0",
|
|
145
|
+
"eslint": "^9.39.2",
|
|
146
|
+
"eslint-config-cheminfo-react": "^19.0.1",
|
|
147
147
|
"eslint-config-cheminfo-typescript": "^21.0.1",
|
|
148
|
-
"knip": "^5.
|
|
148
|
+
"knip": "^5.82.1",
|
|
149
149
|
"modern-normalize": "^3.0.1",
|
|
150
150
|
"postcss": "^8.5.6",
|
|
151
151
|
"postcss-styled-syntax": "^0.7.1",
|
|
152
|
-
"prettier": "^3.
|
|
152
|
+
"prettier": "^3.8.1",
|
|
153
153
|
"rc-menu": "^9.16.1",
|
|
154
154
|
"react": "^18.3.1",
|
|
155
155
|
"react-dom": "^18.3.1",
|
|
156
|
-
"react-router-dom": "^7.
|
|
156
|
+
"react-router-dom": "^7.12.0",
|
|
157
157
|
"rimraf": "^6.1.2",
|
|
158
158
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
159
159
|
"serve": "^14.2.5",
|
|
160
|
-
"stylelint": "^
|
|
161
|
-
"stylelint-config-standard": "^
|
|
160
|
+
"stylelint": "^17.0.0",
|
|
161
|
+
"stylelint-config-standard": "^40.0.0",
|
|
162
162
|
"typescript": "~5.9.3",
|
|
163
|
-
"vite": "^7.
|
|
164
|
-
"vitest": "^4.0.
|
|
163
|
+
"vite": "^7.3.1",
|
|
164
|
+
"vitest": "^4.0.17"
|
|
165
165
|
},
|
|
166
166
|
"volta": {
|
|
167
|
-
"node": "24.
|
|
167
|
+
"node": "24.12.0"
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -451,6 +451,14 @@ export function BrushTracker1D({ children }: Required<PropsWithChildren>) {
|
|
|
451
451
|
}
|
|
452
452
|
break;
|
|
453
453
|
}
|
|
454
|
+
case 'multipleSpectraAnalysis': {
|
|
455
|
+
dispatchPreferences({
|
|
456
|
+
type: 'CUT_SPECTRA_ANALYSIS',
|
|
457
|
+
payload: { x: xPPM, nucleus: activeTab },
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
454
462
|
case 'phaseCorrection':
|
|
455
463
|
dispatch({
|
|
456
464
|
type: 'SET_ONE_DIMENSION_PIVOT_POINT',
|
|
@@ -269,7 +269,6 @@ function DraggablePublicationString(props: DraggablePublicationStringProps) {
|
|
|
269
269
|
dragHandleClassName="handle"
|
|
270
270
|
enableUserSelectHack={false}
|
|
271
271
|
bounds={`#${viewerRef.id}`}
|
|
272
|
-
style={{ zIndex: 1 }}
|
|
273
272
|
onDragStart={() => setIsMoveActive(true)}
|
|
274
273
|
onResize={(e, dir, eRef, size, position) =>
|
|
275
274
|
handleResize({ ...size, ...position })
|
|
@@ -301,7 +301,6 @@ function DraggableRanges(props: DraggablePublicationStringProps) {
|
|
|
301
301
|
dragHandleClassName="handle"
|
|
302
302
|
enableUserSelectHack={false}
|
|
303
303
|
bounds={`#${viewerRef.id}`}
|
|
304
|
-
style={{ zIndex: 1 }}
|
|
305
304
|
onDragStart={() => setIsMoveActive(true)}
|
|
306
305
|
onResize={(e, dir, eRef, size, position) =>
|
|
307
306
|
handleResize({ ...size, ...position })
|
|
@@ -189,7 +189,6 @@ export function DraggableInset(props: Inset) {
|
|
|
189
189
|
dragHandleClassName="handle"
|
|
190
190
|
enableUserSelectHack={false}
|
|
191
191
|
bounds={`#${viewerRef.id}`}
|
|
192
|
-
style={{ zIndex: 1 }}
|
|
193
192
|
onDragStart={() => setIsMoveActive(true)}
|
|
194
193
|
onResize={(e, dir, eRef, size, position) =>
|
|
195
194
|
handleResize({ ...size, ...position })
|
|
@@ -40,6 +40,10 @@ const ReactRnd = styled(Rnd)`
|
|
|
40
40
|
background-color: white;
|
|
41
41
|
border: 1px solid #ebecf1;
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
form {
|
|
45
|
+
z-index: 1;
|
|
46
|
+
}
|
|
43
47
|
`;
|
|
44
48
|
|
|
45
49
|
export function DraggableStructure(props: DraggableStructureProps) {
|
|
@@ -165,7 +169,6 @@ export function DraggableStructure(props: DraggableStructureProps) {
|
|
|
165
169
|
dragHandleClassName="handle"
|
|
166
170
|
enableUserSelectHack={false}
|
|
167
171
|
bounds={`#${viewerRef.id}`}
|
|
168
|
-
style={{ zIndex: 1 }}
|
|
169
172
|
className="draggable-molecule"
|
|
170
173
|
onDragStart={() => setIsMoveActive(true)}
|
|
171
174
|
onResizeStop={(e, dir, eRef, { width, height }) =>
|
|
@@ -194,7 +197,13 @@ export function DraggableStructure(props: DraggableStructureProps) {
|
|
|
194
197
|
>
|
|
195
198
|
<div
|
|
196
199
|
className="content"
|
|
197
|
-
onDoubleClick={() =>
|
|
200
|
+
onDoubleClick={(e) => {
|
|
201
|
+
if ((e.target as HTMLElement).closest('form')) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
openMoleculeEditor(molecule);
|
|
206
|
+
}}
|
|
198
207
|
>
|
|
199
208
|
<ResponsiveChart>
|
|
200
209
|
{({ width, height }) => {
|
|
@@ -56,9 +56,10 @@ export function useTracesSpectra() {
|
|
|
56
56
|
} = useChartData();
|
|
57
57
|
|
|
58
58
|
return useMemo(() => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const nuclei = activeTab?.split(',');
|
|
60
|
+
if (nuclei?.length !== 2) {
|
|
61
|
+
return { ...defaultEmptyTraces };
|
|
62
|
+
}
|
|
62
63
|
|
|
63
64
|
return getTracesSpectra({ nuclei, spectra, activeSpectra });
|
|
64
65
|
}, [activeTab, spectra, activeSpectra]);
|
|
@@ -51,7 +51,7 @@ function KeysListenerTracker(props: KeysListenerTrackerProps) {
|
|
|
51
51
|
changeDisplayViewModeHandler,
|
|
52
52
|
} = useToolsFunctions();
|
|
53
53
|
|
|
54
|
-
const {
|
|
54
|
+
const { defaultSaveAsHandler } = useExport();
|
|
55
55
|
const isToolVisible = useCheckToolsVisibility();
|
|
56
56
|
|
|
57
57
|
const { highlight, remove } = useHighlightData();
|
|
@@ -428,7 +428,7 @@ function KeysListenerTracker(props: KeysListenerTrackerProps) {
|
|
|
428
428
|
break;
|
|
429
429
|
case 's':
|
|
430
430
|
if (isToolVisible('exportAs')) {
|
|
431
|
-
|
|
431
|
+
defaultSaveAsHandler();
|
|
432
432
|
e.preventDefault();
|
|
433
433
|
}
|
|
434
434
|
break;
|
|
@@ -488,7 +488,7 @@ function KeysListenerTracker(props: KeysListenerTrackerProps) {
|
|
|
488
488
|
nuclei,
|
|
489
489
|
openLoader,
|
|
490
490
|
openSaveAsDialog,
|
|
491
|
-
|
|
491
|
+
defaultSaveAsHandler,
|
|
492
492
|
toaster,
|
|
493
493
|
],
|
|
494
494
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import type { CSSProperties, ReactElement } from 'react';
|
|
3
|
-
import { Children } from 'react';
|
|
4
|
-
import { useResizeObserver } from 'react-d3-utils';
|
|
3
|
+
import { Children, useLayoutEffect, useRef, useState } from 'react';
|
|
5
4
|
import { FaAngleLeft } from 'react-icons/fa';
|
|
6
5
|
|
|
7
6
|
type Direction = 'right' | 'left';
|
|
@@ -90,10 +89,35 @@ interface NextPrevProps {
|
|
|
90
89
|
|
|
91
90
|
export function NextPrev(props: NextPrevProps) {
|
|
92
91
|
const { children, index = 0, onChange = () => null, style = {} } = props;
|
|
93
|
-
const [ref, { width } = { width: 0 }] = useResizeObserver();
|
|
94
92
|
const slidersCount = Children.count(children);
|
|
95
93
|
const lastIndex = slidersCount > 0 ? slidersCount - 1 : 0;
|
|
96
94
|
const activeIndex = Math.min(index, lastIndex);
|
|
95
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
96
|
+
|
|
97
|
+
const [width, setWidth] = useState(0);
|
|
98
|
+
|
|
99
|
+
useLayoutEffect(() => {
|
|
100
|
+
const container = containerRef.current;
|
|
101
|
+
if (!container) return;
|
|
102
|
+
|
|
103
|
+
const observer = new ResizeObserver((entries) => {
|
|
104
|
+
for (const entry of entries) {
|
|
105
|
+
const newWidth = entry.contentRect.width;
|
|
106
|
+
if (newWidth > 0) {
|
|
107
|
+
setWidth(newWidth);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
observer.observe(container);
|
|
113
|
+
|
|
114
|
+
const rect = container.getBoundingClientRect();
|
|
115
|
+
if (rect.width > 0) {
|
|
116
|
+
setWidth(rect.width);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return () => observer.disconnect();
|
|
120
|
+
}, []);
|
|
97
121
|
|
|
98
122
|
function nextHandler() {
|
|
99
123
|
if (index < lastIndex) {
|
|
@@ -113,7 +137,7 @@ export function NextPrev(props: NextPrevProps) {
|
|
|
113
137
|
const slidersWidth = width * slidersCount;
|
|
114
138
|
|
|
115
139
|
return (
|
|
116
|
-
<Container ref={
|
|
140
|
+
<Container ref={containerRef}>
|
|
117
141
|
<TransformController
|
|
118
142
|
translation={translation}
|
|
119
143
|
slidersWidth={slidersWidth}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { NmriumState } from '@zakodium/nmrium-core';
|
|
1
2
|
import { useCallback } from 'react';
|
|
2
3
|
|
|
3
|
-
import type { ExportOptions } from '../../data/SpectraManager.js';
|
|
4
4
|
import { toJSON } from '../../data/SpectraManager.js';
|
|
5
5
|
import { useChartData } from '../context/ChartContext.js';
|
|
6
6
|
import { useCore } from '../context/CoreContext.js';
|
|
@@ -9,17 +9,21 @@ import { useToaster } from '../context/ToasterContext.js';
|
|
|
9
9
|
import {
|
|
10
10
|
browserNotSupportedErrorToast,
|
|
11
11
|
copyPNGToClipboard,
|
|
12
|
-
exportAsJsonBlob,
|
|
13
12
|
exportAsPng,
|
|
14
13
|
exportAsSVG,
|
|
15
14
|
} from '../utility/export.js';
|
|
16
15
|
import { saveAs } from '../utility/save_as.ts';
|
|
17
16
|
|
|
18
|
-
interface SaveOptions {
|
|
19
|
-
include:
|
|
17
|
+
export interface SaveOptions {
|
|
18
|
+
include: {
|
|
19
|
+
settings: boolean;
|
|
20
|
+
view: boolean;
|
|
21
|
+
dataType:
|
|
22
|
+
| 'NO_DATA'
|
|
23
|
+
| 'SELF_CONTAINED'
|
|
24
|
+
| 'SELF_CONTAINED_EXTERNAL_DATASOURCE';
|
|
25
|
+
};
|
|
20
26
|
name: string;
|
|
21
|
-
compressed: boolean;
|
|
22
|
-
pretty: boolean;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export function useExport() {
|
|
@@ -28,75 +32,29 @@ export function useExport() {
|
|
|
28
32
|
const preferencesState = usePreferences();
|
|
29
33
|
const core = useCore();
|
|
30
34
|
|
|
31
|
-
const saveAsJSONHandler = useCallback(
|
|
32
|
-
(spaceIndent = 0, isCompressed = true) => {
|
|
33
|
-
const hideLoading = toaster.showLoading({
|
|
34
|
-
message: 'Exporting as NMRium process in progress',
|
|
35
|
-
});
|
|
36
|
-
setTimeout(async () => {
|
|
37
|
-
try {
|
|
38
|
-
const name = state.data[0]?.info?.name || 'experiment';
|
|
39
|
-
const exportedData = toJSON(core, state, preferencesState, {
|
|
40
|
-
exportTarget: 'nmrium',
|
|
41
|
-
view: true,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const blob = await exportAsJsonBlob(
|
|
45
|
-
exportedData,
|
|
46
|
-
name,
|
|
47
|
-
spaceIndent,
|
|
48
|
-
isCompressed,
|
|
49
|
-
);
|
|
50
|
-
saveAs({ blob, name, extension: '.nmrium' });
|
|
51
|
-
} catch (error) {
|
|
52
|
-
toaster.show({
|
|
53
|
-
intent: 'danger',
|
|
54
|
-
message: `Export failed due to an unexpected error: ${(error as Error)?.message || 'Unknown error'}`,
|
|
55
|
-
});
|
|
56
|
-
reportError(error);
|
|
57
|
-
} finally {
|
|
58
|
-
hideLoading();
|
|
59
|
-
}
|
|
60
|
-
}, 0);
|
|
61
|
-
},
|
|
62
|
-
[core, preferencesState, state, toaster],
|
|
63
|
-
);
|
|
64
|
-
|
|
65
35
|
const saveHandler = useCallback(
|
|
66
36
|
(options: SaveOptions) => {
|
|
67
37
|
async function handler() {
|
|
68
|
-
const { pretty, compressed, include } = options;
|
|
69
38
|
const name = options.name || 'experiment';
|
|
70
|
-
const
|
|
71
|
-
include.dataType?.startsWith('SELF_CONTAINED') ?? false;
|
|
39
|
+
const include = options.include;
|
|
72
40
|
|
|
73
41
|
const hideLoading = toaster.showLoading({
|
|
74
|
-
message: `Exporting as ${name}.nmrium process in progress`,
|
|
42
|
+
message: `Exporting as ${name}.nmrium.zip process in progress`,
|
|
75
43
|
});
|
|
76
44
|
setTimeout(async () => {
|
|
77
45
|
try {
|
|
78
|
-
const
|
|
79
|
-
|
|
46
|
+
const nmriumState = toJSON(core, state, preferencesState, {
|
|
47
|
+
serialize: false,
|
|
80
48
|
exportTarget: 'nmrium',
|
|
81
|
-
});
|
|
82
|
-
const spaceIndent = pretty || exportArchive ? 2 : 0;
|
|
83
|
-
const blob = await exportAsJsonBlob(
|
|
84
|
-
exportedData,
|
|
85
|
-
name,
|
|
86
|
-
spaceIndent,
|
|
87
|
-
compressed && !exportArchive,
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
if (!exportArchive) {
|
|
91
|
-
return saveAs({ blob, name, extension: '.nmrium' });
|
|
92
|
-
}
|
|
93
|
-
|
|
49
|
+
}) as NmriumState;
|
|
94
50
|
const archive = await core.serializeNmriumArchive({
|
|
95
|
-
|
|
96
|
-
spectra: state.data,
|
|
51
|
+
state: nmriumState,
|
|
97
52
|
aggregator: state.aggregator,
|
|
98
|
-
includeData:
|
|
99
|
-
|
|
53
|
+
includeData: include.dataType !== 'NO_DATA',
|
|
54
|
+
externalData:
|
|
55
|
+
include.dataType === 'SELF_CONTAINED' ? 'embedded' : 'linked',
|
|
56
|
+
includeSettings: include.settings,
|
|
57
|
+
includeView: include.view,
|
|
100
58
|
});
|
|
101
59
|
const zipBlob = new Blob([archive], {
|
|
102
60
|
type: 'chemical/x-nmrium+zip',
|
|
@@ -119,8 +77,20 @@ export function useExport() {
|
|
|
119
77
|
[core, preferencesState, state, toaster],
|
|
120
78
|
);
|
|
121
79
|
|
|
80
|
+
const defaultName = state.data[0]?.info?.name || 'experiment';
|
|
81
|
+
const defaultSaveAsHandler = useCallback(() => {
|
|
82
|
+
saveHandler({
|
|
83
|
+
name: defaultName,
|
|
84
|
+
include: {
|
|
85
|
+
dataType: 'SELF_CONTAINED',
|
|
86
|
+
view: true,
|
|
87
|
+
settings: false,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}, [saveHandler, defaultName]);
|
|
91
|
+
|
|
122
92
|
return {
|
|
123
|
-
|
|
93
|
+
defaultSaveAsHandler,
|
|
124
94
|
saveHandler,
|
|
125
95
|
};
|
|
126
96
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { useChartData } from '../context/ChartContext.tsx';
|
|
1
2
|
import { useDispatch } from '../context/DispatchContext.js';
|
|
2
3
|
import type { EventModifierKeys } from '../context/KeyModifierContext.js';
|
|
3
4
|
import { getModifiers } from '../context/KeyModifierContext.js';
|
|
4
5
|
|
|
5
6
|
export function useSetActiveSpectrumAction() {
|
|
6
7
|
const dispatch = useDispatch();
|
|
7
|
-
|
|
8
|
+
const { data: spectra } = useChartData();
|
|
8
9
|
function setActiveSpectrum(event: EventModifierKeys, id: string) {
|
|
9
10
|
setTimeout(() => {
|
|
10
11
|
const { ctrlKey, shiftKey } = getModifiers(event);
|
|
@@ -13,7 +14,7 @@ export function useSetActiveSpectrumAction() {
|
|
|
13
14
|
}]`;
|
|
14
15
|
dispatch({
|
|
15
16
|
type: 'CHANGE_ACTIVE_SPECTRUM',
|
|
16
|
-
payload: { modifier, id },
|
|
17
|
+
payload: { modifier, id, sortedSpectra: spectra },
|
|
17
18
|
});
|
|
18
19
|
}, 0);
|
|
19
20
|
}
|