nmrium 0.59.0 → 0.60.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/LinesSeries.js +17 -5
- package/lib/component/1d/Viewer1D.js +10 -4
- package/lib/component/1d/ranges/Range.js +4 -2
- package/lib/component/1d/tool/PivotIndicator.d.ts +1 -0
- package/lib/component/1d/tool/{VerticalIndicator.js → PivotIndicator.js} +8 -4
- package/lib/component/1d-2d/tools/BrushXY.js +0 -1
- package/lib/component/1d-2d/tools/CrossLinePointer.js +0 -1
- package/lib/component/2d/Viewer2D.js +1 -1
- package/lib/component/2d/tools/PivotIndicator.d.ts +1 -2
- package/lib/component/2d/tools/PivotIndicator.js +2 -3
- package/lib/component/elements/DialogManager.d.ts +34 -0
- package/lib/component/elements/DialogManager.js +96 -0
- package/lib/component/elements/DraggableDialog.d.ts +13 -0
- package/lib/component/elements/DraggableDialog.js +156 -0
- package/lib/component/elements/TabTitle.d.ts +9 -0
- package/lib/component/elements/TabTitle.js +18 -0
- package/lib/component/header/ApodizationOptionsPanel.js +2 -2
- package/lib/component/hooks/useSaveSettings.d.ts +1 -1
- package/lib/component/hooks/useSaveSettings.js +18 -22
- package/lib/component/main/InnerNMRium.js +2 -2
- package/lib/component/main/InnerNMRiumContents.js +5 -0
- package/lib/component/modal/EditPeakShapeModal.d.ts +4 -6
- package/lib/component/modal/EditPeakShapeModal.js +45 -33
- package/lib/component/modal/editRange/EditRangeModal.d.ts +2 -10
- package/lib/component/modal/editRange/EditRangeModal.js +26 -54
- package/lib/component/modal/editZone/EditZoneModal.d.ts +3 -8
- package/lib/component/modal/editZone/EditZoneModal.js +74 -91
- package/lib/component/modal/editZone/SignalsForm.d.ts +1 -2
- package/lib/component/modal/editZone/SignalsForm.js +33 -50
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +1 -2
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +3 -5
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -3
- package/lib/component/panels/PeaksPanel/PeaksTable.js +7 -13
- package/lib/component/panels/RangesPanel/RangesHeader.js +0 -3
- package/lib/component/panels/RangesPanel/RangesTable.js +6 -3
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +21 -3
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +6 -5
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +41 -64
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.d.ts +1 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +33 -41
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +66 -55
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +68 -60
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.d.ts +13 -8
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +17 -81
- package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts +3 -0
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +4 -1
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +62 -43
- package/lib/component/panels/ZonesPanel/ZonesTable.js +4 -1
- package/lib/component/panels/ZonesPanel/hooks/useZoneActions.d.ts +5 -0
- package/lib/component/panels/ZonesPanel/hooks/useZoneActions.js +40 -0
- package/lib/component/reducer/actions/RangesActions.d.ts +1 -0
- package/lib/component/reducer/actions/RangesActions.js +9 -4
- package/lib/component/reducer/actions/ToolsActions.js +0 -17
- package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +0 -4
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +1 -2
- package/lib/component/toolbar/ToolTypes.d.ts +1 -1
- package/lib/component/toolbar/ToolTypes.js +0 -14
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +1 -7
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +1 -7
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +1 -7
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +1 -7
- package/lib/data/molecules/MoleculeManager.d.ts +1 -1
- package/lib/data/molecules/MoleculeManager.js +5 -11
- package/lib/versionInfo.js +1 -1
- package/package.json +2 -2
- package/lib/component/1d/tool/VerticalIndicator.d.ts +0 -2
- package/lib/component/elements/ContextMenu.d.ts +0 -9
- package/lib/component/elements/ContextMenu.js +0 -116
- package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +0 -21
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +0 -68
- package/lib/component/elements/popup/Modal/Context.d.ts +0 -2
- package/lib/component/elements/popup/Modal/Context.js +0 -6
- package/lib/component/elements/popup/Modal/Modal.d.ts +0 -9
- package/lib/component/elements/popup/Modal/Modal.js +0 -42
- package/lib/component/elements/popup/Modal/ModalContent.d.ts +0 -6
- package/lib/component/elements/popup/Modal/ModalContent.js +0 -27
- package/lib/component/elements/popup/Modal/Provider.d.ts +0 -11
- package/lib/component/elements/popup/Modal/Provider.js +0 -172
- package/lib/component/elements/popup/Modal/index.d.ts +0 -4
- package/lib/component/elements/popup/Modal/index.js +0 -4
- package/lib/component/elements/popup/Transition.d.ts +0 -14
- package/lib/component/elements/popup/Transition.js +0 -35
- package/lib/component/elements/popup/Wrapper.d.ts +0 -8
- package/lib/component/elements/popup/Wrapper.js +0 -83
- package/lib/component/elements/popup/options.d.ts +0 -28
- package/lib/component/elements/popup/options.js +0 -25
- package/lib/component/elements/popup/utility.d.ts +0 -2
- package/lib/component/elements/popup/utility.js +0 -13
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +0 -5
- package/lib/component/modal/editZone/EditPathLengthFormik.js +0 -67
- package/lib/component/modal/editZone/SignalFormTab.d.ts +0 -5
- package/lib/component/modal/editZone/SignalFormTab.js +0 -6
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +0 -14
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +0 -14
|
@@ -14,10 +14,6 @@ type addMatrixGenerationExclusionZoneAction = ActionType<'ADD_MATRIX_GENERATION_
|
|
|
14
14
|
from: number;
|
|
15
15
|
to: number;
|
|
16
16
|
};
|
|
17
|
-
range: {
|
|
18
|
-
from: number;
|
|
19
|
-
to: number;
|
|
20
|
-
};
|
|
21
17
|
nucleus: string;
|
|
22
18
|
}>;
|
|
23
19
|
type deleteMatrixGenerationExclusionZoneAction = ActionType<'DELETE_MATRIX_GENERATION_EXCLUSION_ZONE', {
|
|
@@ -22,7 +22,7 @@ function initMatrixGeneration(draft, nucleus) {
|
|
|
22
22
|
return panels.matrixGeneration;
|
|
23
23
|
}
|
|
24
24
|
function addExclusionZone(draft, action) {
|
|
25
|
-
const { zone,
|
|
25
|
+
const { zone, nucleus } = action.payload;
|
|
26
26
|
const matrixGeneration = getMatrixGenerationPanelOptions(draft, nucleus);
|
|
27
27
|
if (!matrixGeneration)
|
|
28
28
|
return;
|
|
@@ -30,7 +30,6 @@ function addExclusionZone(draft, action) {
|
|
|
30
30
|
id: v4(),
|
|
31
31
|
...zone,
|
|
32
32
|
};
|
|
33
|
-
matrixGeneration.matrixOptions.range = range;
|
|
34
33
|
matrixGeneration.matrixOptions.exclusionsZones.push(exclusionZone);
|
|
35
34
|
}
|
|
36
35
|
function deleteExclusionZone(draft, action) {
|
|
@@ -20,7 +20,7 @@ export interface ToolOptionItem {
|
|
|
20
20
|
isFilter: boolean;
|
|
21
21
|
isExperimental?: true;
|
|
22
22
|
}
|
|
23
|
-
export type Tool = keyof NMRiumToolBarPreferences | 'HMove' | 'equalizer' | 'generalSelector' | '
|
|
23
|
+
export type Tool = keyof NMRiumToolBarPreferences | 'HMove' | 'equalizer' | 'generalSelector' | 'databaseRangesSelection' | 'matrixGenerationExclusionZones';
|
|
24
24
|
type RecordOptions = Record<Tool, ToolOptionItem>;
|
|
25
25
|
export declare const options: RecordOptions;
|
|
26
26
|
export {};
|
|
@@ -184,20 +184,6 @@ export const options = {
|
|
|
184
184
|
],
|
|
185
185
|
isToggle: true,
|
|
186
186
|
},
|
|
187
|
-
editRange: {
|
|
188
|
-
id: 'editRange',
|
|
189
|
-
label: 'edit range',
|
|
190
|
-
hasOptionPanel: false,
|
|
191
|
-
isFilter: false,
|
|
192
|
-
mode: '1D',
|
|
193
|
-
spectraOptions: [
|
|
194
|
-
{
|
|
195
|
-
info: [{ key: 'isFt', value: true }],
|
|
196
|
-
active: true,
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
isToggle: true,
|
|
200
|
-
},
|
|
201
187
|
multipleSpectraAnalysis: {
|
|
202
188
|
id: 'multipleSpectraAnalysis',
|
|
203
189
|
label: 'Multiple spectra analysis',
|
|
@@ -16,13 +16,7 @@ export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, '
|
|
|
16
16
|
diaIDs?: string[] | undefined;
|
|
17
17
|
nbAtoms?: number | undefined;
|
|
18
18
|
integration?: number | undefined;
|
|
19
|
-
|
|
20
|
-
mean: number;
|
|
21
|
-
sd: number;
|
|
22
|
-
min: number;
|
|
23
|
-
max: number;
|
|
24
|
-
nb: number;
|
|
25
|
-
} | undefined;
|
|
19
|
+
statistics?: import("nmr-processing").NMRSignalStatistics | undefined;
|
|
26
20
|
kind: string;
|
|
27
21
|
id: string;
|
|
28
22
|
peaks: {
|
|
@@ -34,11 +34,5 @@ export default function detectSignals(data: DataXY<Float64Array>, options: {
|
|
|
34
34
|
nbAtoms?: number;
|
|
35
35
|
integration?: number;
|
|
36
36
|
peaks?: import("nmr-processing").NMRPeak1D[];
|
|
37
|
-
|
|
38
|
-
mean: number;
|
|
39
|
-
sd: number;
|
|
40
|
-
min: number;
|
|
41
|
-
max: number;
|
|
42
|
-
nb: number;
|
|
43
|
-
};
|
|
37
|
+
statistics?: import("nmr-processing").NMRSignalStatistics;
|
|
44
38
|
}[];
|
|
@@ -16,13 +16,7 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
|
|
|
16
16
|
diaIDs?: string[] | undefined;
|
|
17
17
|
nbAtoms?: number | undefined;
|
|
18
18
|
integration?: number | undefined;
|
|
19
|
-
|
|
20
|
-
mean: number;
|
|
21
|
-
sd: number;
|
|
22
|
-
min: number;
|
|
23
|
-
max: number;
|
|
24
|
-
nb: number;
|
|
25
|
-
} | undefined;
|
|
19
|
+
statistics?: import("nmr-processing").NMRSignalStatistics | undefined;
|
|
26
20
|
kind: string;
|
|
27
21
|
id: string;
|
|
28
22
|
peaks: {
|
|
@@ -18,13 +18,7 @@ export declare function resizeRange(spectrum: Spectrum1D, options: {
|
|
|
18
18
|
diaIDs?: string[] | undefined;
|
|
19
19
|
nbAtoms?: number | undefined;
|
|
20
20
|
integration?: number | undefined;
|
|
21
|
-
|
|
22
|
-
mean: number;
|
|
23
|
-
sd: number;
|
|
24
|
-
min: number;
|
|
25
|
-
max: number;
|
|
26
|
-
nb: number;
|
|
27
|
-
} | undefined;
|
|
21
|
+
statistics?: import("nmr-processing").NMRSignalStatistics | undefined;
|
|
28
22
|
kind: string;
|
|
29
23
|
id: string;
|
|
30
24
|
peaks: {
|
|
@@ -5,4 +5,4 @@ export declare function setMolfile(molecules: StateMoleculeExtended[], currentMo
|
|
|
5
5
|
export declare function extractNumber(value: string): string | null;
|
|
6
6
|
export declare function extractLabelsNumbers(molecules: Array<Pick<StateMolecule, 'label'>>): number[];
|
|
7
7
|
export declare function getLabelNumber(reserveNumbers: number[]): number;
|
|
8
|
-
export declare function getMolecules(text: string):
|
|
8
|
+
export declare function getMolecules(text: string): import("nmr-load-save").StateMolecule[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { read } from 'nmr-load-save';
|
|
1
|
+
import { readSDF, readSMILES } from 'nmr-load-save';
|
|
3
2
|
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
4
3
|
import { initMolecule } from './Molecule';
|
|
5
4
|
export function fromJSON(mols, reservedMolecules = []) {
|
|
@@ -60,15 +59,10 @@ export function getLabelNumber(reserveNumbers) {
|
|
|
60
59
|
}
|
|
61
60
|
return 1;
|
|
62
61
|
}
|
|
63
|
-
export
|
|
64
|
-
|
|
62
|
+
export function getMolecules(text) {
|
|
63
|
+
// parse SDF
|
|
65
64
|
if (/v[23]000/i.test(text)) {
|
|
66
|
-
|
|
65
|
+
return readSDF(text);
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
type: 'text/plain',
|
|
70
|
-
});
|
|
71
|
-
const collection = await fileCollectionFromFiles([file]);
|
|
72
|
-
const { nmriumState: { data }, } = await read(collection);
|
|
73
|
-
return data?.molecules || [];
|
|
67
|
+
return readSMILES(text);
|
|
74
68
|
}
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.60.0' };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.60.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "lib/component/main/index.js",
|
|
7
7
|
"types": "lib/component/main/index.d.ts",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"ml-tree-similarity": "^2.2.0",
|
|
92
92
|
"multiplet-analysis": "^2.1.2",
|
|
93
93
|
"nmr-correlation": "^2.3.3",
|
|
94
|
-
"nmr-load-save": "^0.
|
|
94
|
+
"nmr-load-save": "^0.37.1",
|
|
95
95
|
"nmr-processing": "^12.11.0",
|
|
96
96
|
"nmredata": "^0.9.11",
|
|
97
97
|
"numeral": "^2.0.6",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface ContextMenuItem<T> {
|
|
2
|
-
onClick: (data?: T) => void;
|
|
3
|
-
label: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ContextMenuProps<T = unknown> {
|
|
6
|
-
context: Array<ContextMenuItem<T>>;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: import("react").ForwardRefExoticComponent<ContextMenuProps<unknown> & import("react").RefAttributes<unknown>>;
|
|
9
|
-
export default _default;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { useState, useImperativeHandle, useCallback, useRef, useEffect, forwardRef, } from 'react';
|
|
5
|
-
import { createPortal } from 'react-dom';
|
|
6
|
-
import { useGlobal } from '../context/GlobalContext';
|
|
7
|
-
const styles = css `
|
|
8
|
-
box-shadow: 0 0 10px rgb(0 0 0 / 25%);
|
|
9
|
-
margin: 0;
|
|
10
|
-
border-radius: 2px;
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
position: fixed;
|
|
14
|
-
z-index: 99999;
|
|
15
|
-
padding: 2px;
|
|
16
|
-
background-color: white;
|
|
17
|
-
width: 150px;
|
|
18
|
-
pointer-events: all;
|
|
19
|
-
|
|
20
|
-
button {
|
|
21
|
-
background-color: transparent;
|
|
22
|
-
border: none;
|
|
23
|
-
border-bottom: 0.55px solid #f0f0f0;
|
|
24
|
-
font-size: 11px;
|
|
25
|
-
padding: 5px;
|
|
26
|
-
text-align: left;
|
|
27
|
-
outline: none;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
button:hover {
|
|
31
|
-
background-color: #fafafa;
|
|
32
|
-
outline: none;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
button:active {
|
|
36
|
-
background-color: #eaeaea;
|
|
37
|
-
outline: none;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
button:last-of-type {
|
|
41
|
-
border: none;
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
// TODO: remove this hacky ref usage.
|
|
45
|
-
function ContextMenu({ context }, ref) {
|
|
46
|
-
const [position, setPosition] = useState({
|
|
47
|
-
left: 0,
|
|
48
|
-
top: 0,
|
|
49
|
-
});
|
|
50
|
-
const { rootRef, elementsWrapperRef } = useGlobal();
|
|
51
|
-
const [data, setData] = useState();
|
|
52
|
-
const [isVisible, show] = useState();
|
|
53
|
-
const [sourceElement, setSourceElement] = useState(null);
|
|
54
|
-
const root = useRef();
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
root.current = document.createElement('div');
|
|
57
|
-
if (elementsWrapperRef) {
|
|
58
|
-
elementsWrapperRef.append(root.current);
|
|
59
|
-
}
|
|
60
|
-
return () => {
|
|
61
|
-
if (root.current && elementsWrapperRef) {
|
|
62
|
-
root.current.remove();
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}, [elementsWrapperRef]);
|
|
66
|
-
const contextMenuHandler = (event) => {
|
|
67
|
-
event.preventDefault();
|
|
68
|
-
setSourceElement(event.target.parentElement);
|
|
69
|
-
show(true);
|
|
70
|
-
const clickX = event.clientX;
|
|
71
|
-
const clickY = event.clientY;
|
|
72
|
-
const screenW = window.innerWidth;
|
|
73
|
-
const screenH = window.innerHeight;
|
|
74
|
-
const rootW = 150;
|
|
75
|
-
const rootH = 0;
|
|
76
|
-
const right = screenW - clickX > rootW;
|
|
77
|
-
const bottom = screenH - clickY <= rootH;
|
|
78
|
-
const left = right ? `${clickX + 5}px` : `${clickX - rootW - 5}px`;
|
|
79
|
-
const top = bottom ? `${clickY - rootH - 5}px` : `${clickY + 5}px`;
|
|
80
|
-
setPosition({ left, top });
|
|
81
|
-
};
|
|
82
|
-
useImperativeHandle(ref, () => ({
|
|
83
|
-
handleContextMenu: (e, _data) => {
|
|
84
|
-
setData(_data);
|
|
85
|
-
contextMenuHandler(e);
|
|
86
|
-
},
|
|
87
|
-
}));
|
|
88
|
-
const clickHandler = useCallback((event, click) => {
|
|
89
|
-
event.preventDefault();
|
|
90
|
-
click(data);
|
|
91
|
-
show(false);
|
|
92
|
-
}, [data]);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
const _handleGlobalClick = (event) => {
|
|
95
|
-
const wasOutside = sourceElement &&
|
|
96
|
-
event.target.parentElement &&
|
|
97
|
-
!event.target.parentElement.isSameNode(sourceElement);
|
|
98
|
-
if (wasOutside && isVisible)
|
|
99
|
-
show(false);
|
|
100
|
-
};
|
|
101
|
-
if (rootRef) {
|
|
102
|
-
rootRef.addEventListener('click', _handleGlobalClick);
|
|
103
|
-
}
|
|
104
|
-
return () => {
|
|
105
|
-
if (rootRef) {
|
|
106
|
-
rootRef.removeEventListener('click', _handleGlobalClick);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}, [isVisible, ref, rootRef, sourceElement]);
|
|
110
|
-
if (!isVisible) {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
return (root.current &&
|
|
114
|
-
createPortal(context && (_jsx("div", { ref: ref, css: [styles, position], children: context.map((c, index) => (_jsx("button", { type: "button", onClick: (e) => clickHandler(e, c.onClick), children: c.label }, index))) })), root.current));
|
|
115
|
-
}
|
|
116
|
-
export default forwardRef(ContextMenu);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
interface AlertButtonOptions {
|
|
3
|
-
handler: (e: React.MouseEvent) => void;
|
|
4
|
-
text: string;
|
|
5
|
-
style?: CSSProperties;
|
|
6
|
-
preventClose?: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface ConfirmationDialogProps {
|
|
9
|
-
style?: CSSProperties;
|
|
10
|
-
buttons: AlertButtonOptions[];
|
|
11
|
-
onClose: () => void;
|
|
12
|
-
message: ReactNode;
|
|
13
|
-
render?: (data: {
|
|
14
|
-
message: ReactNode;
|
|
15
|
-
className: string;
|
|
16
|
-
}) => ReactNode;
|
|
17
|
-
id?: string;
|
|
18
|
-
disableDefaultStyle?: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare function ConfirmationDialog({ style, buttons, onClose, message, render, id, disableDefaultStyle, }: ConfirmationDialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
21
|
-
export default ConfirmationDialog;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { DialogBody } from '@blueprintjs/core';
|
|
4
|
-
import { css } from '@emotion/react';
|
|
5
|
-
import { useCallback } from 'react';
|
|
6
|
-
const styles = css `
|
|
7
|
-
background-color: white;
|
|
8
|
-
padding: 0;
|
|
9
|
-
|
|
10
|
-
.message {
|
|
11
|
-
font-weight: bold;
|
|
12
|
-
font-size: 14px;
|
|
13
|
-
text-align: center;
|
|
14
|
-
color: #af0000;
|
|
15
|
-
padding: 25px;
|
|
16
|
-
display: block;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.buttons-container {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: row-reverse;
|
|
22
|
-
align-items: flex-end;
|
|
23
|
-
padding: 5px;
|
|
24
|
-
border-top: 1px solid #efefef;
|
|
25
|
-
|
|
26
|
-
button {
|
|
27
|
-
border-color: #dcdcdc;
|
|
28
|
-
border-width: 1px 0 1px 1px;
|
|
29
|
-
background-color: white;
|
|
30
|
-
display: inline-block;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
color: #363636;
|
|
33
|
-
font-weight: bold;
|
|
34
|
-
padding: 6px 24px;
|
|
35
|
-
text-decoration: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
button:hover {
|
|
39
|
-
background: linear-gradient(to bottom, #f6f6f6 5%, #fff 100%);
|
|
40
|
-
background-color: #f6f6f6;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
button:first-of-type {
|
|
44
|
-
border-radius: 0 5px 5px 0;
|
|
45
|
-
border-width: 1px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
button:last-of-type {
|
|
49
|
-
border-radius: 5px 0 0 5px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
const defaultStyle = {
|
|
54
|
-
display: 'block',
|
|
55
|
-
borderRadius: '5px',
|
|
56
|
-
minWidth: '400px',
|
|
57
|
-
borderTop: '10px solid #ed0000',
|
|
58
|
-
};
|
|
59
|
-
function ConfirmationDialog({ style = {}, buttons = [], onClose, message, render, id, disableDefaultStyle = false, }) {
|
|
60
|
-
const optionsHandler = useCallback((e, { handler = () => null, preventClose = false }) => {
|
|
61
|
-
handler(e);
|
|
62
|
-
if (!preventClose) {
|
|
63
|
-
onClose();
|
|
64
|
-
}
|
|
65
|
-
}, [onClose]);
|
|
66
|
-
return (_jsx(DialogBody, { css: styles, children: _jsxs("div", { style: { ...(!disableDefaultStyle && defaultStyle), ...style }, "data-testid": id, children: [render ? (render({ message, className: 'message' })) : (_jsx("p", { className: "message", children: message })), _jsx("div", { className: "buttons-container", children: buttons.map((option) => (_jsx("button", { type: "button", onClick: (e) => optionsHandler(e, option), style: option.style && option.style, children: option.text }, option.text))) })] }) }));
|
|
67
|
-
}
|
|
68
|
-
export default ConfirmationDialog;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
-
interface ModalProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
open?: boolean;
|
|
5
|
-
onClose?: (element: any) => void;
|
|
6
|
-
style?: CSSProperties;
|
|
7
|
-
}
|
|
8
|
-
declare const Modal: ({ children, open, onClose, style, }: ModalProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export default Modal;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useCallback } from 'react';
|
|
3
|
-
const styles = {
|
|
4
|
-
outerContainer: {
|
|
5
|
-
position: 'fixed',
|
|
6
|
-
top: 0,
|
|
7
|
-
right: 0,
|
|
8
|
-
bottom: 0,
|
|
9
|
-
left: 0,
|
|
10
|
-
backgroundColor: 'rgba(255,255,255,0.8)',
|
|
11
|
-
display: 'flex',
|
|
12
|
-
justifyContent: 'center',
|
|
13
|
-
alignItems: 'center',
|
|
14
|
-
zIndex: 1,
|
|
15
|
-
},
|
|
16
|
-
innerContainer: {
|
|
17
|
-
boxSizing: 'initial',
|
|
18
|
-
backgroundColor: '#fff',
|
|
19
|
-
boxShadow: '0 0 0 0, 0 8px 16px rgba(0,0,0,.30)',
|
|
20
|
-
display: 'flex',
|
|
21
|
-
flexDirection: 'column',
|
|
22
|
-
minWidth: '300px',
|
|
23
|
-
minHeight: '140px',
|
|
24
|
-
justifyContent: 'space-between',
|
|
25
|
-
borderRadius: '5px',
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
const Modal = ({ children, open = false, onClose = () => null, style, }) => {
|
|
29
|
-
const handleClose = useCallback((e) => {
|
|
30
|
-
onClose(e);
|
|
31
|
-
}, [onClose]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!open) {
|
|
34
|
-
handleClose();
|
|
35
|
-
}
|
|
36
|
-
}, [handleClose, open]);
|
|
37
|
-
return (open && (_jsx("div", { style: styles.outerContainer, onClick: handleClose, children: _jsx("div", { style: { ...styles.innerContainer, ...style }, onClick: (e) => {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
e.stopPropagation();
|
|
40
|
-
}, children: children }) })));
|
|
41
|
-
};
|
|
42
|
-
export default Modal;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useEffect, cloneElement } from 'react';
|
|
3
|
-
import { useSize } from 'react-use';
|
|
4
|
-
const ModalContent = ({ modal, onClose, onLayout }) => {
|
|
5
|
-
const contentSize = useRef();
|
|
6
|
-
const [Content, { width, height }] = useSize(() => {
|
|
7
|
-
return (_jsx("div", { style: {
|
|
8
|
-
height: '100%',
|
|
9
|
-
display: 'block',
|
|
10
|
-
overflow: 'auto',
|
|
11
|
-
}, children: cloneElement(modal.component, {
|
|
12
|
-
...modal.options,
|
|
13
|
-
onClose,
|
|
14
|
-
style: { cursor: 'default' },
|
|
15
|
-
}) }));
|
|
16
|
-
});
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (Number.isFinite(height) &&
|
|
19
|
-
Number.isFinite(width) &&
|
|
20
|
-
!contentSize.current) {
|
|
21
|
-
contentSize.current = { width, height };
|
|
22
|
-
onLayout({ modal, layout: { width, height } });
|
|
23
|
-
}
|
|
24
|
-
}, [width, height, contentSize, onLayout, modal]);
|
|
25
|
-
return Content;
|
|
26
|
-
};
|
|
27
|
-
export default ModalContent;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
interface ProviderProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
style?: CSSProperties;
|
|
5
|
-
offset?: string;
|
|
6
|
-
position?: string;
|
|
7
|
-
transition?: string;
|
|
8
|
-
wrapperRef?: HTMLDivElement | null;
|
|
9
|
-
}
|
|
10
|
-
declare function Provider({ children, style, offset, position, transition, wrapperRef, }: ProviderProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default Provider;
|