nmrium 0.24.0 → 0.26.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/IntegralResizable.js +13 -13
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +30 -31
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +5 -5
- package/lib/component/1d/ranges/Range.js +24 -33
- package/lib/component/2d/zones/Signal.js +8 -8
- package/lib/component/2d/zones/Zone.js +3 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -1
- package/lib/component/NMRium.js +22 -29
- package/lib/component/assignment/AssignmentsContext.d.ts +35 -0
- package/lib/component/assignment/AssignmentsContext.js +83 -0
- package/lib/component/assignment/AssignmentsReducer.d.ts +32 -0
- package/lib/component/assignment/AssignmentsReducer.js +39 -0
- package/lib/component/assignment/actions/initAssignment.d.ts +5 -0
- package/lib/component/assignment/actions/initAssignment.js +62 -0
- package/lib/component/assignment/actions/removeAssignment.d.ts +16 -0
- package/lib/component/assignment/actions/removeAssignment.js +24 -0
- package/lib/component/assignment/actions/setActiveAssignment.d.ts +10 -0
- package/lib/component/assignment/actions/setActiveAssignment.js +8 -0
- package/lib/component/assignment/actions/toggleAssignment.d.ts +7 -0
- package/lib/component/assignment/actions/toggleAssignment.js +44 -0
- package/lib/component/assignment/index.d.ts +0 -18
- package/lib/component/assignment/index.js +12 -266
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.d.ts +2 -0
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.js +3 -0
- package/lib/component/context/GlobalContext.d.ts +12 -3
- package/lib/component/context/GlobalContext.js +1 -1
- package/lib/component/elements/ActionButtons.d.ts +10 -0
- package/lib/component/elements/ActionButtons.js +14 -0
- package/lib/component/elements/Button.d.ts +30 -5
- package/lib/component/elements/Button.js +151 -4
- package/lib/component/elements/ContextMenu.js +6 -6
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +5 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +38 -10
- package/lib/component/elements/ReactTable/ReactTable.d.ts +3 -1
- package/lib/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib/component/elements/ReactTable/Style.d.ts +1 -3
- package/lib/component/elements/ReactTable/Style.js +1 -7
- package/lib/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib/component/elements/resizer/DivResizer.d.ts +2 -0
- package/lib/component/elements/resizer/DivResizer.js +107 -0
- package/lib/component/elements/resizer/Resizer.d.ts +18 -0
- package/lib/component/elements/resizer/Resizer.js +12 -0
- package/lib/component/elements/resizer/SVGResizer.d.ts +2 -0
- package/lib/component/elements/resizer/SVGResizer.js +71 -0
- package/lib/component/elements/resizer/useDraggable.d.ts +19 -0
- package/lib/component/elements/resizer/useDraggable.js +52 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +4 -15
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib/component/header/RangesPickingOptionPanel.js +3 -16
- package/lib/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib/component/header/Zones2DOptionPanel.js +3 -14
- package/lib/component/hooks/useExport.js +11 -9
- package/lib/component/loader/DropZone.js +1 -0
- package/lib/component/modal/AlignSpectraModal.js +2 -1
- package/lib/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib/component/modal/LoadJCAMPModal.js +7 -6
- package/lib/component/modal/ModalStyle.js +4 -26
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -1
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib/component/modal/PredictSpectraModal.js +2 -7
- package/lib/component/modal/SaveAsModal.d.ts +1 -1
- package/lib/component/modal/SaveAsModal.js +2 -1
- package/lib/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib/component/modal/setting/GeneralSettings.js +3 -1
- package/lib/component/modal/setting/settingsValidation.d.ts +8 -0
- package/lib/component/modal/setting/settingsValidation.js +40 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +4 -3
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.d.ts +10 -0
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +60 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +11 -5
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +20 -11
- package/lib/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +12 -11
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +16 -9
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -3
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +5 -18
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +5 -7
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +5 -9
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +20 -20
- package/lib/component/panels/header/SpectraAutomaticPickingButton.d.ts +2 -0
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +30 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib/component/reducer/Reducer.d.ts +2 -0
- package/lib/component/reducer/Reducer.js +4 -1
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +9 -0
- package/lib/component/reducer/actions/AssignmentsActions.js +18 -0
- package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
- package/lib/component/reducer/actions/LoadActions.js +10 -5
- package/lib/component/reducer/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +16 -16
- package/lib/component/reducer/types/Types.d.ts +1 -0
- package/lib/component/reducer/types/Types.js +1 -0
- package/lib/component/utility/Export.d.ts +3 -3
- package/lib/component/utility/Export.js +10 -9
- package/lib/component/utility/FormatNumber.js +1 -1
- package/lib/component/workspaces/Workspace.d.ts +2 -4
- package/lib/component/workspaces/basic.js +8 -9
- package/lib/data/SpectraManager.js +23 -15
- package/lib/data/data1d/Data1DManager.d.ts +1 -1
- package/lib/data/data1d/Data1DManager.js +2 -1
- package/lib/data/data1d/Spectrum1D/toJSON.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib/data/data1d/database.d.ts +1 -2
- package/lib/data/data1d/database.js +1 -1
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +1 -4
- package/lib/data/data2d/Data2DManager.d.ts +1 -1
- package/lib/data/data2d/Data2DManager.js +2 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/data2d/Spectrum2D/toJSON.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/IntegralResizable.js +12 -12
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +29 -30
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +6 -6
- package/lib-cjs/component/1d/ranges/Range.js +26 -35
- package/lib-cjs/component/2d/zones/Signal.js +9 -9
- package/lib-cjs/component/2d/zones/Zone.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +2 -2
- package/lib-cjs/component/NMRium.js +22 -29
- package/lib-cjs/component/assignment/AssignmentsContext.js +88 -0
- package/lib-cjs/component/assignment/AssignmentsReducer.js +45 -0
- package/lib-cjs/component/assignment/actions/initAssignment.js +65 -0
- package/lib-cjs/component/assignment/actions/removeAssignment.js +29 -0
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +11 -0
- package/lib-cjs/component/assignment/actions/toggleAssignment.js +47 -0
- package/lib-cjs/component/assignment/index.js +15 -269
- package/lib-cjs/component/assignment/utilities/filterForIDsWithAssignment.js +7 -0
- package/lib-cjs/component/context/GlobalContext.js +1 -1
- package/lib-cjs/component/elements/ActionButtons.js +20 -0
- package/lib-cjs/component/elements/Button.js +150 -4
- package/lib-cjs/component/elements/ContextMenu.js +6 -6
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +42 -14
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib-cjs/component/elements/ReactTable/Style.js +1 -9
- package/lib-cjs/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib-cjs/component/elements/resizer/DivResizer.js +113 -0
- package/lib-cjs/component/elements/resizer/Resizer.js +18 -0
- package/lib-cjs/component/elements/resizer/SVGResizer.js +77 -0
- package/lib-cjs/component/elements/resizer/useDraggable.js +55 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +3 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +2 -15
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib-cjs/component/header/Zones2DOptionPanel.js +2 -13
- package/lib-cjs/component/hooks/useExport.js +11 -9
- package/lib-cjs/component/loader/DropZone.js +1 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +2 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib-cjs/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib-cjs/component/modal/LoadJCAMPModal.js +7 -6
- package/lib-cjs/component/modal/ModalStyle.js +4 -26
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +5 -1
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +2 -7
- package/lib-cjs/component/modal/SaveAsModal.js +2 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib-cjs/component/modal/setting/GeneralSettings.js +3 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +66 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +67 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +12 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +15 -14
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -16
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +21 -21
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +37 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib-cjs/component/reducer/Reducer.js +4 -1
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +21 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +9 -4
- package/lib-cjs/component/reducer/preferencesReducer.js +16 -16
- package/lib-cjs/component/reducer/types/Types.js +2 -1
- package/lib-cjs/component/utility/Export.js +10 -9
- package/lib-cjs/component/utility/FormatNumber.js +1 -1
- package/lib-cjs/component/workspaces/basic.js +8 -9
- package/lib-cjs/data/SpectraManager.js +23 -15
- package/lib-cjs/data/data1d/Data1DManager.js +2 -1
- package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib-cjs/data/data2d/Data2DManager.js +2 -1
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +25 -26
- package/lib/component/1d/Resizable.d.ts +0 -12
- package/lib/component/1d/Resizable.js +0 -105
- package/lib-cjs/component/1d/Resizable.js +0 -110
|
@@ -1,8 +1,154 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
4
|
+
/** @jsxImportSource @emotion/react */
|
|
5
|
+
const react_1 = require("@emotion/react");
|
|
6
|
+
const colorPalettes = {
|
|
7
|
+
success: {
|
|
8
|
+
base: '#2dd36f',
|
|
9
|
+
shade: '#28ba62',
|
|
10
|
+
tint: '#42d77d',
|
|
11
|
+
},
|
|
12
|
+
danger: {
|
|
13
|
+
base: '#eb445a',
|
|
14
|
+
shade: '#cf3c4f',
|
|
15
|
+
tint: '#ed576b',
|
|
16
|
+
},
|
|
17
|
+
warning: {
|
|
18
|
+
base: '#ffc409',
|
|
19
|
+
shade: '#e0ac08',
|
|
20
|
+
tint: '#ffca22',
|
|
21
|
+
},
|
|
22
|
+
medium: {
|
|
23
|
+
base: '#92949c',
|
|
24
|
+
shade: '#808289',
|
|
25
|
+
tint: '#9d9fa6',
|
|
26
|
+
},
|
|
27
|
+
light: {
|
|
28
|
+
base: '#f4f5f8',
|
|
29
|
+
shade: '#d7d8da',
|
|
30
|
+
tint: '#f5f6f9',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const sizeConfig = {
|
|
34
|
+
xSmall: {
|
|
35
|
+
fontSize: '0.75rem',
|
|
36
|
+
padding: '0.15rem 0.3rem',
|
|
37
|
+
borderRadius: '0.15rem',
|
|
38
|
+
},
|
|
39
|
+
small: {
|
|
40
|
+
fontSize: '0.8rem',
|
|
41
|
+
padding: '0.25rem 0.5rem',
|
|
42
|
+
borderRadius: '0.2rem',
|
|
43
|
+
},
|
|
44
|
+
medium: {
|
|
45
|
+
fontSize: '1rem',
|
|
46
|
+
padding: '0.375rem 0.75rem',
|
|
47
|
+
borderRadius: '0.25rem',
|
|
48
|
+
},
|
|
49
|
+
large: {
|
|
50
|
+
fontSize: '1.25rem',
|
|
51
|
+
padding: '0.5rem 1rem',
|
|
52
|
+
borderRadius: '0.3rem',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
function getFillStyle(props) {
|
|
56
|
+
const { borderColor, fill, backgroundColor, color } = props;
|
|
57
|
+
switch (fill) {
|
|
58
|
+
case 'solid': {
|
|
59
|
+
return (0, react_1.css) `
|
|
60
|
+
border-color: transparent;
|
|
61
|
+
background-color: ${backgroundColor.base};
|
|
62
|
+
color: ${color.hover};
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
case 'outline': {
|
|
66
|
+
return (0, react_1.css) `
|
|
67
|
+
border-style: solid;
|
|
68
|
+
border-color: ${backgroundColor.base};
|
|
69
|
+
background-color: transparent;
|
|
70
|
+
color: ${color.base};
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
case 'clear': {
|
|
74
|
+
return (0, react_1.css) `
|
|
75
|
+
border-color: transparent;
|
|
76
|
+
background-color: transparent;
|
|
77
|
+
color: ${color.base};
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
default:
|
|
81
|
+
return (0, react_1.css) `
|
|
82
|
+
background-color: ${backgroundColor.base};
|
|
83
|
+
color: ${color.base};
|
|
84
|
+
border-color: ${borderColor};
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
7
87
|
}
|
|
88
|
+
const styles = {
|
|
89
|
+
button: (props) => {
|
|
90
|
+
const { size, backgroundColor, color, borderRadius } = props;
|
|
91
|
+
const basic = (0, react_1.css) `
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
border-width: 1px;
|
|
95
|
+
align-items: center;
|
|
96
|
+
`;
|
|
97
|
+
const fillStyle = getFillStyle(props);
|
|
98
|
+
const colorStyle = (0, react_1.css) `
|
|
99
|
+
&:not([disabled]):hover {
|
|
100
|
+
background-color: ${backgroundColor.hover};
|
|
101
|
+
color: ${color.hover};
|
|
102
|
+
}
|
|
103
|
+
&:not([disabled]):active {
|
|
104
|
+
background-color: ${backgroundColor?.active || backgroundColor.hover};
|
|
105
|
+
color: ${color?.active || color.hover};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&:disabled {
|
|
109
|
+
opacity: 0.25;
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
return (0, react_1.css)([
|
|
113
|
+
basic,
|
|
114
|
+
sizeConfig[size],
|
|
115
|
+
fillStyle,
|
|
116
|
+
colorStyle,
|
|
117
|
+
{ borderRadius },
|
|
118
|
+
]);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
const Button = (props) => {
|
|
122
|
+
const { onClick, size = 'small', color = { base: 'black', hover: 'white' }, backgroundColor = { base: 'white', hover: 'black', active: 'black' }, borderColor = 'transparent', fill, borderRadius, style = {}, ...restProps } = props;
|
|
123
|
+
return ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClick, css: [
|
|
124
|
+
styles.button({
|
|
125
|
+
size,
|
|
126
|
+
backgroundColor,
|
|
127
|
+
color,
|
|
128
|
+
borderColor,
|
|
129
|
+
fill,
|
|
130
|
+
borderRadius,
|
|
131
|
+
}),
|
|
132
|
+
style,
|
|
133
|
+
], ...restProps, children: (0, jsx_runtime_1.jsxs)("span", { style: { flex: 1 }, children: [" ", props.children] }) }));
|
|
134
|
+
};
|
|
135
|
+
function ThemeButton(props) {
|
|
136
|
+
const { colorTheme, ...buttonProps } = props;
|
|
137
|
+
const { base, shade, tint } = colorPalettes[props.colorTheme];
|
|
138
|
+
const { color = { base: shade, hover: 'white' }, backgroundColor = {
|
|
139
|
+
base: base,
|
|
140
|
+
hover: shade,
|
|
141
|
+
active: tint,
|
|
142
|
+
}, fill = 'solid', ...restProps } = buttonProps;
|
|
143
|
+
return (0, jsx_runtime_1.jsx)(Button, { ...{ fill, ...restProps, backgroundColor, color } });
|
|
144
|
+
}
|
|
145
|
+
Button.Done = (props) => {
|
|
146
|
+
return (0, jsx_runtime_1.jsx)(ThemeButton, { ...props, colorTheme: "success" });
|
|
147
|
+
};
|
|
148
|
+
Button.Danger = (props) => {
|
|
149
|
+
return (0, jsx_runtime_1.jsx)(ThemeButton, { ...props, colorTheme: "danger" });
|
|
150
|
+
};
|
|
151
|
+
Button.Action = (props) => {
|
|
152
|
+
return (0, jsx_runtime_1.jsx)(ThemeButton, { ...props, colorTheme: "medium" });
|
|
153
|
+
};
|
|
8
154
|
exports.default = Button;
|
|
@@ -49,22 +49,22 @@ function ContextMenu({ context }, ref) {
|
|
|
49
49
|
left: 0,
|
|
50
50
|
top: 0,
|
|
51
51
|
});
|
|
52
|
-
const { rootRef,
|
|
52
|
+
const { rootRef, elementsWrapperRef } = (0, GlobalContext_1.useGlobal)();
|
|
53
53
|
const [data, setData] = (0, react_2.useState)();
|
|
54
54
|
const [isVisible, show] = (0, react_2.useState)();
|
|
55
55
|
const [sourceElement, setSourceElement] = (0, react_2.useState)(null);
|
|
56
56
|
const root = (0, react_2.useRef)();
|
|
57
57
|
(0, react_2.useEffect)(() => {
|
|
58
58
|
root.current = document.createElement('div');
|
|
59
|
-
if (
|
|
60
|
-
|
|
59
|
+
if (elementsWrapperRef) {
|
|
60
|
+
elementsWrapperRef.appendChild(root.current);
|
|
61
61
|
}
|
|
62
62
|
return () => {
|
|
63
|
-
if (root.current &&
|
|
64
|
-
|
|
63
|
+
if (root.current && elementsWrapperRef) {
|
|
64
|
+
elementsWrapperRef.removeChild(root.current);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
}, [
|
|
67
|
+
}, [elementsWrapperRef]);
|
|
68
68
|
const contextMenuHandler = (event) => {
|
|
69
69
|
event.preventDefault();
|
|
70
70
|
setSourceElement(event.target.parentElement);
|
|
@@ -2,9 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
4
4
|
/** @jsxImportSource @emotion/react */
|
|
5
|
-
const react_1 = require("react");
|
|
5
|
+
const react_1 = require("@emotion/react");
|
|
6
|
+
const react_2 = require("react");
|
|
6
7
|
const index_1 = require("../../../highlight/index");
|
|
7
|
-
|
|
8
|
+
function highlightStyle(isActive, row) {
|
|
9
|
+
if (isActive) {
|
|
10
|
+
return { backgroundColor: '#ff6f0057' };
|
|
11
|
+
}
|
|
12
|
+
else if (row.original?.isConstantlyHighlighted === true) {
|
|
13
|
+
return { backgroundColor: '#f5f5dc' };
|
|
14
|
+
}
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
const rowCss = (0, react_1.css) `
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: #ff6f0091 !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:active {
|
|
23
|
+
background-color: #ff6f0070 !important;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
8
26
|
function getIDs(row) {
|
|
9
27
|
const id = row.original.id;
|
|
10
28
|
if (id) {
|
|
@@ -18,24 +36,26 @@ function getIDs(row) {
|
|
|
18
36
|
return [''];
|
|
19
37
|
}
|
|
20
38
|
function ReactTableRow(props, ref) {
|
|
21
|
-
const { row, highlightedSource = index_1.HighlightedSource.UNKNOWN, onContextMenu, } = props;
|
|
22
|
-
const data = (0,
|
|
39
|
+
const { row, highlightedSource = index_1.HighlightedSource.UNKNOWN, onContextMenu, onClick, isRowActive = false, } = props;
|
|
40
|
+
const data = (0, react_2.useMemo)(() => ({
|
|
23
41
|
type: highlightedSource,
|
|
24
42
|
extra: row.original,
|
|
25
43
|
}), [highlightedSource, row]);
|
|
26
44
|
const highlight = (0, index_1.useHighlight)(getIDs(row), data);
|
|
27
|
-
(0,
|
|
45
|
+
(0, react_2.useEffect)(() => {
|
|
28
46
|
return () => {
|
|
29
47
|
highlight.hide();
|
|
30
48
|
};
|
|
31
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
50
|
}, []);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
const clickHandler = (0, react_2.useCallback)((event) => {
|
|
52
|
+
onClick?.(event, row);
|
|
53
|
+
}, [onClick, row]);
|
|
54
|
+
return (0, react_2.useMemo)(() => {
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)("tr", { ref: ref, onContextMenu: onContextMenu, css: [
|
|
56
|
+
highlightStyle(highlight.isActive || isRowActive, row),
|
|
57
|
+
onClick && rowCss,
|
|
58
|
+
], ...row.getRowProps(), ...highlight.onHover, children: row.cells.map((cell) => {
|
|
39
59
|
const { style, padding } = cell.column;
|
|
40
60
|
if (cell.isRowSpanned) {
|
|
41
61
|
return null;
|
|
@@ -44,9 +64,17 @@ function ReactTableRow(props, ref) {
|
|
|
44
64
|
return ((0, jsx_runtime_1.jsx)("td", { rowSpan: cell.rowSpan, ...cell.getCellProps(), onContextMenu: (e) => {
|
|
45
65
|
e.preventDefault();
|
|
46
66
|
return false;
|
|
47
|
-
}, style: { padding, ...style }, children: cell.render('Cell') }, cell.key));
|
|
67
|
+
}, style: { padding, ...style }, onClick: clickHandler, children: cell.render('Cell') }, cell.key));
|
|
48
68
|
}
|
|
49
69
|
}) }, row.getRowProps().key));
|
|
50
|
-
}, [
|
|
70
|
+
}, [
|
|
71
|
+
clickHandler,
|
|
72
|
+
highlight.isActive,
|
|
73
|
+
highlight.onHover,
|
|
74
|
+
onClick,
|
|
75
|
+
onContextMenu,
|
|
76
|
+
ref,
|
|
77
|
+
row,
|
|
78
|
+
]);
|
|
51
79
|
}
|
|
52
|
-
exports.default = (0,
|
|
80
|
+
exports.default = (0, react_2.forwardRef)(ReactTableRow);
|
|
@@ -47,9 +47,10 @@ const styles = {
|
|
|
47
47
|
},
|
|
48
48
|
};
|
|
49
49
|
const ReactTableInner = (0, react_1.forwardRef)(function ReactTableInner(props, ref) {
|
|
50
|
-
const { data, columns, highlightedSource, context = null, onScroll, approxItemHeight = 40, enableVirtualScroll = false, groupKey, } = props;
|
|
50
|
+
const { data, columns, highlightedSource, context = null, onScroll, approxItemHeight = 40, enableVirtualScroll = false, groupKey, onClick, highlightActiveRow = false, } = props;
|
|
51
51
|
const contextRef = (0, react_1.useRef)(null);
|
|
52
52
|
const { index: indexBoundary } = (0, ReactTableContext_1.useReactTableContext)();
|
|
53
|
+
const [rowIndex, setRowIndex] = (0, react_1.useState)();
|
|
53
54
|
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, rowSpanHeaders, } = (0, react_table_1.useTable)({
|
|
54
55
|
columns,
|
|
55
56
|
data,
|
|
@@ -63,6 +64,10 @@ const ReactTableInner = (0, react_1.forwardRef)(function ReactTableInner(props,
|
|
|
63
64
|
const rowsData = enableVirtualScroll
|
|
64
65
|
? rows.slice(indexBoundary.start, indexBoundary.end)
|
|
65
66
|
: rows;
|
|
67
|
+
const clickHandler = (0, react_1.useCallback)((event, row) => {
|
|
68
|
+
setRowIndex(row.index);
|
|
69
|
+
onClick?.(event, row);
|
|
70
|
+
}, [onClick]);
|
|
66
71
|
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: "table-container", style: {
|
|
67
72
|
overflowY: 'auto',
|
|
68
73
|
position: 'relative',
|
|
@@ -75,7 +80,7 @@ const ReactTableInner = (0, react_1.forwardRef)(function ReactTableInner(props,
|
|
|
75
80
|
} })), (0, jsx_runtime_1.jsxs)("table", { ...getTableProps(), css: Style_1.ReactTableStyle, style: styles.table(enableVirtualScroll), children: [(0, jsx_runtime_1.jsx)(ReactTableHeader_1.default, { headerGroups: headerGroups }), (0, jsx_runtime_1.jsx)("tbody", { ...getTableBodyProps(), children: rowsData.map((row, index) => {
|
|
76
81
|
prepareRow(row);
|
|
77
82
|
(0, useRowSpan_1.prepareRowSpan)(rows, enableVirtualScroll ? index + indexBoundary.start : index, rowSpanHeaders, groupKey);
|
|
78
|
-
return ((0, jsx_runtime_1.jsx)(ReactTableRow_1.default, { row: row, ...row.getRowProps(), onContextMenu: (e) => contextMenuHandler(e, row), highlightedSource: highlightedSource }, row.key));
|
|
83
|
+
return ((0, jsx_runtime_1.jsx)(ReactTableRow_1.default, { row: row, ...row.getRowProps(), onContextMenu: (e) => contextMenuHandler(e, row), onClick: highlightActiveRow ? clickHandler : onClick, highlightedSource: highlightedSource, isRowActive: rowIndex === index }, row.key));
|
|
79
84
|
}) })] }), (0, jsx_runtime_1.jsx)(ContextMenu_1.default, { ref: contextRef, context: context })] }));
|
|
80
85
|
});
|
|
81
86
|
function ReactTable(props) {
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ReactTableStyle = void 0;
|
|
4
4
|
const react_1 = require("@emotion/react");
|
|
5
|
-
const HighlightedRowStyle = (0, react_1.css) `
|
|
6
|
-
background-color: #ff6f0057;
|
|
7
|
-
`;
|
|
8
|
-
exports.HighlightedRowStyle = HighlightedRowStyle;
|
|
9
|
-
const ConstantlyHighlightedRowStyle = (0, react_1.css) `
|
|
10
|
-
background-color: #f5f5dc;
|
|
11
|
-
`;
|
|
12
|
-
exports.ConstantlyHighlightedRowStyle = ConstantlyHighlightedRowStyle;
|
|
13
5
|
const ReactTableStyle = (0, react_1.css) `
|
|
14
6
|
border-spacing: 0;
|
|
15
7
|
border: 1px solid #dedede;
|
|
@@ -25,7 +25,7 @@ function ToolTip({ style = { popup: {}, mainContainer: {} }, className = '', pop
|
|
|
25
25
|
const refContent = (0, react_1.useRef)(null);
|
|
26
26
|
const [placement, setPlacement] = (0, react_1.useState)({ x: 0, y: 0 });
|
|
27
27
|
const [show, showToolTip] = (0, react_1.useState)(false);
|
|
28
|
-
const {
|
|
28
|
+
const { elementsWrapperRef } = (0, GlobalContext_1.useGlobal)();
|
|
29
29
|
(0, react_1.useLayoutEffect)(() => {
|
|
30
30
|
const getPopupPlacement = () => {
|
|
31
31
|
let x;
|
|
@@ -92,11 +92,12 @@ function ToolTip({ style = { popup: {}, mainContainer: {} }, className = '', pop
|
|
|
92
92
|
alignItems: 'center',
|
|
93
93
|
...style.mainContainer,
|
|
94
94
|
}, ref: refChild, onMouseOver: mouseOverHandler, onMouseOut: mouseLeaveHandler, children: children }), show &&
|
|
95
|
+
elementsWrapperRef &&
|
|
95
96
|
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { ref: refContent, style: {
|
|
96
97
|
...styles.popup,
|
|
97
98
|
transform: `translate(${placement.x + offset.x}px,${placement.y + offset.y}px)`,
|
|
98
99
|
zIndex: 999999999,
|
|
99
100
|
...style.popup,
|
|
100
|
-
}, className: className, children: (0, jsx_runtime_1.jsx)("span", { style: { pointerEvents: 'none' }, children: title }) }),
|
|
101
|
+
}, className: className, children: (0, jsx_runtime_1.jsx)("span", { style: { pointerEvents: 'none' }, children: title }) }), elementsWrapperRef)] }));
|
|
101
102
|
}
|
|
102
103
|
exports.default = (0, react_1.memo)(ToolTip);
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource @emotion/react */
|
|
8
|
+
const react_1 = require("@emotion/react");
|
|
9
|
+
const react_2 = require("react");
|
|
10
|
+
const useDraggable_1 = __importDefault(require("./useDraggable"));
|
|
11
|
+
const anchorStyle = {
|
|
12
|
+
marginLeft: '5px',
|
|
13
|
+
width: '2px',
|
|
14
|
+
height: '100%',
|
|
15
|
+
pointerEvents: 'none',
|
|
16
|
+
position: 'relative',
|
|
17
|
+
};
|
|
18
|
+
const styles = {
|
|
19
|
+
container: (position) => (0, react_1.css) `
|
|
20
|
+
position: absolute;
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 10px;
|
|
23
|
+
left: -5px;
|
|
24
|
+
cursor: e-resize;
|
|
25
|
+
transform: translateX(${position}px);
|
|
26
|
+
user-select: none;
|
|
27
|
+
z-index: 99999999;
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
div {
|
|
31
|
+
background-color: red;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`,
|
|
35
|
+
content: (anchorSide, left, right) => {
|
|
36
|
+
const width = right.previousPosition - left.previousPosition;
|
|
37
|
+
const baseCss = (0, react_1.css) `
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: ${width}px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
`;
|
|
42
|
+
if (right.position.action === 'move' || left.position.action === 'move') {
|
|
43
|
+
const scale = (right.position.x - left.position.x) / width;
|
|
44
|
+
if (anchorSide === 'RIGHT') {
|
|
45
|
+
return [
|
|
46
|
+
baseCss,
|
|
47
|
+
(0, react_1.css) `
|
|
48
|
+
transform: translateX(${left.position.x}px) scaleX(${scale});
|
|
49
|
+
transform-origin: left center;
|
|
50
|
+
`,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
else if (anchorSide === 'LEFT') {
|
|
54
|
+
return (0, react_1.css)([
|
|
55
|
+
baseCss,
|
|
56
|
+
(0, react_1.css) `
|
|
57
|
+
transform: translateX(${left.position.x}px) scaleX(${scale});
|
|
58
|
+
transform-origin: left center;
|
|
59
|
+
`,
|
|
60
|
+
]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return (0, react_1.css)([
|
|
65
|
+
baseCss,
|
|
66
|
+
(0, react_1.css) `
|
|
67
|
+
transform: translateX(${left.position.x}px);
|
|
68
|
+
`,
|
|
69
|
+
]);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
function DivResizer(props) {
|
|
74
|
+
const { children, initialPosition = { x1: 10, x2: 40 }, onStart, onMove, onEnd, } = props;
|
|
75
|
+
const right = (0, useDraggable_1.default)({
|
|
76
|
+
x: initialPosition.x2,
|
|
77
|
+
anchor: 'RIGHT',
|
|
78
|
+
});
|
|
79
|
+
const left = (0, useDraggable_1.default)({
|
|
80
|
+
x: initialPosition.x1,
|
|
81
|
+
anchor: 'LEFT',
|
|
82
|
+
});
|
|
83
|
+
const anchor = left.isActive
|
|
84
|
+
? left.anchor
|
|
85
|
+
: right.isActive
|
|
86
|
+
? right.anchor
|
|
87
|
+
: '';
|
|
88
|
+
(0, react_2.useEffect)(() => {
|
|
89
|
+
const position = { x1: left.position.x, x2: right.position.x };
|
|
90
|
+
const status = left.isActive
|
|
91
|
+
? left.position.action
|
|
92
|
+
: right.isActive
|
|
93
|
+
? right.position.action
|
|
94
|
+
: '';
|
|
95
|
+
switch (status) {
|
|
96
|
+
case 'start':
|
|
97
|
+
onStart?.(position);
|
|
98
|
+
break;
|
|
99
|
+
case 'move':
|
|
100
|
+
onMove?.(position);
|
|
101
|
+
break;
|
|
102
|
+
case 'end':
|
|
103
|
+
onEnd?.(position);
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}, [left, onEnd, onMove, onStart, right]);
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { "data-no-export": "true", onMouseDown: right.onMouseDown, css: styles.container(right.position.x), children: (0, jsx_runtime_1.jsx)("div", { style: anchorStyle }) }), (0, jsx_runtime_1.jsx)("div", { css: styles.content(anchor, left, right), children: typeof children === 'function'
|
|
110
|
+
? children?.(left.position.x, right.position.x)
|
|
111
|
+
: children }), (0, jsx_runtime_1.jsx)("div", { "data-no-export": "true", onMouseDown: left.onMouseDown, css: styles.container(left.position.x), children: (0, jsx_runtime_1.jsx)("div", { style: anchorStyle }) })] }));
|
|
112
|
+
}
|
|
113
|
+
exports.default = DivResizer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const DivResizer_1 = __importDefault(require("./DivResizer"));
|
|
8
|
+
const SVGResizer_1 = __importDefault(require("./SVGResizer"));
|
|
9
|
+
function Resizer(props) {
|
|
10
|
+
const { tag = 'div', ...resProps } = props;
|
|
11
|
+
if (tag === 'div') {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(DivResizer_1.default, { ...resProps });
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return (0, jsx_runtime_1.jsx)(SVGResizer_1.default, { ...resProps });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = Resizer;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
|
+
/** @jsxImportSource @emotion/react */
|
|
8
|
+
const react_1 = require("@emotion/react");
|
|
9
|
+
const react_2 = require("react");
|
|
10
|
+
const useDraggable_1 = __importDefault(require("./useDraggable"));
|
|
11
|
+
const anchorStyle = {
|
|
12
|
+
width: '2px',
|
|
13
|
+
height: '100%',
|
|
14
|
+
pointerEvents: 'none',
|
|
15
|
+
fill: 'transparent',
|
|
16
|
+
};
|
|
17
|
+
const styles = {
|
|
18
|
+
container: (position) => (0, react_1.css) `
|
|
19
|
+
transform: translateX(${position}px);
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
rect:last-child {
|
|
23
|
+
fill: red !important;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
innerContainer: (0, react_1.css) `
|
|
28
|
+
position: absolute;
|
|
29
|
+
height: 100%;
|
|
30
|
+
fill: transparent;
|
|
31
|
+
width: 10px;
|
|
32
|
+
cursor: e-resize;
|
|
33
|
+
user-select: none;
|
|
34
|
+
z-index: 99999999;
|
|
35
|
+
`,
|
|
36
|
+
};
|
|
37
|
+
function SVGResizer(props) {
|
|
38
|
+
const { children, initialPosition = { x1: 10, x2: 40 }, onStart, onMove, onEnd, } = props;
|
|
39
|
+
const right = (0, useDraggable_1.default)({
|
|
40
|
+
x: initialPosition.x2,
|
|
41
|
+
anchor: 'RIGHT',
|
|
42
|
+
});
|
|
43
|
+
const left = (0, useDraggable_1.default)({
|
|
44
|
+
x: initialPosition.x1,
|
|
45
|
+
anchor: 'LEFT',
|
|
46
|
+
});
|
|
47
|
+
(0, react_2.useEffect)(() => {
|
|
48
|
+
const position = { x1: left.position.x, x2: right.position.x };
|
|
49
|
+
const status = left.isActive
|
|
50
|
+
? left.position.action
|
|
51
|
+
: right.isActive
|
|
52
|
+
? right.position.action
|
|
53
|
+
: '';
|
|
54
|
+
switch (status) {
|
|
55
|
+
case 'start':
|
|
56
|
+
onStart?.(position);
|
|
57
|
+
break;
|
|
58
|
+
case 'move':
|
|
59
|
+
onMove?.(position);
|
|
60
|
+
break;
|
|
61
|
+
case 'end':
|
|
62
|
+
onEnd?.(position);
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}, [left, onEnd, onMove, onStart, right]);
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)("g", { style: {
|
|
69
|
+
transform: `translateX(${left.position.x}px)`,
|
|
70
|
+
}, children: [typeof children === 'function'
|
|
71
|
+
? children(left.position.x, right.position.x)
|
|
72
|
+
: children, (0, jsx_runtime_1.jsx)(SVGResizerHandle, { onMouseDown: left.onMouseDown, position: 0 }), (0, jsx_runtime_1.jsx)(SVGResizerHandle, { onMouseDown: right.onMouseDown, position: right.position.x - left.position.x })] }));
|
|
73
|
+
}
|
|
74
|
+
exports.default = SVGResizer;
|
|
75
|
+
function SVGResizerHandle(props) {
|
|
76
|
+
return ((0, jsx_runtime_1.jsxs)("g", { onMouseDown: props.onMouseDown, css: styles.container(props.position), "data-no-export": "true", children: [(0, jsx_runtime_1.jsx)("rect", { x: "-5px", css: styles.innerContainer }), (0, jsx_runtime_1.jsx)("rect", { x: "-2.5px", style: anchorStyle })] }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
function useDraggable(props) {
|
|
5
|
+
const { x, anchor } = props;
|
|
6
|
+
const isActive = (0, react_1.useRef)(false);
|
|
7
|
+
const positionRef = (0, react_1.useRef)({
|
|
8
|
+
relativeX: x,
|
|
9
|
+
x,
|
|
10
|
+
});
|
|
11
|
+
const [position, setPosition] = (0, react_1.useState)({
|
|
12
|
+
x,
|
|
13
|
+
action: null,
|
|
14
|
+
});
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
16
|
+
positionRef.current = { relativeX: x, x };
|
|
17
|
+
setPosition({ x, action: null });
|
|
18
|
+
}, [x]);
|
|
19
|
+
const onMouseDown = (0, react_1.useCallback)((e) => {
|
|
20
|
+
setPosition({ x: positionRef.current.x, action: 'start' });
|
|
21
|
+
positionRef.current.relativeX = e.clientX - positionRef.current.relativeX;
|
|
22
|
+
isActive.current = true;
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
function onMouseUp(e) {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
if (isActive.current) {
|
|
27
|
+
const x = e.clientX - positionRef.current.relativeX;
|
|
28
|
+
positionRef.current = { relativeX: x, x };
|
|
29
|
+
setPosition({ x, action: 'end' });
|
|
30
|
+
isActive.current = false;
|
|
31
|
+
}
|
|
32
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
33
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
34
|
+
}
|
|
35
|
+
function onMouseMove(e) {
|
|
36
|
+
e.stopPropagation();
|
|
37
|
+
if (isActive.current) {
|
|
38
|
+
setPosition({
|
|
39
|
+
x: e.clientX - positionRef.current.relativeX,
|
|
40
|
+
action: 'move',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
45
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
46
|
+
}, []);
|
|
47
|
+
return {
|
|
48
|
+
onMouseDown,
|
|
49
|
+
position,
|
|
50
|
+
previousPosition: positionRef.current.x,
|
|
51
|
+
isActive: isActive.current,
|
|
52
|
+
anchor,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
exports.default = useDraggable;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
9
|
+
const Button_1 = __importDefault(require("../elements/Button"));
|
|
9
10
|
const CheckBox_1 = __importDefault(require("../elements/CheckBox"));
|
|
10
11
|
const NumberInput_1 = __importDefault(require("../elements/NumberInput"));
|
|
11
12
|
const Types_1 = require("../reducer/types/Types");
|
|
@@ -14,6 +15,7 @@ const styles = {
|
|
|
14
15
|
height: '100%',
|
|
15
16
|
display: 'flex',
|
|
16
17
|
fontSize: '12px',
|
|
18
|
+
alignItems: 'center',
|
|
17
19
|
},
|
|
18
20
|
input: {
|
|
19
21
|
width: '50px',
|
|
@@ -24,14 +26,6 @@ const styles = {
|
|
|
24
26
|
label: {
|
|
25
27
|
flex: '5',
|
|
26
28
|
},
|
|
27
|
-
actionButton: {
|
|
28
|
-
height: '100%',
|
|
29
|
-
width: '60px',
|
|
30
|
-
borderRadius: '5px',
|
|
31
|
-
border: '0.55px solid #c7c7c7',
|
|
32
|
-
margin: '0px 5px',
|
|
33
|
-
userSelect: 'none',
|
|
34
|
-
},
|
|
35
29
|
};
|
|
36
30
|
function AutoPeakPickingOptionPanel() {
|
|
37
31
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
@@ -50,11 +44,6 @@ function AutoPeakPickingOptionPanel() {
|
|
|
50
44
|
},
|
|
51
45
|
});
|
|
52
46
|
}, [dispatch]);
|
|
53
|
-
const handleCancelFilter = (0, react_1.useCallback)(() => {
|
|
54
|
-
dispatch({
|
|
55
|
-
type: Types_1.RESET_SELECTED_TOOL,
|
|
56
|
-
});
|
|
57
|
-
}, [dispatch]);
|
|
58
47
|
return ((0, jsx_runtime_1.jsxs)("div", { style: styles.container, children: [(0, jsx_runtime_1.jsx)(NumberInput_1.default, { ref: maxNumberOfPeaksRef, label: "Max Number Of Peaks:", name: "maxNumberOfPeaks", style: {
|
|
59
48
|
input: styles.input,
|
|
60
49
|
inputContainer: styles.inputContainer,
|
|
@@ -67,6 +56,6 @@ function AutoPeakPickingOptionPanel() {
|
|
|
67
56
|
input: styles.input,
|
|
68
57
|
inputContainer: styles.inputContainer,
|
|
69
58
|
label: styles.label,
|
|
70
|
-
}, defaultValue: 0.1, step: "0.01" }), (0, jsx_runtime_1.jsxs)("div", { style: { justifyItems: 'baseline', marginRight: '3px' }, children: [(0, jsx_runtime_1.jsx)("label", { style: { marginRight: '2px', lineHeight: 2, userSelect: 'none' }, htmlFor: "lookNegative", children: "Detect Negative:" }), (0, jsx_runtime_1.jsx)(CheckBox_1.default, { name: "lookNegative", ref: lookNegativeRef })] }), (0, jsx_runtime_1.jsx)(
|
|
59
|
+
}, defaultValue: 0.1, step: "0.01" }), (0, jsx_runtime_1.jsxs)("div", { style: { justifyItems: 'baseline', marginRight: '3px' }, children: [(0, jsx_runtime_1.jsx)("label", { style: { marginRight: '2px', lineHeight: 2, userSelect: 'none' }, htmlFor: "lookNegative", children: "Detect Negative:" }), (0, jsx_runtime_1.jsx)(CheckBox_1.default, { name: "lookNegative", ref: lookNegativeRef })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Done, { onClick: handleApplyFilter, style: { margin: '0 10px' }, children: "Apply" })] }));
|
|
71
60
|
}
|
|
72
61
|
exports.default = AutoPeakPickingOptionPanel;
|