nmrium 0.57.1 → 0.59.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/integral/IntegralResizable.js +2 -2
- package/lib/component/1d/matrix/useMatrix.d.ts +1 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +1 -1
- package/lib/component/1d/ranges/Atoms.js +6 -4
- package/lib/component/1d-2d/components/SpectrumInfoBlock.d.ts +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +114 -7
- package/lib/component/2d/Viewer2D.js +6 -2
- package/lib/component/2d/zones/Zone.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +8 -8
- package/lib/component/context/ChartContext.js +12 -1
- package/lib/component/context/ShareDataContext.d.ts +1 -1
- package/lib/component/context/ShareDataContext.js +2 -4
- package/lib/component/context/ToasterContext.d.ts +1 -0
- package/lib/component/context/ToasterContext.js +12 -3
- package/lib/component/elements/ActionsButtonsPopover.d.ts +7 -1
- package/lib/component/elements/ActionsButtonsPopover.js +7 -6
- package/lib/component/elements/Alert.d.ts +20 -0
- package/lib/component/elements/Alert.js +80 -0
- package/lib/component/elements/ContextMenuBluePrint.d.ts +7 -2
- package/lib/component/elements/ContextMenuBluePrint.js +9 -3
- package/lib/component/elements/Input2.js +2 -2
- package/lib/component/elements/Input2Controller.d.ts +4 -2
- package/lib/component/elements/Input2Controller.js +22 -6
- package/lib/component/elements/MoleculeSelection.js +2 -2
- package/lib/component/elements/NextPrev.d.ts +4 -5
- package/lib/component/elements/NextPrev.js +76 -79
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +0 -3
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +1 -1
- package/lib/component/elements/Select2.d.ts +12 -7
- package/lib/component/elements/Select2.js +5 -4
- package/lib/component/elements/Select2Controller.d.ts +2 -2
- package/lib/component/elements/Select2Controller.js +5 -5
- package/lib/component/elements/ToolbarPopoverItem.d.ts +7 -6
- package/lib/component/elements/ToolbarPopoverItem.js +13 -5
- package/lib/component/elements/print/PrintContent.d.ts +17 -0
- package/lib/component/elements/print/PrintContent.js +281 -0
- package/lib/component/elements/print/PrintProvider.d.ts +12 -0
- package/lib/component/elements/print/PrintProvider.js +28 -0
- package/lib/component/elements/print/index.d.ts +2 -0
- package/lib/component/elements/print/index.js +2 -0
- package/lib/component/header/ApodizationOptionsPanel.js +14 -7
- package/lib/component/header/BaseLineCorrectionPanel.js +20 -10
- package/lib/component/header/ZeroFillingOptionsPanel.js +17 -10
- package/lib/component/hooks/useSaveSettings.js +43 -26
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +14 -9
- package/lib/component/hooks/useToggleSpectraVisibility.js +45 -16
- package/lib/component/hooks/useWorkspaceAction.js +12 -14
- package/lib/component/loader/DropZone.js +3 -67
- package/lib/component/loader/useLoadFiles.d.ts +1 -0
- package/lib/component/loader/useLoadFiles.js +78 -0
- package/lib/component/main/InnerNMRium.d.ts +4 -3
- package/lib/component/main/InnerNMRium.js +4 -9
- package/lib/component/main/InnerNMRiumContents.d.ts +3 -2
- package/lib/component/main/InnerNMRiumContents.js +33 -29
- package/lib/component/main/NMRium.d.ts +2 -5
- package/lib/component/main/NMRium.js +1 -1
- package/lib/component/main/NMRiumRefAPI.d.ts +7 -0
- package/lib/component/main/NMRiumRefAPI.js +12 -0
- package/lib/component/main/NMRiumViewer.d.ts +10 -0
- package/lib/component/main/NMRiumViewer.js +35 -0
- package/lib/component/main/index.d.ts +1 -0
- package/lib/component/modal/CopyClipboardModal.d.ts +3 -2
- package/lib/component/modal/CopyClipboardModal.js +18 -32
- package/lib/component/modal/ExportAsJcampModal.d.ts +6 -3
- package/lib/component/modal/ExportAsJcampModal.js +69 -35
- package/lib/component/modal/ImportPublicationStringModal.js +1 -1
- package/lib/component/modal/LoadJCAMPModal.d.ts +3 -1
- package/lib/component/modal/LoadJCAMPModal.js +17 -18
- package/lib/component/modal/SaveAsModal.d.ts +3 -1
- package/lib/component/modal/SaveAsModal.js +20 -30
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +35 -47
- package/lib/component/modal/changeSum/SelectMolecule.d.ts +2 -5
- package/lib/component/modal/changeSum/SelectMolecule.js +9 -8
- package/lib/component/modal/setting/GeneralSettings.js +4 -2
- package/lib/component/modal/setting/settings-tabs/ExternalAPIsTabContent.d.ts +1 -0
- package/lib/component/modal/setting/settings-tabs/ExternalAPIsTabContent.js +89 -0
- package/lib/component/modal/setting/settingsValidation.js +15 -1
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +8 -5
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +5 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +5 -3
- package/lib/component/panels/Panels.js +15 -15
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +8 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +52 -12
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +13 -6
- package/lib/component/panels/SpectraPanel/SpectraTable.js +63 -21
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +6 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +6 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -0
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +16 -8
- package/lib/component/panels/databasePanel/DatabasePanel.js +7 -8
- package/lib/component/panels/filtersPanel/FilterPanel.js +9 -6
- package/lib/component/panels/filtersPanel/FiltersTable.js +12 -10
- package/lib/component/panels/header/DefaultPanelHeader.d.ts +1 -0
- package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +10 -12
- package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.js +2 -4
- package/lib/component/reducer/actions/DatabaseActions.d.ts +15 -13
- package/lib/component/reducer/actions/DatabaseActions.js +52 -34
- package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
- package/lib/component/reducer/actions/FiltersActions.js +9 -4
- package/lib/component/reducer/actions/SpectraActions.d.ts +2 -1
- package/lib/component/reducer/actions/SpectraActions.js +53 -43
- package/lib/component/reducer/helper/removeSpectrumRelatedObjectsById.d.ts +3 -0
- package/lib/component/reducer/helper/removeSpectrumRelatedObjectsById.js +16 -0
- package/lib/component/reducer/preferences/actions/changeInformationBlockPosition.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changeInformationBlockPosition.js +5 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.js +6 -0
- package/lib/component/reducer/preferences/actions/toggleInformationBlock.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/toggleInformationBlock.js +7 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +12 -2
- package/lib/component/reducer/preferences/preferencesReducer.js +9 -0
- package/lib/component/toolbar/ToolBar.js +33 -14
- package/lib/component/workspaces/workspaceDefaultProperties.js +2 -0
- package/lib/data/SpectraManager.d.ts +7 -10
- package/lib/data/SpectraManager.js +51 -30
- package/lib/data/data1d/Spectrum1D/SumManager.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/SumManager.js +2 -10
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/index.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/index.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +10 -10
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js +65 -0
- package/lib/data/molecules/MoleculeManager.js +16 -38
- package/lib/data/utilities/getCustomColor.d.ts +1 -1
- package/lib/data/utilities/removeByPaths.d.ts +3 -0
- package/lib/data/utilities/removeByPaths.js +33 -0
- package/lib/versionInfo.js +1 -1
- package/package.json +36 -36
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +0 -11
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +0 -29
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { FormGroup } from '@blueprintjs/core';
|
|
4
|
+
import { css } from '@emotion/react';
|
|
2
5
|
import { Controller } from 'react-hook-form';
|
|
3
6
|
import { Input2 } from './Input2';
|
|
4
7
|
export function Input2Controller(props) {
|
|
5
|
-
const { controllerProps, onChange, name, control, intent = 'none', mapOnChangeValue, mapValue, noShadowBox = false, style, ...otherInputProps } = props;
|
|
6
|
-
return (_jsx(Controller, { name: name, control: control, ...controllerProps, render: ({ field, fieldState: { invalid } }) => {
|
|
8
|
+
const { controllerProps, onChange, name, control, intent = 'none', mapOnChangeValue, mapValue, noShadowBox = false, enableErrorMessage = false, style, fill, ...otherInputProps } = props;
|
|
9
|
+
return (_jsx(Controller, { name: name, control: control, ...controllerProps, render: ({ field, fieldState: { invalid, error } }) => {
|
|
7
10
|
const { value: originValue, ...otherFieldProps } = field;
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
let value = originValue;
|
|
12
|
+
if (typeof mapValue === 'function') {
|
|
13
|
+
value = mapValue(originValue);
|
|
14
|
+
}
|
|
15
|
+
const inputComponent = (_jsx(Input2, { value: value, ...otherFieldProps, onChange: (value, event) => {
|
|
10
16
|
if (typeof mapOnChangeValue === 'function') {
|
|
11
17
|
field.onChange(mapOnChangeValue(value));
|
|
12
18
|
}
|
|
@@ -17,6 +23,16 @@ export function Input2Controller(props) {
|
|
|
17
23
|
}, style: {
|
|
18
24
|
...style,
|
|
19
25
|
...(noShadowBox && !invalid && { boxShadow: 'none' }),
|
|
20
|
-
}, intent: invalid ? 'danger' : intent, ...otherInputProps }));
|
|
26
|
+
}, intent: invalid ? 'danger' : intent, fill: fill, ...otherInputProps }));
|
|
27
|
+
if (enableErrorMessage && error?.message) {
|
|
28
|
+
return (_jsx(FormGroup, { fill: fill, ...(fill && {
|
|
29
|
+
css: css `
|
|
30
|
+
div {
|
|
31
|
+
flex: 1;
|
|
32
|
+
}
|
|
33
|
+
`,
|
|
34
|
+
}), helperText: error.message, intent: invalid ? 'danger' : intent, children: inputComponent }));
|
|
35
|
+
}
|
|
36
|
+
return inputComponent;
|
|
21
37
|
} }));
|
|
22
38
|
}
|
|
@@ -4,7 +4,7 @@ import { css } from '@emotion/react';
|
|
|
4
4
|
import { useCallback, useEffect, useState } from 'react';
|
|
5
5
|
import { MF } from 'react-mf';
|
|
6
6
|
import { MolfileSvgRenderer } from 'react-ocl/full';
|
|
7
|
-
import NextPrev from './NextPrev';
|
|
7
|
+
import { NextPrev } from './NextPrev';
|
|
8
8
|
const toolbarStyle = css `
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: row;
|
|
@@ -75,5 +75,5 @@ export default function MoleculeSelection(props) {
|
|
|
75
75
|
}, [onChange]);
|
|
76
76
|
return (_jsxs("div", { children: [_jsx("div", { css: toolbarStyle, children: _jsxs("p", { children: [molecules &&
|
|
77
77
|
molecules.length > 0 &&
|
|
78
|
-
`${+(currentIndex + 1)} / ${molecules.length}`, ' '] }) }), _jsx("div", { css: moleculeContainerStyle, children: _jsx(NextPrev, {
|
|
78
|
+
`${+(currentIndex + 1)} / ${molecules.length}`, ' '] }) }), _jsx("div", { css: moleculeContainerStyle, children: _jsx(NextPrev, { index: currentIndex, onChange: onChangeHandler, children: molecules?.map((mol, index) => (_jsxs("div", { className: "slider", children: [_jsx("div", { children: mol.molfile && (_jsx(MolfileSvgRenderer, { id: `molSVG${index}`, width: 120, molfile: mol.molfile })) }), _jsxs("p", { children: [_jsx(MF, { mf: mol.mf }), " - ", mol.mw?.toFixed(2)] })] }, mol.id))) }) })] }));
|
|
79
79
|
}
|
|
@@ -2,12 +2,11 @@ import { CSSProperties, ReactElement } from 'react';
|
|
|
2
2
|
interface NextPrevProps {
|
|
3
3
|
children: ReactElement | ReactElement[];
|
|
4
4
|
loop?: boolean;
|
|
5
|
-
|
|
6
|
-
onChange
|
|
5
|
+
index: number;
|
|
6
|
+
onChange: (element: number) => void;
|
|
7
7
|
style?: {
|
|
8
8
|
arrowContainer?: CSSProperties;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
declare function NextPrev(props: NextPrevProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
12
|
-
|
|
13
|
-
export default _default;
|
|
11
|
+
export declare function NextPrev(props: NextPrevProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import { Children } from 'react';
|
|
5
6
|
import { FaAngleLeft } from 'react-icons/fa';
|
|
6
7
|
import { useMeasure } from 'react-use';
|
|
7
8
|
function Arrow({ direction, onClick, style = {} }) {
|
|
@@ -34,88 +35,84 @@ function Arrow({ direction, onClick, style = {} }) {
|
|
|
34
35
|
}
|
|
35
36
|
`, style: style, children: _jsx(FaAngleLeft, { style: { transform: `scaleX(${direction === 'right' ? '-1' : '1'})` } }) }));
|
|
36
37
|
}
|
|
38
|
+
const Container = styled.div `
|
|
39
|
+
position: relative;
|
|
40
|
+
height: 100%;
|
|
41
|
+
width: 100%;
|
|
42
|
+
margin: 0 auto;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
display: block;
|
|
45
|
+
`;
|
|
46
|
+
const TransformController = styled.div(({ translation, slidersWidth }) => `transform: translateX(-${translation}px);
|
|
47
|
+
transition: transform ease-out ${transition}s;
|
|
48
|
+
height: 100%;
|
|
49
|
+
width: ${slidersWidth}px;
|
|
50
|
+
display: flex;
|
|
51
|
+
`);
|
|
37
52
|
const transition = 0.45;
|
|
38
|
-
function NextPrev(props) {
|
|
39
|
-
const { children, loop = false,
|
|
53
|
+
export function NextPrev(props) {
|
|
54
|
+
const { children, loop = false, index = 0, onChange = () => null, style = {}, } = props;
|
|
40
55
|
const [ref, { width }] = useMeasure();
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`, children: child }, child.key));
|
|
50
|
-
}), [children, width]);
|
|
51
|
-
const nextHandler = useCallback(() => {
|
|
52
|
-
setActiveIndex((preActiveIndex) => {
|
|
53
|
-
if (Sliders && preActiveIndex === Sliders.length - 1) {
|
|
54
|
-
onChange(preActiveIndex);
|
|
55
|
-
if (loop) {
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return preActiveIndex;
|
|
60
|
-
}
|
|
56
|
+
const slidersCount = Children.count(children);
|
|
57
|
+
const lastIndex = slidersCount > 0 ? slidersCount - 1 : 0;
|
|
58
|
+
const activeIndex = index > lastIndex ? lastIndex : index;
|
|
59
|
+
function nextHandler() {
|
|
60
|
+
if (index === lastIndex) {
|
|
61
|
+
onChange(index);
|
|
62
|
+
if (loop) {
|
|
63
|
+
return 0;
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return nextIndex;
|
|
65
|
-
});
|
|
66
|
-
}, [Sliders, loop, onChange]);
|
|
67
|
-
const prevHandler = useCallback(() => {
|
|
68
|
-
setActiveIndex((preActiveIndex) => {
|
|
69
|
-
if (preActiveIndex === 0) {
|
|
70
|
-
onChange(preActiveIndex);
|
|
71
|
-
if (loop) {
|
|
72
|
-
return 0;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return preActiveIndex;
|
|
76
|
-
}
|
|
65
|
+
else {
|
|
66
|
+
return index;
|
|
77
67
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
}
|
|
69
|
+
const nextIndex = index + 1;
|
|
70
|
+
onChange(nextIndex);
|
|
71
|
+
}
|
|
72
|
+
function prevHandler() {
|
|
73
|
+
if (index === 0) {
|
|
74
|
+
onChange(index);
|
|
75
|
+
if (loop) {
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return index;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const prevIndex = index - 1;
|
|
83
|
+
onChange(prevIndex);
|
|
84
|
+
}
|
|
85
|
+
if (!width && slidersCount === 0)
|
|
84
86
|
return null;
|
|
85
87
|
const translation = width * activeIndex;
|
|
86
|
-
const slidersWidth = width *
|
|
87
|
-
return (_jsxs(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
visibility: 'hidden',
|
|
117
|
-
pointerEvents: 'none',
|
|
118
|
-
}),
|
|
119
|
-
} })] })] }));
|
|
88
|
+
const slidersWidth = width * slidersCount;
|
|
89
|
+
return (_jsxs(Container, { ref: ref, children: [_jsx(TransformController, { translation: translation, slidersWidth: slidersWidth, children: Children.map(children, (child) => {
|
|
90
|
+
return (_jsx("div", { css: css `
|
|
91
|
+
width: ${width}px;
|
|
92
|
+
height: 100%;
|
|
93
|
+
`, children: child }, child.key));
|
|
94
|
+
}) }), _jsx(SliderControllers, { onNext: nextHandler, onPrevious: prevHandler, activeIndex: activeIndex, lastIndex: lastIndex, style: style?.arrowContainer })] }));
|
|
95
|
+
}
|
|
96
|
+
function SliderControllers(props) {
|
|
97
|
+
const { onNext, onPrevious, activeIndex, lastIndex, style } = props;
|
|
98
|
+
return (_jsxs("div", { style: {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
top: '50%',
|
|
101
|
+
padding: '0 10px',
|
|
102
|
+
justifyContent: 'space-between',
|
|
103
|
+
width: '100%',
|
|
104
|
+
display: 'flex',
|
|
105
|
+
pointerEvents: 'none',
|
|
106
|
+
...style,
|
|
107
|
+
}, children: [_jsx(Arrow, { direction: "left", onClick: onPrevious, style: {
|
|
108
|
+
...(activeIndex === 0 && {
|
|
109
|
+
visibility: 'hidden',
|
|
110
|
+
pointerEvents: 'none',
|
|
111
|
+
}),
|
|
112
|
+
} }), _jsx(Arrow, { direction: "right", onClick: onNext, style: {
|
|
113
|
+
...(activeIndex === lastIndex && {
|
|
114
|
+
visibility: 'hidden',
|
|
115
|
+
pointerEvents: 'none',
|
|
116
|
+
}),
|
|
117
|
+
} })] }));
|
|
120
118
|
}
|
|
121
|
-
export default memo(NextPrev);
|
|
@@ -52,7 +52,7 @@ function ReactTableRow(props) {
|
|
|
52
52
|
onClick?.(event, row);
|
|
53
53
|
}, [onClick, row]);
|
|
54
54
|
const { key: rowKey, ...otherKeyProps } = row.getRowProps();
|
|
55
|
-
return (_jsx(ContextMenu, { options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, row.original), as: "tr", style: { position: 'static' }, css: getRowStyle(highlight.isActive || isRowActive, rowStyle, disableDefaultRowStyle), ...otherKeyProps, ...highlight.onHover, children: row.cells.map((cell) => {
|
|
55
|
+
return (_jsx(ContextMenu, { data: row.original, options: contextMenu, onSelect: (selected) => onContextMenuSelect?.(selected, row.original), as: "tr", style: { position: 'static' }, css: getRowStyle(highlight.isActive || isRowActive, rowStyle, disableDefaultRowStyle), ...otherKeyProps, ...highlight.onHover, children: row.cells.map((cell) => {
|
|
56
56
|
const { column: { style }, isRowSpanned, } = cell;
|
|
57
57
|
if (isRowSpanned) {
|
|
58
58
|
return null;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
|
-
import { UseSortByOptions } from 'react-table';
|
|
4
3
|
interface ReactTableFlexLayoutProps {
|
|
5
4
|
data: any;
|
|
6
5
|
columns: any;
|
|
7
6
|
onMouseDown?: () => void;
|
|
8
7
|
style?: CSSProperties;
|
|
9
8
|
}
|
|
10
|
-
export interface TableOptions<D extends Record<string, unknown>> extends UseSortByOptions<D> {
|
|
11
|
-
}
|
|
12
9
|
declare function ReactTableFlexLayout({ data, columns, onMouseDown, style, }: ReactTableFlexLayoutProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
10
|
export default ReactTableFlexLayout;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useTable, useSortBy, useFlexLayout
|
|
2
|
+
import { useTable, useSortBy, useFlexLayout } from 'react-table';
|
|
3
3
|
import { ReactTableStyle } from './Style';
|
|
4
4
|
function ReactTableFlexLayout({ data, columns, onMouseDown = () => null, style = {}, }) {
|
|
5
5
|
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import { ButtonProps } from '@blueprintjs/core';
|
|
2
2
|
import { SelectProps } from '@blueprintjs/select';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
3
|
+
import { ForwardedRef, ReactNode } from 'react';
|
|
4
4
|
import { useSelect } from 'react-science/ui';
|
|
5
5
|
import { FilterType } from '../utility/filterType';
|
|
6
6
|
interface ItemOptions<T> {
|
|
7
7
|
renderItem?: (item: T) => ReactNode;
|
|
8
8
|
defaultSelectedItem?: T;
|
|
9
9
|
}
|
|
10
|
-
interface ItemSelectOptions<T extends
|
|
10
|
+
interface ItemSelectOptions<T extends Record<string, any> = SelectDefaultItem> {
|
|
11
11
|
itemTextKey?: keyof FilterType<T, string>;
|
|
12
12
|
itemValueKey?: keyof T;
|
|
13
13
|
selectedItemValue?: T[keyof T];
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
filterPlaceholder?: string;
|
|
14
16
|
}
|
|
15
|
-
type SelectOptions<T extends
|
|
17
|
+
type SelectOptions<T extends Record<string, any> = SelectDefaultItem> = ItemOptions<T> & ItemSelectOptions<T>;
|
|
16
18
|
type ReturnedUseSelectOptions = ReturnType<typeof useSelect>;
|
|
17
|
-
export type Select2Props<T extends
|
|
19
|
+
export type Select2Props<T extends Record<string, any> = SelectDefaultItem> = Omit<SelectProps<T>, keyof Omit<ReturnedUseSelectOptions, 'onItemSelect' | 'value'>> & SelectOptions<T> & {
|
|
18
20
|
selectedButtonProps?: Omit<ButtonProps, 'text'>;
|
|
19
|
-
}
|
|
20
|
-
export declare function getDefaultSelectedItem<T extends
|
|
21
|
+
} & Pick<ButtonProps, 'intent'>;
|
|
22
|
+
export declare function getDefaultSelectedItem<T extends Record<string, any> = SelectDefaultItem>(items: T[], itemValueKey?: keyof T, value?: any): T | undefined;
|
|
21
23
|
export interface SelectDefaultItem {
|
|
22
24
|
label: string;
|
|
23
25
|
value: any;
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
declare function InnerSelect2<T extends Record<string, any> = SelectDefaultItem>(props: Select2Props<T>, ref: any): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const Select2: <T extends Record<string, any> = SelectDefaultItem>(props: Select2Props<T> & {
|
|
29
|
+
ref?: ForwardedRef<HTMLButtonElement>;
|
|
30
|
+
}) => ReturnType<typeof InnerSelect2>;
|
|
26
31
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '@blueprintjs/core';
|
|
3
3
|
import { Select } from '@blueprintjs/select';
|
|
4
|
-
import { useEffect } from 'react';
|
|
4
|
+
import { forwardRef, useEffect } from 'react';
|
|
5
5
|
import { useSelect } from 'react-science/ui';
|
|
6
6
|
export function getDefaultSelectedItem(items, itemValueKey, value) {
|
|
7
7
|
return items.find((item) => itemValueKey && item[itemValueKey] === value);
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
const { items, defaultSelectedItem, itemTextKey = 'label', itemValueKey = 'value', selectedItemValue, onItemSelect, selectedButtonProps, fill, ...otherProps } = props;
|
|
9
|
+
function InnerSelect2(props, ref) {
|
|
10
|
+
const { items, defaultSelectedItem, itemTextKey = 'label', itemValueKey = 'value', selectedItemValue, onItemSelect, selectedButtonProps, fill, intent, placeholder = '', filterPlaceholder, ...otherProps } = props;
|
|
11
11
|
const { value: item, onItemSelect: innerOnItemSelect, setValue, ...defaultSelectProps } = useSelect({
|
|
12
12
|
defaultSelectedItem: defaultSelectedItem ??
|
|
13
13
|
getDefaultSelectedItem(items, itemValueKey, selectedItemValue),
|
|
@@ -21,5 +21,6 @@ export function Select2(props) {
|
|
|
21
21
|
return (_jsx(Select, { items: items, filterable: false, onItemSelect: (item, event) => {
|
|
22
22
|
innerOnItemSelect(item);
|
|
23
23
|
onItemSelect(item, event);
|
|
24
|
-
}, ...defaultSelectProps, ...otherProps, fill: fill, children: _jsx(Button, { fill: fill, text: item?.[itemTextKey] ? String(item[itemTextKey]) :
|
|
24
|
+
}, ...defaultSelectProps, ...otherProps, placeholder: filterPlaceholder, fill: fill, children: _jsx(Button, { ref: ref, fill: fill, text: item?.[itemTextKey] ? String(item[itemTextKey]) : placeholder, ...selectedButtonProps, rightIcon: "double-caret-vertical", intent: intent }) }));
|
|
25
25
|
}
|
|
26
|
+
export const Select2 = forwardRef(InnerSelect2);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ControllerProps, FieldValues } from 'react-hook-form';
|
|
2
2
|
import { Select2Props, SelectDefaultItem } from './Select2';
|
|
3
|
-
type Select2ControllerProps<T extends
|
|
3
|
+
type Select2ControllerProps<T extends Record<string, any> = SelectDefaultItem, TFieldValues extends FieldValues = FieldValues> = {
|
|
4
4
|
controllerProps?: Omit<ControllerProps<TFieldValues>, 'render'>;
|
|
5
5
|
} & Pick<ControllerProps<TFieldValues>, 'control' | 'name'> & Omit<Select2Props<T>, 'onItemSelect' | 'selectedItemValue'> & Partial<Pick<Select2Props<T>, 'onItemSelect'>>;
|
|
6
|
-
export declare function Select2Controller<T extends
|
|
6
|
+
export declare function Select2Controller<T extends Record<string, any>, TFieldValues extends FieldValues = FieldValues>(props: Select2ControllerProps<T, TFieldValues>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Controller } from 'react-hook-form';
|
|
3
3
|
import { Select2 } from './Select2';
|
|
4
4
|
export function Select2Controller(props) {
|
|
5
|
-
const { name, control, controllerProps = {}, onItemSelect, ...otherSelectProps } = props;
|
|
6
|
-
return (_jsx(Controller, { name: name, control: control, ...controllerProps, render: ({ field }) => {
|
|
7
|
-
return (_jsx(Select2, { selectedItemValue: field.value, onItemSelect: (item, event) => {
|
|
8
|
-
field.onChange(item
|
|
5
|
+
const { name, control, controllerProps = {}, onItemSelect, intent, itemValueKey = 'value', ...otherSelectProps } = props;
|
|
6
|
+
return (_jsx(Controller, { name: name, control: control, ...controllerProps, render: ({ field, fieldState: { invalid } }) => {
|
|
7
|
+
return (_jsx(Select2, { itemValueKey: itemValueKey, selectedItemValue: field.value, onItemSelect: (item, event) => {
|
|
8
|
+
field.onChange(item[itemValueKey]);
|
|
9
9
|
onItemSelect?.(item, event);
|
|
10
|
-
}, ...otherSelectProps }));
|
|
10
|
+
}, ...otherSelectProps, intent: invalid ? 'danger' : intent }));
|
|
11
11
|
} }));
|
|
12
12
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { MenuItemProps } from '@blueprintjs/core';
|
|
2
2
|
import { ToolbarPopoverItemProps as BaseToolbarPopoverItemProps, ToolbarItemProps } from 'react-science/ui';
|
|
3
|
-
export interface ToolbarPopoverMenuItem extends MenuItemProps {
|
|
4
|
-
data?:
|
|
3
|
+
export interface ToolbarPopoverMenuItem<T = object> extends MenuItemProps {
|
|
4
|
+
data?: T;
|
|
5
5
|
}
|
|
6
|
-
interface ToolbarPopoverItemProps extends Omit<BaseToolbarPopoverItemProps, 'onClick' | 'content' | 'itemProps'>, ToolbarItemProps {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface ToolbarPopoverItemProps<T = object> extends Omit<BaseToolbarPopoverItemProps, 'onClick' | 'content' | 'itemProps'>, Pick<ToolbarItemProps, 'tooltip' | 'icon' | 'tooltipProps' | 'active' | 'id'> {
|
|
7
|
+
itemProps?: Omit<ToolbarItemProps, 'onClick' | 'disabled'>;
|
|
8
|
+
options: Array<ToolbarPopoverMenuItem<T>>;
|
|
9
|
+
onClick: (data?: T) => void;
|
|
9
10
|
}
|
|
10
|
-
export declare function ToolbarPopoverItem(props: ToolbarPopoverItemProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function ToolbarPopoverItem<T = object>(props: ToolbarPopoverItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -2,9 +2,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Menu, MenuItem } from '@blueprintjs/core';
|
|
3
3
|
import { Toolbar, } from 'react-science/ui';
|
|
4
4
|
export function ToolbarPopoverItem(props) {
|
|
5
|
-
const { options, onClick,
|
|
6
|
-
return (_jsx(Toolbar.PopoverItem, { content: _jsx(Menu, { children: options.map((option) => {
|
|
7
|
-
const { data, ...otherOptions } = option;
|
|
8
|
-
return (_jsx(MenuItem, { ...otherOptions, onClick: () => onClick(data) }, JSON.stringify(
|
|
9
|
-
}) }), itemProps:
|
|
5
|
+
const { options, onClick, icon, tooltip, tooltipProps, active, id, itemProps, disabled, ...otherPopoverItemProps } = props;
|
|
6
|
+
return (_jsx(Toolbar.PopoverItem, { disabled: disabled, ...otherPopoverItemProps, content: _jsx(Menu, { children: options.map((option) => {
|
|
7
|
+
const { data, text, ...otherOptions } = option;
|
|
8
|
+
return (_jsx(MenuItem, { text: text, ...otherOptions, onClick: () => onClick(data) }, JSON.stringify({ data, text })));
|
|
9
|
+
}) }), itemProps: {
|
|
10
|
+
icon,
|
|
11
|
+
tooltip,
|
|
12
|
+
tooltipProps,
|
|
13
|
+
active,
|
|
14
|
+
id,
|
|
15
|
+
disabled,
|
|
16
|
+
...itemProps,
|
|
17
|
+
} }));
|
|
10
18
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PrintPageOptions } from 'nmr-load-save';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface BasePrintProps {
|
|
4
|
+
onPrint: (options: PrintPageOptions) => void;
|
|
5
|
+
defaultPrintPageOptions: Partial<PrintPageOptions>;
|
|
6
|
+
}
|
|
7
|
+
interface InnerPrintFrameProps {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
onAfterPrint?: () => void;
|
|
10
|
+
onBeforePrint?: () => void;
|
|
11
|
+
printPageOptions?: Partial<PrintPageOptions>;
|
|
12
|
+
}
|
|
13
|
+
interface PrintFrameProps extends InnerPrintFrameProps, Partial<BasePrintProps> {
|
|
14
|
+
}
|
|
15
|
+
export declare function PrintContent(props: PrintFrameProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function InnerPrintFrame(props: InnerPrintFrameProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|