nmrium 0.63.1 → 0.64.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 +8 -1
- package/lib/component/1d/BrushTracker1D.js.map +1 -1
- package/lib/component/1d/PredictionErrorsNotations.d.ts +2 -0
- package/lib/component/1d/PredictionErrorsNotations.d.ts.map +1 -0
- package/lib/component/1d/PredictionErrorsNotations.js +112 -0
- package/lib/component/1d/PredictionErrorsNotations.js.map +1 -0
- package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
- package/lib/component/1d/SVGContent1D.js +2 -1
- package/lib/component/1d/SVGContent1D.js.map +1 -1
- package/lib/component/2d/ft/Contours.d.ts.map +1 -1
- package/lib/component/2d/ft/Contours.js +3 -4
- package/lib/component/2d/ft/Contours.js.map +1 -1
- package/lib/component/2d/utilities/extractSpectrumSignals.d.ts +5 -3
- package/lib/component/2d/utilities/extractSpectrumSignals.d.ts.map +1 -1
- package/lib/component/2d/utilities/extractSpectrumSignals.js +3 -3
- package/lib/component/2d/utilities/extractSpectrumSignals.js.map +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.d.ts.map +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.js +74 -6
- package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
- package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
- package/lib/component/assignment/AssignmentProvider.d.ts.map +1 -1
- package/lib/component/assignment/AssignmentProvider.js +2 -1
- package/lib/component/assignment/AssignmentProvider.js.map +1 -1
- package/lib/component/assignment/AssignmentsContext.d.ts +5 -2
- package/lib/component/assignment/AssignmentsContext.d.ts.map +1 -1
- package/lib/component/assignment/AssignmentsContext.js +2 -1
- package/lib/component/assignment/AssignmentsContext.js.map +1 -1
- package/lib/component/elements/SVGGroup.js +1 -1
- package/lib/component/elements/SVGGroup.js.map +1 -1
- package/lib/component/elements/Sections.d.ts +1 -0
- package/lib/component/elements/Sections.d.ts.map +1 -1
- package/lib/component/elements/Sections.js +42 -7
- package/lib/component/elements/Sections.js.map +1 -1
- package/lib/component/elements/pdnd.cjs +12 -0
- package/lib/component/elements/pdnd.cjs.map +1 -0
- package/lib/component/elements/pdnd.d.cts +2 -0
- package/lib/component/elements/pdnd.d.cts.map +1 -0
- package/lib/component/hooks/useToolsFunctions.js +1 -1
- package/lib/component/hooks/useToolsFunctions.js.map +1 -1
- package/lib/component/main/InnerNMRiumContents.d.ts.map +1 -1
- package/lib/component/main/InnerNMRiumContents.js +3 -1
- package/lib/component/main/InnerNMRiumContents.js.map +1 -1
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts.map +1 -1
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +7 -4
- package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js.map +1 -1
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +6 -5
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +3 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +2 -0
- package/lib/component/panels/MoleculesPanel/Utilities.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +17 -9
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +1 -1
- package/lib/component/panels/Panels.d.ts +0 -4
- package/lib/component/panels/Panels.d.ts.map +1 -1
- package/lib/component/panels/Panels.js +8 -14
- package/lib/component/panels/Panels.js.map +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts.map +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +5 -8
- package/lib/component/panels/RangesPanel/RangesHeader.js.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.d.ts.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +4 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js.map +1 -1
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +1 -1
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +7 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts +1 -1
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js +15 -17
- package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.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/Reducer.d.ts.map +1 -1
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/Reducer.js.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +7 -2
- package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +56 -26
- package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
- package/lib/component/reducer/actions/InsetActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/InsetActions.js +1 -5
- package/lib/component/reducer/actions/InsetActions.js.map +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -1
- package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/RangesActions.js +7 -14
- package/lib/component/reducer/actions/RangesActions.js.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +2 -2
- package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +3 -2
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts.map +1 -1
- package/lib/component/reducer/helper/ZoomHistoryManager.js +17 -8
- package/lib/component/reducer/helper/ZoomHistoryManager.js.map +1 -1
- package/lib/component/reducer/preferences/actions/togglePanel.d.ts.map +1 -1
- package/lib/component/reducer/preferences/actions/togglePanel.js +11 -6
- package/lib/component/reducer/preferences/actions/togglePanel.js.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
- package/lib/component/toolbar/ToolBar.js +3 -2
- package/lib/component/toolbar/ToolBar.js.map +1 -1
- package/lib/component/toolbar/ToolTypes.js +1 -1
- package/lib/component/toolbar/ToolTypes.js.map +1 -1
- package/lib/component/workspaces/exercise.js +1 -1
- package/lib/component/workspaces/prediction.js +1 -1
- package/lib/component/workspaces/prediction.js.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/PredictionManager.d.ts.map +1 -1
- package/lib/data/PredictionManager.js +1 -0
- package/lib/data/PredictionManager.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +6 -4
- package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +22 -10
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
- package/lib/data/types/data1d/index.js +1 -1
- package/lib/data/types/data1d/index.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +22 -21
- package/src/component/1d/BrushTracker1D.tsx +8 -1
- package/src/component/1d/PredictionErrorsNotations.tsx +209 -0
- package/src/component/1d/SVGContent1D.tsx +2 -0
- package/src/component/2d/ft/Contours.tsx +3 -11
- package/src/component/2d/utilities/extractSpectrumSignals.ts +12 -9
- package/src/component/2d/zones/SignalsGuideLines.tsx +107 -11
- package/src/component/EventsTrackers/BrushTracker.tsx +2 -3
- package/src/component/assignment/AssignmentProvider.tsx +2 -1
- package/src/component/assignment/AssignmentsContext.ts +7 -2
- package/src/component/elements/SVGGroup.tsx +2 -2
- package/src/component/elements/Sections.tsx +103 -19
- package/src/component/elements/pdnd.cts +9 -0
- package/src/component/hooks/useToolsFunctions.ts +1 -1
- package/src/component/main/InnerNMRiumContents.tsx +3 -1
- package/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx +12 -7
- package/src/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.tsx +11 -5
- package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +32 -32
- package/src/component/panels/MoleculesPanel/Utilities.ts +2 -0
- package/src/component/panels/MoleculesPanel/useAtomAssignment.tsx +29 -8
- package/src/component/panels/Panels.tsx +9 -24
- package/src/component/panels/RangesPanel/RangesHeader.tsx +14 -21
- package/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx +11 -1
- package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +9 -0
- package/src/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.tsx +16 -18
- package/src/component/panels/hooks/useTogglePanel.ts +4 -3
- package/src/component/reducer/Reducer.ts +2 -0
- package/src/component/reducer/actions/FiltersActions.ts +86 -40
- package/src/component/reducer/actions/InsetActions.ts +1 -5
- package/src/component/reducer/actions/RangesActions.ts +10 -13
- package/src/component/reducer/actions/ToolsActions.ts +1 -2
- package/src/component/reducer/helper/ZoomHistoryManager.ts +20 -9
- package/src/component/reducer/preferences/actions/togglePanel.ts +10 -6
- package/src/component/reducer/preferences/preferencesReducer.ts +11 -1
- package/src/component/toolbar/ToolBar.tsx +2 -2
- package/src/component/toolbar/ToolTypes.ts +1 -1
- package/src/component/workspaces/exercise.ts +1 -1
- package/src/component/workspaces/prediction.ts +1 -1
- package/src/component/workspaces/workspaceDefaultProperties.ts +1 -1
- package/src/data/PredictionManager.ts +1 -0
- package/src/data/data2d/Spectrum2D/contours.ts +8 -4
- package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +34 -16
- package/src/versionInfo.ts +1 -1
|
@@ -7,7 +7,16 @@ import type {
|
|
|
7
7
|
MouseEvent,
|
|
8
8
|
ReactNode,
|
|
9
9
|
} from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
createContext,
|
|
12
|
+
useContext,
|
|
13
|
+
useMemo,
|
|
14
|
+
useEffect,
|
|
15
|
+
useRef,
|
|
16
|
+
useState,
|
|
17
|
+
} from 'react';
|
|
18
|
+
|
|
19
|
+
import { draggable, dropTargetForElements } from './pdnd.cjs';
|
|
11
20
|
|
|
12
21
|
interface SelectionsContextState {
|
|
13
22
|
isOverflow: boolean;
|
|
@@ -162,6 +171,10 @@ interface SectionItemProps extends BaseSectionProps {
|
|
|
162
171
|
children?: ReactNode | ((options: { isOpen?: boolean }) => ReactNode);
|
|
163
172
|
isOpen: boolean;
|
|
164
173
|
sticky?: boolean;
|
|
174
|
+
onReorder?: (
|
|
175
|
+
sourceId: string | undefined,
|
|
176
|
+
targetId: string | undefined,
|
|
177
|
+
) => void;
|
|
165
178
|
}
|
|
166
179
|
|
|
167
180
|
interface SectionProps {
|
|
@@ -218,29 +231,62 @@ function SectionItem(props: SectionItemProps) {
|
|
|
218
231
|
isOpen,
|
|
219
232
|
sticky = false,
|
|
220
233
|
arrowProps = { hide: false, style: {} },
|
|
234
|
+
onReorder,
|
|
221
235
|
} = props;
|
|
222
236
|
|
|
223
237
|
const { isOverflow, matchContentHeight } = useSections();
|
|
224
238
|
|
|
239
|
+
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
240
|
+
const handleRef = useRef<HTMLDivElement>(null);
|
|
241
|
+
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
if (!wrapperRef.current || !handleRef.current) return;
|
|
244
|
+
|
|
245
|
+
const cleanDrag = draggable({
|
|
246
|
+
element: wrapperRef.current,
|
|
247
|
+
dragHandle: handleRef.current,
|
|
248
|
+
getInitialData: () => ({ id }),
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
return () => {
|
|
252
|
+
cleanDrag();
|
|
253
|
+
};
|
|
254
|
+
}, [id]);
|
|
255
|
+
|
|
225
256
|
return (
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
257
|
+
<DroppableSectionWrapper key={id} id={id} onReorder={onReorder}>
|
|
258
|
+
<div ref={wrapperRef}>
|
|
259
|
+
<SectionWrapper
|
|
260
|
+
isOpen={isOpen}
|
|
261
|
+
isOverflow={isOverflow}
|
|
262
|
+
matchContentHeight={matchContentHeight}
|
|
263
|
+
>
|
|
264
|
+
<MainSectionHeader
|
|
265
|
+
title={title}
|
|
266
|
+
isOpen={isOpen}
|
|
267
|
+
onClick={(event) => onClick?.(id, event)}
|
|
268
|
+
serial={serial}
|
|
269
|
+
rightElement={rightElement}
|
|
270
|
+
dragHandleElement={
|
|
271
|
+
typeof onReorder === 'function' && (
|
|
272
|
+
<div
|
|
273
|
+
ref={handleRef}
|
|
274
|
+
onClick={(e) => e.stopPropagation()}
|
|
275
|
+
style={{ cursor: 'grab' }}
|
|
276
|
+
>
|
|
277
|
+
<Icon icon="drag-handle-vertical" />
|
|
278
|
+
</div>
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
leftElement={leftElement}
|
|
282
|
+
headerStyle={headerStyle}
|
|
283
|
+
sticky={sticky}
|
|
284
|
+
arrowProps={arrowProps}
|
|
285
|
+
/>
|
|
286
|
+
<Wrapper isOpen={isOpen}>{children}</Wrapper>
|
|
287
|
+
</SectionWrapper>
|
|
288
|
+
</div>
|
|
289
|
+
</DroppableSectionWrapper>
|
|
244
290
|
);
|
|
245
291
|
}
|
|
246
292
|
|
|
@@ -270,6 +316,7 @@ interface MainSectionHeaderProps
|
|
|
270
316
|
BaseSectionProps {
|
|
271
317
|
isOpen: boolean;
|
|
272
318
|
sticky: boolean;
|
|
319
|
+
dragHandleElement?: ReactNode;
|
|
273
320
|
}
|
|
274
321
|
|
|
275
322
|
function MainSectionHeader(props: MainSectionHeaderProps) {
|
|
@@ -279,6 +326,7 @@ function MainSectionHeader(props: MainSectionHeaderProps) {
|
|
|
279
326
|
onClick,
|
|
280
327
|
serial,
|
|
281
328
|
rightElement,
|
|
329
|
+
dragHandleElement,
|
|
282
330
|
leftElement,
|
|
283
331
|
headerStyle = {},
|
|
284
332
|
sticky,
|
|
@@ -314,6 +362,7 @@ function MainSectionHeader(props: MainSectionHeaderProps) {
|
|
|
314
362
|
{typeof rightElement === 'function'
|
|
315
363
|
? rightElement(isOpen)
|
|
316
364
|
: rightElement}
|
|
365
|
+
{dragHandleElement}
|
|
317
366
|
</ElementsContainer>
|
|
318
367
|
{!arrowProps?.hide && (
|
|
319
368
|
<OpenIcon
|
|
@@ -327,6 +376,41 @@ function MainSectionHeader(props: MainSectionHeaderProps) {
|
|
|
327
376
|
);
|
|
328
377
|
}
|
|
329
378
|
|
|
379
|
+
interface DroppableProps extends Pick<SectionItemProps, 'id' | 'onReorder'> {
|
|
380
|
+
children: ReactNode;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function DroppableSectionWrapper({ id, onReorder, children }: DroppableProps) {
|
|
384
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
385
|
+
const [isOver, setIsOver] = useState(false);
|
|
386
|
+
|
|
387
|
+
useEffect(() => {
|
|
388
|
+
if (!ref.current) return;
|
|
389
|
+
|
|
390
|
+
return dropTargetForElements({
|
|
391
|
+
element: ref.current,
|
|
392
|
+
canDrop: ({ source }) => source.data?.id !== id,
|
|
393
|
+
onDrop: ({ source }) => {
|
|
394
|
+
const sourceId = source.data?.id as string;
|
|
395
|
+
setIsOver(false);
|
|
396
|
+
onReorder?.(sourceId, id);
|
|
397
|
+
},
|
|
398
|
+
onDragEnter: () => setIsOver(true),
|
|
399
|
+
onDragLeave: () => setIsOver(false),
|
|
400
|
+
});
|
|
401
|
+
}, [id, onReorder]);
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<div
|
|
405
|
+
ref={ref}
|
|
406
|
+
data-drop-id={id}
|
|
407
|
+
style={{ ...(isOver && { opacity: 0.1 }) }}
|
|
408
|
+
>
|
|
409
|
+
{children}
|
|
410
|
+
</div>
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
|
|
330
414
|
Sections.Header = SectionHeader;
|
|
331
415
|
Sections.Body = SectionBody;
|
|
332
416
|
Sections.Item = SectionItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// https://github.com/atlassian/pragmatic-drag-and-drop/issues/27
|
|
2
|
+
// Given how `@atlaskit/pragmatic-drag-and-drop` publishes ESM in a non-native way,
|
|
3
|
+
// we have to trick TS into using the CJS build so that our build is compatible
|
|
4
|
+
// with native ESM.
|
|
5
|
+
// We cannot use `verbatimModuleSyntax` ts config option with this pattern.
|
|
6
|
+
export {
|
|
7
|
+
draggable,
|
|
8
|
+
dropTargetForElements,
|
|
9
|
+
} from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
@@ -68,7 +68,7 @@ export default function useToolsFunctions() {
|
|
|
68
68
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
69
69
|
dispatch({
|
|
70
70
|
type: 'FULL_ZOOM_OUT',
|
|
71
|
-
payload: { zoomType: '
|
|
71
|
+
payload: { zoomType: 'BIDIRECTIONAL' },
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
const callback = lodashDebounce(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Checkbox, Classes
|
|
1
|
+
import { Checkbox, Classes } from '@blueprintjs/core';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import type { CustomWorkspaces, Database } from '@zakodium/nmrium-core';
|
|
4
4
|
import { useCallback, useMemo } from 'react';
|
|
@@ -128,13 +128,18 @@ function DatabasesTabContent({
|
|
|
128
128
|
control={control}
|
|
129
129
|
name="databases.defaultDatabase"
|
|
130
130
|
render={({ field }) => {
|
|
131
|
-
const {
|
|
131
|
+
const { value, name } = field;
|
|
132
|
+
const databaseKey = row.original.key;
|
|
133
|
+
|
|
132
134
|
return (
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
+
<Checkbox
|
|
136
|
+
name={name}
|
|
137
|
+
value={databaseKey}
|
|
135
138
|
style={{ margin: 0 }}
|
|
136
|
-
checked={value ===
|
|
137
|
-
onChange={
|
|
139
|
+
checked={value === databaseKey}
|
|
140
|
+
onChange={() => {
|
|
141
|
+
setValue(name, databaseKey === value ? '' : databaseKey);
|
|
142
|
+
}}
|
|
138
143
|
/>
|
|
139
144
|
);
|
|
140
145
|
}}
|
|
@@ -191,7 +196,7 @@ function DatabasesTabContent({
|
|
|
191
196
|
},
|
|
192
197
|
},
|
|
193
198
|
],
|
|
194
|
-
[addHandler, control, deleteHandler, register],
|
|
199
|
+
[addHandler, control, deleteHandler, register, setValue],
|
|
195
200
|
);
|
|
196
201
|
|
|
197
202
|
function resetHandler() {
|
|
@@ -3,7 +3,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
3
3
|
import { SvgNmrMultipleAnalysis } from 'cheminfo-font';
|
|
4
4
|
import type { MatrixOptions } from 'nmr-processing';
|
|
5
5
|
import { Filters1D } from 'nmr-processing';
|
|
6
|
-
import { useCallback } from 'react';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
7
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
8
8
|
import { Button, Toolbar } from 'react-science/ui';
|
|
9
9
|
import * as yup from 'yup';
|
|
@@ -171,12 +171,18 @@ function InnerMatrixGenerationPanel() {
|
|
|
171
171
|
});
|
|
172
172
|
const { handleSubmit, reset, control } = methods;
|
|
173
173
|
|
|
174
|
+
const memoizedInitialValues = useMemo(
|
|
175
|
+
() =>
|
|
176
|
+
getMatrixOptions(nucleusMatrixOptions.matrixOptions, {
|
|
177
|
+
from: originDomain.xDomain[0],
|
|
178
|
+
to: originDomain.xDomain[1],
|
|
179
|
+
}),
|
|
180
|
+
[nucleusMatrixOptions.matrixOptions, originDomain.xDomain],
|
|
181
|
+
);
|
|
182
|
+
|
|
174
183
|
useWatchForm({
|
|
175
184
|
reset,
|
|
176
|
-
initialValues:
|
|
177
|
-
from: originDomain.xDomain[0],
|
|
178
|
-
to: originDomain.xDomain[1],
|
|
179
|
-
}),
|
|
185
|
+
initialValues: memoizedInitialValues,
|
|
180
186
|
control,
|
|
181
187
|
onChange: (values) => {
|
|
182
188
|
handleOnChange(values);
|
|
@@ -88,17 +88,18 @@ interface MoleculePanelHeaderProps {
|
|
|
88
88
|
children?: ReactNode;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
export default function MoleculePanelHeader({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
export default function MoleculePanelHeader(props: MoleculePanelHeaderProps) {
|
|
92
|
+
const {
|
|
93
|
+
currentIndex,
|
|
94
|
+
molecules,
|
|
95
|
+
moleculesView,
|
|
96
|
+
onMoleculeIndexChange,
|
|
97
|
+
onOpenMoleculeEditor,
|
|
98
|
+
renderSource = 'moleculePanel',
|
|
99
|
+
onClickPreferences,
|
|
100
|
+
onClickPastMolecule,
|
|
101
|
+
children,
|
|
102
|
+
} = props;
|
|
102
103
|
const { rootRef } = useGlobal();
|
|
103
104
|
const toaster = useToaster();
|
|
104
105
|
const dispatch = useDispatch();
|
|
@@ -256,27 +257,26 @@ export default function MoleculePanelHeader({
|
|
|
256
257
|
<Toolbar>
|
|
257
258
|
{renderSource === 'predictionPanel' && <AboutPredictionModal />}
|
|
258
259
|
{renderSource === 'moleculePanel' && (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
</>
|
|
260
|
+
<ToolbarPopoverItem
|
|
261
|
+
options={MOL_EXPORT_MENU}
|
|
262
|
+
onClick={exportHandler}
|
|
263
|
+
disabled={!hasMolecules}
|
|
264
|
+
tooltip="Export As"
|
|
265
|
+
icon={<FaFileExport />}
|
|
266
|
+
id="molecule-export-as"
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
269
|
+
<Toolbar.Item
|
|
270
|
+
tooltip="Paste molfile"
|
|
271
|
+
icon={<FaPaste />}
|
|
272
|
+
onClick={handlePasteMolfileAction}
|
|
273
|
+
/>
|
|
274
|
+
{renderSource === 'moleculePanel' && (
|
|
275
|
+
<Toolbar.Item
|
|
276
|
+
tooltip="Add molecule"
|
|
277
|
+
icon={<FaPlus />}
|
|
278
|
+
onClick={onOpenMoleculeEditor}
|
|
279
|
+
/>
|
|
280
280
|
)}
|
|
281
281
|
|
|
282
282
|
{renderSource === 'moleculePanel' && (
|
|
@@ -75,6 +75,7 @@ function getSignalsDiaIDs(
|
|
|
75
75
|
|
|
76
76
|
export default function useAtomAssignment() {
|
|
77
77
|
const {
|
|
78
|
+
data: spectra,
|
|
78
79
|
view: {
|
|
79
80
|
spectra: { activeTab: nucleus },
|
|
80
81
|
},
|
|
@@ -85,8 +86,10 @@ export default function useAtomAssignment() {
|
|
|
85
86
|
const highlightData = useHighlightData();
|
|
86
87
|
const highlightedIdDsRef = useRef<string[]>([]);
|
|
87
88
|
const assignments = useAssignmentContext();
|
|
88
|
-
const
|
|
89
|
-
|
|
89
|
+
const { activated: activatedAssignment } = assignments;
|
|
90
|
+
|
|
91
|
+
const activatedKey = activatedAssignment
|
|
92
|
+
? activatedAssignment.id
|
|
90
93
|
: ConcatenationString; // dummy value
|
|
91
94
|
|
|
92
95
|
// used for atom highlighting for now, until we would like to highlight atoms per axis separately
|
|
@@ -117,7 +120,11 @@ export default function useAtomAssignment() {
|
|
|
117
120
|
|
|
118
121
|
if (!assignKeys) return;
|
|
119
122
|
const [{ index: rangeIndex }] = assignKeys;
|
|
120
|
-
const
|
|
123
|
+
const {
|
|
124
|
+
id: spectrumId,
|
|
125
|
+
ranges: { values },
|
|
126
|
+
} = spectrum;
|
|
127
|
+
const range = values[rangeIndex];
|
|
121
128
|
|
|
122
129
|
let diaIDs: string[] = [];
|
|
123
130
|
|
|
@@ -135,6 +142,7 @@ export default function useAtomAssignment() {
|
|
|
135
142
|
nbAtoms: uniqueDiaIDs.nbAtoms,
|
|
136
143
|
diaIDs: uniqueDiaIDs.diaIDs,
|
|
137
144
|
keys: assignKeys,
|
|
145
|
+
spectrumId,
|
|
138
146
|
},
|
|
139
147
|
});
|
|
140
148
|
}
|
|
@@ -175,9 +183,9 @@ export default function useAtomAssignment() {
|
|
|
175
183
|
diaIDAndInfo: DiaIDAndInfo | undefined,
|
|
176
184
|
event: MouseEvent,
|
|
177
185
|
) {
|
|
178
|
-
if (checkModifierKeyActivated(event) || !
|
|
186
|
+
if (checkModifierKeyActivated(event) || !activatedAssignment) return;
|
|
179
187
|
|
|
180
|
-
const { axis, id } =
|
|
188
|
+
const { axis, id } = activatedAssignment;
|
|
181
189
|
|
|
182
190
|
if (!id || !axis) {
|
|
183
191
|
return;
|
|
@@ -198,10 +206,23 @@ export default function useAtomAssignment() {
|
|
|
198
206
|
// determine the level of setting the diaIDs array (range vs. signal level) and save there
|
|
199
207
|
// let nbAtoms = 0;
|
|
200
208
|
// on range/zone level
|
|
201
|
-
|
|
202
|
-
|
|
209
|
+
const currentSpectrum = activatedAssignment.spectrumId
|
|
210
|
+
? spectra.find(
|
|
211
|
+
(spectrum) => spectrum.id === activatedAssignment.spectrumId,
|
|
212
|
+
)
|
|
213
|
+
: spectrum;
|
|
214
|
+
|
|
215
|
+
if (!currentSpectrum) return;
|
|
216
|
+
|
|
217
|
+
if (isSpectrum1D(currentSpectrum)) {
|
|
218
|
+
assign1DAtom(currentSpectrum, activatedAssignment.id, atomInformation);
|
|
203
219
|
} else {
|
|
204
|
-
assign2DAtom(
|
|
220
|
+
assign2DAtom(
|
|
221
|
+
currentSpectrum,
|
|
222
|
+
activatedAssignment.id,
|
|
223
|
+
atomInformation,
|
|
224
|
+
axis,
|
|
225
|
+
);
|
|
205
226
|
}
|
|
206
227
|
assignments.activate({ id: activatedKey, axis });
|
|
207
228
|
}
|
|
@@ -20,11 +20,7 @@ const Container = styled.div`
|
|
|
20
20
|
height: 100%;
|
|
21
21
|
flex: 1 1 0%;
|
|
22
22
|
`;
|
|
23
|
-
|
|
24
|
-
type PanelOpenState = Partial<Record<keyof NMRiumPanelPreferences, boolean>>;
|
|
25
23
|
interface PanelStateContext {
|
|
26
|
-
setPanelOpenState: (id: keyof NMRiumPanelPreferences, value: boolean) => void;
|
|
27
|
-
panelOpenState: PanelOpenState;
|
|
28
24
|
openSplitPane: () => void;
|
|
29
25
|
closeSplitPane: () => void;
|
|
30
26
|
isSplitPaneOpen: boolean;
|
|
@@ -48,26 +44,12 @@ export function PanelOpenProviderProvider({ children }) {
|
|
|
48
44
|
const {
|
|
49
45
|
display: { general = {} },
|
|
50
46
|
} = current;
|
|
51
|
-
|
|
52
|
-
const [panelOpenState, toggleAccordionItem] = useState<PanelOpenState>({});
|
|
53
47
|
// TODO: make sure to move this state to the workspace once the refactoring of nmrium-core is finished.
|
|
54
48
|
const [isSplitPaneOpen, setIsSplitPaneOpen] = useState(
|
|
55
49
|
!general?.hidePanelOnLoad,
|
|
56
50
|
);
|
|
57
51
|
|
|
58
52
|
const state = useMemo(() => {
|
|
59
|
-
function setPanelOpenState(
|
|
60
|
-
id: keyof NMRiumPanelPreferences,
|
|
61
|
-
value: boolean,
|
|
62
|
-
) {
|
|
63
|
-
toggleAccordionItem((prev) => {
|
|
64
|
-
return {
|
|
65
|
-
...prev,
|
|
66
|
-
[id]: value,
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
53
|
function openSplitPane() {
|
|
72
54
|
setIsSplitPaneOpen(true);
|
|
73
55
|
}
|
|
@@ -75,13 +57,11 @@ export function PanelOpenProviderProvider({ children }) {
|
|
|
75
57
|
setIsSplitPaneOpen(false);
|
|
76
58
|
}
|
|
77
59
|
return {
|
|
78
|
-
setPanelOpenState,
|
|
79
|
-
panelOpenState,
|
|
80
60
|
openSplitPane,
|
|
81
61
|
closeSplitPane,
|
|
82
62
|
isSplitPaneOpen,
|
|
83
63
|
};
|
|
84
|
-
}, [isSplitPaneOpen
|
|
64
|
+
}, [isSplitPaneOpen]);
|
|
85
65
|
|
|
86
66
|
return (
|
|
87
67
|
<AccordionContext.Provider value={state}>
|
|
@@ -92,11 +72,10 @@ export function PanelOpenProviderProvider({ children }) {
|
|
|
92
72
|
|
|
93
73
|
function PanelsInner() {
|
|
94
74
|
const getPanelPreferences = useGetPanelOptions();
|
|
95
|
-
const { panelOpenState } = usePanelOpenState();
|
|
96
75
|
const { dialog, openDialog, closeDialog } = useDialogToggle({
|
|
97
76
|
informationModal: false,
|
|
98
77
|
});
|
|
99
|
-
|
|
78
|
+
const { dispatch } = usePreferences();
|
|
100
79
|
const items = useAccordionItems();
|
|
101
80
|
function isOpened(item: AccordionItem) {
|
|
102
81
|
const panelOptions = getPanelPreferences(item);
|
|
@@ -126,7 +105,13 @@ function PanelsInner() {
|
|
|
126
105
|
id={id}
|
|
127
106
|
key={title}
|
|
128
107
|
title={title}
|
|
129
|
-
|
|
108
|
+
open={isOpened(item)}
|
|
109
|
+
onOpenChange={(isOpened) => {
|
|
110
|
+
dispatch({
|
|
111
|
+
type: 'TOGGLE_PANEL',
|
|
112
|
+
payload: { id, options: { open: isOpened } },
|
|
113
|
+
});
|
|
114
|
+
}}
|
|
130
115
|
renderToolbar={() => (
|
|
131
116
|
<RightButtons
|
|
132
117
|
id={id}
|
|
@@ -26,7 +26,6 @@ import { useAlert } from '../../elements/Alert.js';
|
|
|
26
26
|
import type { ToolbarPopoverMenuItem } from '../../elements/ToolbarPopoverItem.js';
|
|
27
27
|
import { ToolbarPopoverItem } from '../../elements/ToolbarPopoverItem.js';
|
|
28
28
|
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState.js';
|
|
29
|
-
import useCheckExperimentalFeature from '../../hooks/useCheckExperimentalFeature.js';
|
|
30
29
|
import { useDialogToggle } from '../../hooks/useDialogToggle.js';
|
|
31
30
|
import { PublicationStringModal } from '../../modal/PublicationStringModal.js';
|
|
32
31
|
import ChangeSumModal from '../../modal/changeSum/ChangeSumModal.js';
|
|
@@ -80,7 +79,6 @@ function RangesHeader(props: RangesHeaderProps) {
|
|
|
80
79
|
const dispatch = useDispatch();
|
|
81
80
|
const alert = useAlert();
|
|
82
81
|
const toaster = useToaster();
|
|
83
|
-
const isExperimentalFeature = useCheckExperimentalFeature();
|
|
84
82
|
const { openDialog, dialog, closeDialog } = useDialogToggle({
|
|
85
83
|
publicationStringModal: false,
|
|
86
84
|
});
|
|
@@ -312,27 +310,22 @@ function RangesHeader(props: RangesHeaderProps) {
|
|
|
312
310
|
onClick: handleShowAssignmentsLabel,
|
|
313
311
|
active: showAssignmentsLabels,
|
|
314
312
|
},
|
|
313
|
+
{
|
|
314
|
+
disabled: !hasRanges,
|
|
315
|
+
icon: <FaCopy />,
|
|
316
|
+
tooltip: `${booleanToString(!showPublicationString)} publication string`,
|
|
317
|
+
onClick: handleShowPublicationString,
|
|
318
|
+
active: showPublicationString,
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
disabled: !hasRanges,
|
|
322
|
+
icon: <SvgNmrPeaksTopLabels />,
|
|
323
|
+
tooltip: `${booleanToString(!showRanges)} ranges`,
|
|
324
|
+
onClick: handleShowRanges,
|
|
325
|
+
active: showRanges,
|
|
326
|
+
},
|
|
315
327
|
];
|
|
316
328
|
|
|
317
|
-
if (isExperimentalFeature) {
|
|
318
|
-
lefButtons.push(
|
|
319
|
-
{
|
|
320
|
-
disabled: !hasRanges,
|
|
321
|
-
icon: <FaCopy />,
|
|
322
|
-
tooltip: `${booleanToString(!showPublicationString)} publication string`,
|
|
323
|
-
onClick: handleShowPublicationString,
|
|
324
|
-
active: showPublicationString,
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
disabled: !hasRanges,
|
|
328
|
-
icon: <SvgNmrPeaksTopLabels />,
|
|
329
|
-
tooltip: `${booleanToString(!showRanges)} ranges`,
|
|
330
|
-
onClick: handleShowRanges,
|
|
331
|
-
active: showRanges,
|
|
332
|
-
},
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
329
|
return (
|
|
337
330
|
<div>
|
|
338
331
|
<PublicationStringModal
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RangeSliderProps } from '@blueprintjs/core';
|
|
1
2
|
import { RangeSlider } from '@blueprintjs/core';
|
|
2
3
|
import styled from '@emotion/styled';
|
|
3
4
|
import debounce from 'lodash/debounce.js';
|
|
@@ -28,6 +29,14 @@ const StyledRangeSlider = styled(RangeSlider)<{
|
|
|
28
29
|
background-color: ${(props) => props.progressColor};
|
|
29
30
|
}
|
|
30
31
|
`;
|
|
32
|
+
type ContoursRangeSliderProps = RangeSliderProps & {
|
|
33
|
+
progressColor: React.CSSProperties['backgroundColor'];
|
|
34
|
+
name?: string;
|
|
35
|
+
};
|
|
36
|
+
function ContoursRangeSlider(props: ContoursRangeSliderProps) {
|
|
37
|
+
return <StyledRangeSlider {...props} />;
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
interface Spectrum2DSettingProps {
|
|
32
41
|
data: any;
|
|
33
42
|
onSubmit: (values: any) => void;
|
|
@@ -113,7 +122,8 @@ function Settings(props: SettingsProps) {
|
|
|
113
122
|
const { value, onChange } = field;
|
|
114
123
|
|
|
115
124
|
return (
|
|
116
|
-
<
|
|
125
|
+
<ContoursRangeSlider
|
|
126
|
+
name={sign}
|
|
117
127
|
min={0}
|
|
118
128
|
max={100}
|
|
119
129
|
stepSize={1}
|
|
@@ -262,6 +262,14 @@ function FiltersInner(props: FiltersInnerProps) {
|
|
|
262
262
|
openSection(null);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
function handleReorderFilters(sourceId, targetId) {
|
|
266
|
+
if (!sourceId || !targetId) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
dispatch({ type: 'REORDER_FILTERS', payload: { sourceId, targetId } });
|
|
271
|
+
}
|
|
272
|
+
|
|
265
273
|
return (
|
|
266
274
|
<Sections isOverflow renderActiveSectionContentOnly>
|
|
267
275
|
{filtersList.map((filter, index) => {
|
|
@@ -272,6 +280,7 @@ function FiltersInner(props: FiltersInnerProps) {
|
|
|
272
280
|
<Sections.Item
|
|
273
281
|
key={id}
|
|
274
282
|
id={name}
|
|
283
|
+
onReorder={handleReorderFilters}
|
|
275
284
|
title={error || getFilterLabel(name)}
|
|
276
285
|
serial={index + 1}
|
|
277
286
|
onClick={(id) => {
|
|
@@ -136,25 +136,23 @@ export function usePhaseCorrectionTwoDimensions(filter: Filter2DEntry | null) {
|
|
|
136
136
|
);
|
|
137
137
|
|
|
138
138
|
const handleInputValueChange = useCallback(
|
|
139
|
-
(
|
|
140
|
-
const { name
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
[activeTraceDirection]
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
calcPhaseCorrectionHandler(newValue, name, 'input');
|
|
152
|
-
}
|
|
153
|
-
updateInputRangeInitialValue(newValue);
|
|
154
|
-
valueRef.current = newValue;
|
|
155
|
-
setValue(valueRef.current);
|
|
156
|
-
syncFilterOptions(valueRef.current);
|
|
139
|
+
(valueAsNumber, valueAsString, inputElement) => {
|
|
140
|
+
const { name } = inputElement;
|
|
141
|
+
const newValue = {
|
|
142
|
+
...valueRef.current,
|
|
143
|
+
[activeTraceDirection]: {
|
|
144
|
+
...valueRef.current[activeTraceDirection],
|
|
145
|
+
[name]: valueAsNumber,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
if (valueAsString.trim() !== '-') {
|
|
150
|
+
calcPhaseCorrectionHandler(newValue, name, 'input');
|
|
157
151
|
}
|
|
152
|
+
updateInputRangeInitialValue(newValue);
|
|
153
|
+
valueRef.current = newValue;
|
|
154
|
+
setValue(valueRef.current);
|
|
155
|
+
syncFilterOptions(valueRef.current);
|
|
158
156
|
},
|
|
159
157
|
[
|
|
160
158
|
activeTraceDirection,
|