nmrium 0.58.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/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/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 +7 -3
- package/lib/component/2d/tools/PivotIndicator.d.ts +1 -2
- package/lib/component/2d/tools/PivotIndicator.js +2 -3
- 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.js +1 -3
- 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/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/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/TabTitle.d.ts +9 -0
- package/lib/component/elements/TabTitle.js +18 -0
- 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 +2 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +3 -0
- package/lib/component/hooks/useSaveSettings.d.ts +1 -1
- package/lib/component/hooks/useSaveSettings.js +18 -22
- package/lib/component/hooks/useToggleSpectraVisibility.d.ts +14 -9
- package/lib/component/hooks/useToggleSpectraVisibility.js +45 -16
- 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 +5 -10
- package/lib/component/main/InnerNMRiumContents.d.ts +3 -2
- package/lib/component/main/InnerNMRiumContents.js +38 -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/EditPeakShapeModal.d.ts +4 -6
- package/lib/component/modal/EditPeakShapeModal.js +45 -33
- 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/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/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/MoleculePanelHeader.js +13 -3
- package/lib/component/panels/Panels.js +2 -2
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +8 -5
- package/lib/component/panels/PeaksPanel/PeaksTable.js +7 -13
- package/lib/component/panels/RangesPanel/RangesHeader.js +52 -15
- 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/SpectraPanel/SpectraPanelHeader.js +13 -6
- package/lib/component/panels/SpectraPanel/SpectraTable.js +63 -21
- 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 +68 -53
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +70 -58
- 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 +8 -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/ZonesPanel.js +16 -8
- 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/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/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/RangesActions.d.ts +1 -0
- package/lib/component/reducer/actions/RangesActions.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/actions/ToolsActions.js +0 -17
- 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/changePrintPageSettings.d.ts +3 -0
- package/lib/component/reducer/preferences/actions/changePrintPageSettings.js +6 -0
- package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +0 -4
- package/lib/component/reducer/preferences/actions/matrixGeneration.js +1 -2
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -2
- package/lib/component/reducer/preferences/preferencesReducer.js +4 -1
- package/lib/component/toolbar/ToolBar.js +33 -14
- package/lib/component/toolbar/ToolTypes.d.ts +1 -1
- package/lib/component/toolbar/ToolTypes.js +0 -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 -16
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +1 -7
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +10 -16
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +10 -16
- 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.d.ts +1 -1
- package/lib/data/molecules/MoleculeManager.js +21 -49
- 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 +34 -34
- 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
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +0 -11
- package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +0 -29
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { buildLink, getCorrelationDelta, getLabel, getLinkDim, } from 'nmr-correlation';
|
|
3
|
-
import { useCallback, useMemo
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
4
|
import { buildID } from '../../../../data/utilities/Concatenation';
|
|
5
5
|
import { findRangeOrZoneID } from '../../../../data/utilities/FindUtilities';
|
|
6
|
-
import
|
|
6
|
+
import { useAlert } from '../../../elements/Alert';
|
|
7
|
+
import { ContextMenu, } from '../../../elements/ContextMenuBluePrint';
|
|
8
|
+
import { useDialog } from '../../../elements/DialogManager';
|
|
7
9
|
import EditableColumn from '../../../elements/EditableColumn';
|
|
8
|
-
import { positions, useModal } from '../../../elements/popup/Modal';
|
|
9
10
|
import { useHighlight } from '../../../highlight';
|
|
10
11
|
import { convertValuesString } from '../utilities/Utilities';
|
|
11
12
|
import useInView from '../utilities/useInView';
|
|
12
13
|
import AdditionalColumnField from './AdditionalColumnField';
|
|
13
|
-
import EditLinkModal from './editLink/EditLinkModal';
|
|
14
|
+
import { EditLinkModal } from './editLink/EditLinkModal';
|
|
14
15
|
function CorrelationTableRow({ additionalColumnData, correlations, correlation, styleRow, styleLabel, onSaveEditEquivalences, onSaveEditNumericValues, onEditCorrelationTableCellHandler, spectraData, }) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
16
|
+
const { openDialog } = useDialog();
|
|
17
|
+
const alert = useAlert();
|
|
17
18
|
const highlightIDsRow = useMemo(() => {
|
|
18
19
|
if (correlation.pseudo === true) {
|
|
19
20
|
return [];
|
|
@@ -63,12 +64,11 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
return (_jsx(AdditionalColumnField, { rowCorrelation: correlation, columnCorrelation: _correlation, commonLinks: commonLinks,
|
|
67
|
+
return (_jsx(AdditionalColumnField, { rowCorrelation: correlation, columnCorrelation: _correlation, commonLinks: commonLinks, spectraData: spectraData, onEdit: onEditCorrelationTableCellHandler }, `addColData_${correlation.id}_${_correlation.id}`));
|
|
67
68
|
});
|
|
68
69
|
}, [
|
|
69
70
|
additionalColumnData,
|
|
70
71
|
correlation,
|
|
71
|
-
correlations,
|
|
72
72
|
onEditCorrelationTableCellHandler,
|
|
73
73
|
spectraData,
|
|
74
74
|
]);
|
|
@@ -121,62 +121,74 @@ function CorrelationTableRow({ additionalColumnData, correlations, correlation,
|
|
|
121
121
|
mouseLeaveHandler,
|
|
122
122
|
styleRow,
|
|
123
123
|
]);
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
label: `edit 1D (${link.signal.delta.toFixed(3)})${link.edited?.moved === true ? '[MOVED]' : ''}`,
|
|
131
|
-
onClick: () => {
|
|
132
|
-
highlightRow.hide();
|
|
133
|
-
modal.show(_jsx(EditLinkModal, { onClose: () => modal.close(), onEdit: onEditCorrelationTableCellHandler, link: link, correlationDim1: correlation, correlationDim2: undefined, correlations: correlations }), {
|
|
134
|
-
position: positions.MIDDLE_RIGHT,
|
|
135
|
-
isBackgroundBlur: false,
|
|
136
|
-
});
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
})
|
|
140
|
-
.concat([
|
|
124
|
+
const deleteCorrelationLink = useCallback(() => {
|
|
125
|
+
const message = `All signals of ${correlation.label.origin} (${getCorrelationDelta(correlation).toFixed(2)}) will be deleted. Are you sure?`;
|
|
126
|
+
alert.showAlert({
|
|
127
|
+
message,
|
|
128
|
+
buttons: [
|
|
141
129
|
{
|
|
142
|
-
|
|
130
|
+
text: 'Yes',
|
|
143
131
|
onClick: () => {
|
|
144
|
-
|
|
145
|
-
message: `All signals of ${correlation.label.origin} (${getCorrelationDelta(correlation).toFixed(2)}) will be deleted. Are you sure?`,
|
|
146
|
-
buttons: [
|
|
147
|
-
{
|
|
148
|
-
text: 'Yes',
|
|
149
|
-
handler: () => {
|
|
150
|
-
onEditCorrelationTableCellHandler([correlation], 'removeAll');
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
{ text: 'No' },
|
|
154
|
-
],
|
|
155
|
-
});
|
|
156
|
-
highlightRow.hide();
|
|
132
|
+
onEditCorrelationTableCellHandler([correlation], 'removeAll');
|
|
157
133
|
},
|
|
134
|
+
intent: 'danger',
|
|
158
135
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
136
|
+
{ text: 'No' },
|
|
137
|
+
],
|
|
138
|
+
});
|
|
139
|
+
highlightRow.hide();
|
|
140
|
+
}, [alert, correlation, highlightRow, onEditCorrelationTableCellHandler]);
|
|
141
|
+
const contextMenus = useMemo(() => {
|
|
142
|
+
if (correlation.pseudo !== false) {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
const contextMenus = [
|
|
146
|
+
{
|
|
147
|
+
text: `Delete ${correlation.label.origin}`,
|
|
148
|
+
icon: 'trash',
|
|
149
|
+
data: { action: 'delete' },
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
for (const link of correlation?.link || []) {
|
|
153
|
+
const isValidLink = getLinkDim(link) === 1 && link.pseudo === false;
|
|
154
|
+
if (isValidLink) {
|
|
155
|
+
const contextMenu = {
|
|
156
|
+
text: `Edit 1D (${link.signal.delta.toFixed(3)})${link.edited?.moved === true ? '[MOVED]' : ''}`,
|
|
157
|
+
icon: 'edit',
|
|
158
|
+
data: {
|
|
159
|
+
action: 'edit',
|
|
160
|
+
data: {
|
|
161
|
+
link,
|
|
162
|
+
correlationDim1: correlation,
|
|
163
|
+
correlationDim2: null,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
contextMenus.push(contextMenu);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return contextMenus;
|
|
171
|
+
}, [correlation]);
|
|
172
|
+
function contextMenuHandler(selectedItem) {
|
|
173
|
+
const { action, data } = selectedItem;
|
|
174
|
+
switch (action) {
|
|
175
|
+
case 'delete': {
|
|
176
|
+
deleteCorrelationLink();
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
case 'edit': {
|
|
180
|
+
highlightRow.hide();
|
|
181
|
+
openDialog(EditLinkModal, data);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
default:
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
172
188
|
const { title, ...otherTableDataProps } = tableDataProps;
|
|
173
189
|
const t = title || '';
|
|
174
|
-
return (_jsxs("tr", { style: styleRow, children: [
|
|
175
|
-
style: { ...tableDataProps.style, styleLabel },
|
|
176
|
-
if (contextMenu.length > 0) {
|
|
177
|
-
contextMenuHandler(e);
|
|
178
|
-
}
|
|
179
|
-
}, children: [getLabel(correlations, correlation), _jsx(ContextMenu, { ref: contextRef, context: contextMenu })] }), _jsx("td", { title: t, ...otherTableDataProps, children: getCorrelationDelta(correlation)
|
|
190
|
+
return (_jsxs("tr", { style: styleRow, children: [_jsx(ContextMenu, { as: "td", options: contextMenus, title: t, ...otherTableDataProps,
|
|
191
|
+
style: { ...tableDataProps.style, styleLabel }, onSelect: contextMenuHandler, children: getLabel(correlations, correlation) }), _jsx("td", { title: t, ...otherTableDataProps, children: getCorrelationDelta(correlation)
|
|
180
192
|
? getCorrelationDelta(correlation)?.toFixed(2)
|
|
181
193
|
: '' }), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "number", value: correlation.equivalence, style: equivalenceCellStyle, onSave: onSaveEquivalencesHandler, validate: (val) => val !== '' })) : (_jsx("span", { style: equivalenceCellStyle, children: correlation.equivalence })) }), _jsx("td", { title: t, ...otherTableDataProps, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.protonsCount.join(','), style: correlation.edited.protonsCount ? { color: 'blue' } : {}, onSave: (e) => onSaveEditNumericValuesHandler(e, 'protonsCount'), validate: (val) => val !== '' })) : ('') }), _jsx("td", { title: t, ...otherTableDataProps,
|
|
182
194
|
style: { ...tableDataProps.style, borderRight: '1px solid' }, children: correlation.atomType !== 'H' ? (_jsx(EditableColumn, { type: "text", value: correlation.hybridization
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { Link, Correlation } from 'nmr-correlation';
|
|
2
|
+
import { DialogProps } from '../../../../elements/DialogManager';
|
|
3
|
+
import { OnEditCorrelationCallback } from '../../SummaryPanel';
|
|
4
|
+
export interface EditLinkDialogData {
|
|
5
|
+
correlationDim1: Correlation;
|
|
6
|
+
correlationDim2: Correlation;
|
|
7
|
+
link: Link;
|
|
8
|
+
}
|
|
9
|
+
interface EditLinkModalProps extends DialogProps<EditLinkDialogData> {
|
|
10
|
+
onEdit: OnEditCorrelationCallback;
|
|
11
|
+
}
|
|
12
|
+
export declare function EditLinkModal(props: EditLinkModalProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,75 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import {
|
|
3
|
+
import { DialogBody, Tab, Tabs } from '@blueprintjs/core';
|
|
4
4
|
import { getLinkDim } from 'nmr-correlation';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import Tab from '../../../../elements/Tab/Tab';
|
|
8
|
-
import Tabs, { PositionsEnum } from '../../../../elements/Tab/Tabs';
|
|
5
|
+
import { useChartData } from '../../../../context/ChartContext';
|
|
6
|
+
import { DraggableDialog } from '../../../../elements/DraggableDialog';
|
|
9
7
|
import { getEditedCorrelations } from '../../utilities/Utilities';
|
|
10
8
|
import EditLinkConfirmation from './Confirmation';
|
|
11
9
|
import EditPathLength from './EditPathLength';
|
|
12
10
|
import MoveLink from './MoveLink';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
flex: 2;
|
|
20
|
-
padding: 5px;
|
|
21
|
-
border: 1px solid gray;
|
|
22
|
-
border-radius: 5px;
|
|
23
|
-
height: 30px;
|
|
24
|
-
margin: 0 auto;
|
|
25
|
-
margin-top: 15px;
|
|
26
|
-
display: block;
|
|
27
|
-
width: 20%;
|
|
28
|
-
color: white;
|
|
29
|
-
background-color: gray;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
button:focus {
|
|
33
|
-
outline: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.header {
|
|
37
|
-
height: 24px;
|
|
38
|
-
border-bottom: 1px solid #f0f0f0;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
|
|
42
|
-
button {
|
|
43
|
-
height: 36px;
|
|
44
|
-
margin: 2px;
|
|
45
|
-
background-color: transparent;
|
|
46
|
-
border: none;
|
|
47
|
-
|
|
48
|
-
svg {
|
|
49
|
-
height: 16px;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
p {
|
|
54
|
-
font-weight: bold;
|
|
55
|
-
margin-bottom: 5px;
|
|
56
|
-
margin-right: 30px;
|
|
57
|
-
padding: 0 10px;
|
|
58
|
-
width: 100%;
|
|
59
|
-
text-align: center;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.tabs-container {
|
|
64
|
-
width: 100%;
|
|
65
|
-
flex: 1;
|
|
66
|
-
overflow: auto;
|
|
67
|
-
border: none;
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
|
-
export default function EditLinkModal({ correlationDim1, correlationDim2, link, correlations, onClose, onEdit, }) {
|
|
71
|
-
const [activeTab, setActiveTab] = useState('move');
|
|
72
|
-
const getLinkLabel = useCallback(() => {
|
|
11
|
+
export function EditLinkModal(props) {
|
|
12
|
+
const { onCloseDialog, dialogData, onEdit } = props;
|
|
13
|
+
const { correlations: correlationData } = useChartData();
|
|
14
|
+
const correlations = correlationData?.values || [];
|
|
15
|
+
const { correlationDim1, correlationDim2, link } = dialogData;
|
|
16
|
+
function getLinkLabel() {
|
|
73
17
|
const linkDim = getLinkDim(link);
|
|
74
18
|
if (linkDim === 1) {
|
|
75
19
|
return ` 1D (${link.signal.delta.toFixed(3)})`;
|
|
@@ -78,8 +22,8 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
|
|
|
78
22
|
return `${link.signal.x ? `${link.signal.x.delta.toFixed(2)}` : '?'} (${correlationDim1.label.origin}), ${link.signal.y ? link.signal.y.delta.toFixed(2) : '?'} (${correlationDim2.label.origin})`;
|
|
79
23
|
}
|
|
80
24
|
return '';
|
|
81
|
-
}
|
|
82
|
-
|
|
25
|
+
}
|
|
26
|
+
function handleOnEdit(action, selectedCorrelationIdDim1, selectedCorrelationIdDim2, editedLink) {
|
|
83
27
|
const { editedCorrelations, buildCorrelationDataOptions } = getEditedCorrelations({
|
|
84
28
|
correlationDim1,
|
|
85
29
|
correlationDim2,
|
|
@@ -90,18 +34,10 @@ export default function EditLinkModal({ correlationDim1, correlationDim2, link,
|
|
|
90
34
|
correlations,
|
|
91
35
|
});
|
|
92
36
|
onEdit(editedCorrelations, action, editedLink || link, buildCorrelationDataOptions);
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
activeTab,
|
|
100
|
-
correlationDim1,
|
|
101
|
-
correlationDim2,
|
|
102
|
-
correlations,
|
|
103
|
-
handleOnEdit,
|
|
104
|
-
link,
|
|
105
|
-
]);
|
|
106
|
-
return (_jsxs("div", { css: modalContainer, children: [_jsxs("div", { className: "header handle", children: [_jsx(CloseButton, { tooltip: "Close", onClick: onClose }), _jsx("p", { className: "header-info", children: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}` })] }), tabsContainer] }));
|
|
37
|
+
onCloseDialog?.();
|
|
38
|
+
}
|
|
39
|
+
return (_jsx(DraggableDialog, { hasBackdrop: false, canOutsideClickClose: false, style: { width: 500 }, title: `${link.experimentType.toUpperCase()} signal at ${getLinkLabel()}`, isOpen: true, onClose: onCloseDialog, placement: "center-right", children: _jsx(DialogBody, { children: _jsxs(Tabs, { defaultSelectedTabId: "move", children: [_jsx(Tab, { title: "Move", id: "move", panel: _jsx(MoveLink, { correlationDim1: correlationDim1, correlationDim2: correlationDim2, link: link, correlations: correlations, onEdit: (correlationIdDim1, correlationIdDim2) => handleOnEdit('move', correlationIdDim1, correlationIdDim2) }) }), _jsx(Tab, { title: "Unmove", id: "unmove", panel: _jsx(EditLinkConfirmation, { description: "Movement of signal to its original place.", onConfirm: () => handleOnEdit('unmove', correlationDim1.id, correlationDim2.id) }) }), _jsx(Tab, { title: "Remove", id: "remove", panel: _jsx(EditLinkConfirmation, { description: "Deletion of signal.", onConfirm: () => handleOnEdit('remove', undefined, undefined) }) }), _jsx(Tab, { title: "J Coupling", id: "setPathLength", panel: _jsx(EditPathLength, { signal: link.signal, experimentType: link.experimentType, onEdit: (editedSignal) => {
|
|
40
|
+
const editedLink = { ...link, signal: editedSignal };
|
|
41
|
+
handleOnEdit('setPathLength', correlationDim1, correlationDim2, editedLink);
|
|
42
|
+
} }) })] }) }) }));
|
|
107
43
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Correlation, Options as CorrelationOptions, Link } from 'nmr-correlation';
|
|
2
|
+
type EditCorrelationAction = 'add' | 'move' | 'remove' | 'unmove' | 'setPathLength';
|
|
3
|
+
export type OnEditCorrelationCallback = (editedCorrelations: Correlation[], action: EditCorrelationAction, link?: Link, options?: CorrelationOptions) => void;
|
|
1
4
|
declare function SummaryPanel(): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
2
5
|
declare const _default: import("react").MemoExoticComponent<typeof SummaryPanel>;
|
|
3
6
|
export default _default;
|
|
@@ -8,10 +8,12 @@ import { findRange, findSignal1D, findSignal2D, findSpectrum, findZone, } from '
|
|
|
8
8
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
9
9
|
import { useChartData } from '../../context/ChartContext';
|
|
10
10
|
import { useDispatch } from '../../context/DispatchContext';
|
|
11
|
+
import { withDialog } from '../../elements/DialogManager';
|
|
11
12
|
import Select from '../../elements/Select';
|
|
12
13
|
import { useDialogToggle } from '../../hooks/useDialogToggle';
|
|
13
14
|
import DefaultPanelHeader from '../header/DefaultPanelHeader';
|
|
14
15
|
import CorrelationTable from './CorrelationTable/CorrelationTable';
|
|
16
|
+
import { EditLinkModal } from './CorrelationTable/editLink/EditLinkModal';
|
|
15
17
|
import Overview from './Overview';
|
|
16
18
|
import { SetMolecularFormulaModal } from './SetMolecularFormulaModal';
|
|
17
19
|
import { SetShiftToleranceModal } from './SetShiftTolerancesModal';
|
|
@@ -49,6 +51,7 @@ const panelStyle = css `
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
`;
|
|
54
|
+
const EditLinkDialog = withDialog(EditLinkModal);
|
|
52
55
|
function SummaryPanel() {
|
|
53
56
|
const { correlations: correlationsData, data: spectraData, xDomain, yDomain, displayerMode, view: { spectra: { activeTab }, }, } = useChartData();
|
|
54
57
|
const dispatch = useDispatch();
|
|
@@ -198,6 +201,10 @@ function SummaryPanel() {
|
|
|
198
201
|
});
|
|
199
202
|
}, [dispatch]);
|
|
200
203
|
const deleteCorrelationHandler = useCallback((correlation) => {
|
|
204
|
+
const correlationLinks = correlation?.links;
|
|
205
|
+
if (!(Array.isArray(correlationLinks) && correlationLinks.length > 0)) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
201
208
|
dispatch({
|
|
202
209
|
type: 'DELETE_CORRELATION',
|
|
203
210
|
payload: {
|
|
@@ -290,7 +297,7 @@ function SummaryPanel() {
|
|
|
290
297
|
setFilterIsActive(!filterIsActive);
|
|
291
298
|
}, [filterIsActive]);
|
|
292
299
|
const total = correlationsData ? correlationsData.values.length : 0;
|
|
293
|
-
return (_jsxs("div", { css: panelStyle, children: [_jsx(SetMolecularFormulaModal, { isOpen: dialog.molecularFormula, onClose: closeDialog }), _jsx(SetShiftToleranceModal, { isOpen: dialog.shiftToleranceModal, onClose: closeDialog }), _jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
300
|
+
return (_jsxs("div", { css: panelStyle, children: [_jsx(EditLinkDialog, { onEdit: editCorrelationTableCellHandler }), _jsx(SetMolecularFormulaModal, { isOpen: dialog.molecularFormula, onClose: closeDialog }), _jsx(SetShiftToleranceModal, { isOpen: dialog.shiftToleranceModal, onClose: closeDialog }), _jsx(DefaultPanelHeader, { total: total, counter: filteredCorrelationsData?.values.length, onFilter: handleOnFilter, filterToolTip: filterIsActive
|
|
294
301
|
? 'Show all correlations'
|
|
295
302
|
: 'Hide correlations out of view', leftButtons: [
|
|
296
303
|
{
|
|
@@ -3,7 +3,7 @@ import lodashGet from 'lodash/get';
|
|
|
3
3
|
import { addLink, buildCorrelation, buildLink, getLinkDelta, getLinkDim, removeLink, } from 'nmr-correlation';
|
|
4
4
|
import DefaultPathLengths from '../../../../data/constants/DefaultPathLengths';
|
|
5
5
|
import { findSignal2D, findSpectrum, } from '../../../../data/utilities/FindUtilities';
|
|
6
|
-
import isDefaultPathLength from '../../../modal/editZone/validation/isDefaultPathLength';
|
|
6
|
+
import { isDefaultPathLength } from '../../../modal/editZone/validation/isDefaultPathLength';
|
|
7
7
|
import { ErrorColors } from '../CorrelationTable/Constants';
|
|
8
8
|
function getAtomType(nucleus) {
|
|
9
9
|
return nucleus.split(/\d+/)[1];
|
|
@@ -5,8 +5,9 @@ import { SIGNAL_KINDS } from '../../../../data/constants/signalsKinds';
|
|
|
5
5
|
import { useAssignmentData } from '../../../assignment/AssignmentsContext';
|
|
6
6
|
import { useDispatch } from '../../../context/DispatchContext';
|
|
7
7
|
import Select from '../../../elements/Select';
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
8
|
+
import { useZoneActions } from '../hooks/useZoneActions';
|
|
9
|
+
import { useDialog } from '../../../elements/DialogManager';
|
|
10
|
+
import { EditZoneModal } from '../../../modal/editZone/EditZoneModal';
|
|
10
11
|
const selectBoxStyle = {
|
|
11
12
|
marginLeft: 2,
|
|
12
13
|
marginRight: 2,
|
|
@@ -16,7 +17,6 @@ const selectBoxStyle = {
|
|
|
16
17
|
function ActionsColumn({ rowData, rowSpanTags, showKind, showDeleteAction, showEditAction, showZoomAction, }) {
|
|
17
18
|
const dispatch = useDispatch();
|
|
18
19
|
const assignmentData = useAssignmentData();
|
|
19
|
-
const modal = useModal();
|
|
20
20
|
const showActions = showDeleteAction || showEditAction || showZoomAction;
|
|
21
21
|
const changeSignalKindHandler = useCallback((kind) => {
|
|
22
22
|
dispatch({
|
|
@@ -36,47 +36,66 @@ function ActionsColumn({ rowData, rowSpanTags, showKind, showDeleteAction, showE
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
}, [assignmentData, dispatch, rowData]);
|
|
39
|
-
const zoomZoneHandler = useCallback(() => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
39
|
+
// const zoomZoneHandler = useCallback(() => {
|
|
40
|
+
// const xMargin = Math.abs(rowData.x.from - rowData.x.to) * 10;
|
|
41
|
+
// dispatch({
|
|
42
|
+
// type: 'SET_X_DOMAIN',
|
|
43
|
+
// payload: {
|
|
44
|
+
// xDomain:
|
|
45
|
+
// rowData.x.from <= rowData.x.to
|
|
46
|
+
// ? [rowData.x.from - xMargin, rowData.x.to + xMargin]
|
|
47
|
+
// : [rowData.x.to - xMargin, rowData.x.from + xMargin],
|
|
48
|
+
// },
|
|
49
|
+
// });
|
|
50
|
+
// const yMargin = Math.abs(rowData.y.from - rowData.y.to) * 10;
|
|
51
|
+
// dispatch({
|
|
52
|
+
// type: 'SET_Y_DOMAIN',
|
|
53
|
+
// payload: {
|
|
54
|
+
// yDomain:
|
|
55
|
+
// rowData.y.from <= rowData.y.to
|
|
56
|
+
// ? [rowData.y.from - yMargin, rowData.y.to + yMargin]
|
|
57
|
+
// : [rowData.y.to - yMargin, rowData.y.from + yMargin],
|
|
58
|
+
// },
|
|
59
|
+
// });
|
|
60
|
+
// }, [dispatch, rowData.x.from, rowData.x.to, rowData.y.from, rowData.y.to]);
|
|
61
|
+
// const saveEditZoneHandler = useCallback(
|
|
62
|
+
// (zone) => {
|
|
63
|
+
// dispatch({
|
|
64
|
+
// type: 'SAVE_EDITED_ZONE',
|
|
65
|
+
// payload: {
|
|
66
|
+
// zone,
|
|
67
|
+
// },
|
|
68
|
+
// });
|
|
69
|
+
// },
|
|
70
|
+
// [dispatch],
|
|
71
|
+
// );
|
|
72
|
+
const { zoomToZone } = useZoneActions();
|
|
73
|
+
const { openDialog } = useDialog();
|
|
74
|
+
// const openEditZoneHandler = useCallback(() => {
|
|
75
|
+
// dispatch({
|
|
76
|
+
// type: 'SET_SELECTED_TOOL',
|
|
77
|
+
// payload: { selectedTool: 'zoom' },
|
|
78
|
+
// });
|
|
79
|
+
// modal.show(
|
|
80
|
+
// <EditZoneModal
|
|
81
|
+
// onCloseEditZoneModal={() => modal.close()}
|
|
82
|
+
// // onSaveEditZoneModal={saveEditZoneHandler}
|
|
83
|
+
// onZoomEditZoneModal={() => zoomZoneHandler()}
|
|
84
|
+
// rowData={rowData}
|
|
85
|
+
// />,
|
|
86
|
+
// {
|
|
87
|
+
// position: positions.MIDDLE_RIGHT,
|
|
88
|
+
// transition: transitions.SCALE,
|
|
89
|
+
// isBackgroundBlur: false,
|
|
90
|
+
// },
|
|
91
|
+
// );
|
|
92
|
+
// }, [dispatch, modal, rowData, saveEditZoneHandler, zoomZoneHandler]);
|
|
93
|
+
function handleEditZone() {
|
|
94
|
+
openDialog(EditZoneModal, rowData);
|
|
95
|
+
zoomToZone(rowData);
|
|
96
|
+
}
|
|
78
97
|
return (_jsxs(Fragment, { children: [showKind && (_jsx("td", { children: _jsx(Select, { onChange: (value) => {
|
|
79
98
|
changeSignalKindHandler(value);
|
|
80
|
-
}, items: SIGNAL_KINDS, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }) })), showActions && (_jsxs("td", { ...rowSpanTags, children: [showDeleteAction && (_jsx("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: _jsx(FaRegTrashAlt, {}) })), showZoomAction && (_jsx("button", { type: "button", className: "zoom-button", onClick:
|
|
99
|
+
}, items: SIGNAL_KINDS, defaultValue: rowData.tableMetaInfo.signal.kind, style: selectBoxStyle }) })), showActions && (_jsxs("td", { ...rowSpanTags, children: [showDeleteAction && (_jsx("button", { type: "button", className: "delete-button", onClick: deleteZoneHandler, children: _jsx(FaRegTrashAlt, {}) })), showZoomAction && (_jsx("button", { type: "button", className: "zoom-button", onClick: () => zoomToZone(rowData), children: _jsx(FaSearchPlus, { title: "Zoom to zone in spectrum" }) })), showEditAction && (_jsx("button", { type: "button", className: "edit-button", onClick: handleEditZone, children: _jsx(FaEdit, { color: "blue" }) }))] }))] }));
|
|
81
100
|
}
|
|
82
101
|
export default ActionsColumn;
|
|
@@ -7,7 +7,7 @@ import { LuSubtitles } from 'react-icons/lu';
|
|
|
7
7
|
import { useAssignmentData } from '../../assignment/AssignmentsContext';
|
|
8
8
|
import { useChartData } from '../../context/ChartContext';
|
|
9
9
|
import { useDispatch } from '../../context/DispatchContext';
|
|
10
|
-
import {
|
|
10
|
+
import { useAlert } from '../../elements/Alert';
|
|
11
11
|
import { useActiveSpectrumZonesViewState } from '../../hooks/useActiveSpectrumZonesViewState';
|
|
12
12
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
13
13
|
import { booleanToString } from '../../utility/booleanToString';
|
|
@@ -20,7 +20,7 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
20
20
|
const [filterIsActive, setFilterIsActive] = useState(false);
|
|
21
21
|
const assignmentData = useAssignmentData();
|
|
22
22
|
const dispatch = useDispatch();
|
|
23
|
-
const
|
|
23
|
+
const alert = useAlert();
|
|
24
24
|
const [isFlipped, setFlipStatus] = useState(false);
|
|
25
25
|
const settingRef = useRef();
|
|
26
26
|
const tableData = useMemo(() => {
|
|
@@ -73,25 +73,33 @@ function ZonesPanelInner({ zones, activeTab, xDomain, yDomain, info, showZones,
|
|
|
73
73
|
unlinkZoneHandler();
|
|
74
74
|
}, [unlinkZoneHandler]);
|
|
75
75
|
const handleOnRemoveAssignments = useCallback(() => {
|
|
76
|
-
|
|
76
|
+
alert.showAlert({
|
|
77
77
|
message: 'All assignments will be removed. Are you sure?',
|
|
78
|
-
buttons: [
|
|
78
|
+
buttons: [
|
|
79
|
+
{
|
|
80
|
+
text: 'Yes',
|
|
81
|
+
onClick: removeAssignments,
|
|
82
|
+
intent: 'danger',
|
|
83
|
+
},
|
|
84
|
+
{ text: 'No' },
|
|
85
|
+
],
|
|
79
86
|
});
|
|
80
|
-
}, [removeAssignments,
|
|
87
|
+
}, [removeAssignments, alert]);
|
|
81
88
|
const handleDeleteAll = useCallback(() => {
|
|
82
|
-
|
|
89
|
+
alert.showAlert({
|
|
83
90
|
message: 'All zones will be deleted. Are You sure?',
|
|
84
91
|
buttons: [
|
|
85
92
|
{
|
|
86
93
|
text: 'Yes',
|
|
87
|
-
|
|
94
|
+
onClick: () => {
|
|
88
95
|
dispatch({ type: 'DELETE_2D_ZONE', payload: { assignmentData } });
|
|
89
96
|
},
|
|
97
|
+
intent: 'danger',
|
|
90
98
|
},
|
|
91
99
|
{ text: 'No' },
|
|
92
100
|
],
|
|
93
101
|
});
|
|
94
|
-
}, [assignmentData, dispatch,
|
|
102
|
+
}, [assignmentData, dispatch, alert]);
|
|
95
103
|
const settingsPanelHandler = useCallback(() => {
|
|
96
104
|
setFlipStatus(!isFlipped);
|
|
97
105
|
}, [isFlipped]);
|
|
@@ -8,6 +8,8 @@ import NoDataForFid from '../extra/placeholder/NoDataForFid';
|
|
|
8
8
|
import NoTableData from '../extra/placeholder/NoTableData';
|
|
9
9
|
import ZonesTableRow from './ZonesTableRow';
|
|
10
10
|
import { useMapZones } from './hooks/useMapZones';
|
|
11
|
+
import { withDialog } from '../../elements/DialogManager';
|
|
12
|
+
import { EditZoneModal } from '../../modal/editZone/EditZoneModal';
|
|
11
13
|
const tableStyle = css `
|
|
12
14
|
border-spacing: 0;
|
|
13
15
|
border: 1px solid #dedede;
|
|
@@ -60,6 +62,7 @@ const tableStyle = css `
|
|
|
60
62
|
top: 21px;
|
|
61
63
|
}
|
|
62
64
|
`;
|
|
65
|
+
const ZoneEditionDialog = withDialog(EditZoneModal, { force: true });
|
|
63
66
|
function ZonesTable({ tableData, onUnlink, nucleus, info }) {
|
|
64
67
|
const { experiment, isFid } = info;
|
|
65
68
|
const nuclei = nucleus.split(',');
|
|
@@ -75,7 +78,7 @@ function ZonesTable({ tableData, onUnlink, nucleus, info }) {
|
|
|
75
78
|
if (!tableData || tableData.length === 0) {
|
|
76
79
|
return _jsx(NoTableData, {});
|
|
77
80
|
}
|
|
78
|
-
return (
|
|
81
|
+
return (_jsxs("div", { children: [_jsx(ZoneEditionDialog, {}), _jsxs("table", { css: tableStyle, children: [_jsxs("thead", { children: [_jsxs("tr", { children: [showSerialNumber && _jsx("th", { rowSpan: 2, children: "#" }), showAssignmentLabel && _jsx("th", { rowSpan: 2, children: "Assignment" }), (deltaX.show || deltaX.show) && _jsx("th", { colSpan: 2, children: "\u03B4 (ppm)" }), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { colSpan: 2, children: _jsx(FaLink, {}) }), _jsx("th", { colSpan: 2, children: "\u03A3" })] })), showKind && _jsx("th", { rowSpan: 2, children: "Kind" }), showActions && _jsx("th", { rowSpan: 2, children: '' })] }), _jsxs("tr", { children: [deltaX.show && (_jsx("th", { id: "tableMetaInfo.signal.x.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F2", children: [nuclei[0], ' ', isSortedDesc('tableMetaInfo.signal.x.delta').content] }) })), deltaY.show && (_jsx("th", { id: "tableMetaInfo.signal.y.delta", ...onSort, children: _jsxs(SurroundedText, { text: "F1", children: [nuclei[1], ' ', isSortedDesc('tableMetaInfo.signal.y.delta').content] }) })), showAssignment && (_jsxs(_Fragment, { children: [_jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F2", children: nuclei[0] }) }), _jsx("th", { children: _jsx(SurroundedText, { text: "F1", children: nuclei[1] }) })] }))] })] }), _jsx("tbody", { children: sortedData.map((rowData, index) => (_jsx(ZonesTableRow, { rowIndex: index, rowData: rowData, onUnlink: onUnlink, nucleus: nucleus }, `${rowData.tableMetaInfo.id}`))) })] })] }));
|
|
79
82
|
}
|
|
80
83
|
function SurroundedText(props) {
|
|
81
84
|
return (_jsxs(_Fragment, { children: [_jsx("div", { style: {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useDispatch } from '../../../context/DispatchContext';
|
|
2
|
+
function getZoomDomain(zone, marginFactor = 10) {
|
|
3
|
+
const { x: { from: xFrom, to: xTo }, y: { from: yFrom, to: yTo }, } = zone;
|
|
4
|
+
const xMargin = Math.abs(xFrom - xTo) * marginFactor;
|
|
5
|
+
const yMargin = Math.abs(yFrom - yTo) * marginFactor;
|
|
6
|
+
const xDomain = xFrom <= xTo
|
|
7
|
+
? [xFrom - xMargin, xTo + xMargin]
|
|
8
|
+
: [xTo - xMargin, xFrom + xMargin];
|
|
9
|
+
const yDomain = yFrom <= yTo
|
|
10
|
+
? [yFrom - yMargin, yTo + yMargin]
|
|
11
|
+
: [yTo - yMargin, yFrom + yMargin];
|
|
12
|
+
return { xDomain, yDomain };
|
|
13
|
+
}
|
|
14
|
+
export function useZoneActions() {
|
|
15
|
+
const dispatch = useDispatch();
|
|
16
|
+
function zoomToZone(zone) {
|
|
17
|
+
const { xDomain, yDomain } = getZoomDomain(zone);
|
|
18
|
+
dispatch({
|
|
19
|
+
type: 'SET_X_DOMAIN',
|
|
20
|
+
payload: {
|
|
21
|
+
xDomain,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
dispatch({
|
|
25
|
+
type: 'SET_Y_DOMAIN',
|
|
26
|
+
payload: {
|
|
27
|
+
yDomain,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function saveZone(zone) {
|
|
32
|
+
dispatch({
|
|
33
|
+
type: 'SAVE_EDITED_ZONE',
|
|
34
|
+
payload: {
|
|
35
|
+
zone,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return { zoomToZone, saveZone };
|
|
40
|
+
}
|