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
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { get1DDataXY } from '../../data/data1d/Spectrum1D/get1DDataXY';
|
|
5
5
|
import { isSpectrum1D } from '../../data/data1d/Spectrum1D/isSpectrum1D';
|
|
6
|
+
import { useBrushTracker } from '../EventsTrackers/BrushTracker';
|
|
6
7
|
import { useChartData } from '../context/ChartContext';
|
|
7
8
|
import { useScaleChecked } from '../context/ScaleContext';
|
|
8
9
|
import { useActiveSpectra } from '../hooks/useActiveSpectra';
|
|
@@ -19,16 +20,27 @@ const style = css `
|
|
|
19
20
|
}
|
|
20
21
|
`;
|
|
21
22
|
function LinesSeries() {
|
|
22
|
-
const { data, displayerKey, xDomains
|
|
23
|
+
const { data, displayerKey, xDomains } = useChartData();
|
|
23
24
|
const activeSpectra = useActiveSpectra();
|
|
25
|
+
const spectra = (data?.filter((d) => isSpectrum1D(d) && d.display.isVisible && xDomains[d.id]) || []);
|
|
26
|
+
return (_jsxs("g", { clipPath: `url(#${displayerKey}clip-chart-1d)`, className: "spectra", children: [spectra.map((d, i) => (_jsxs("g", { children: [_jsx(Line, { display: d.display, id: d.id, data: get1DDataXY(d), index: i }), _jsx(HeadlightRectStackMode, { spectrumID: d.id, index: i })] }, d.id))), activeSpectra?.map((activeSpectrum) => (_jsx("use", { href: `#${activeSpectrum.id}` }, activeSpectrum.id)))] }));
|
|
27
|
+
}
|
|
28
|
+
function HeadlightRectStackMode(props) {
|
|
29
|
+
const { spectrumID, index } = props;
|
|
30
|
+
const { step } = useBrushTracker();
|
|
31
|
+
const { width, margin, height, toolOptions: { selectedTool }, } = useChartData();
|
|
24
32
|
const { shiftY } = useScaleChecked();
|
|
25
33
|
const verticalAlign = useVerticalAlign();
|
|
26
34
|
const innerWidth = width - margin.left - margin.right;
|
|
27
35
|
const innerHeight = height - margin.bottom - SPECTRA_BOTTOM_MARGIN;
|
|
28
|
-
const spectra = (data?.filter((d) => isSpectrum1D(d) && d.display.isVisible && xDomains[d.id]) || []);
|
|
29
36
|
const { setActiveSpectrum } = useSetActiveSpectrumAction();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
if (verticalAlign !== 'stack' ||
|
|
38
|
+
selectedTool !== 'zoom' ||
|
|
39
|
+
step === 'brushing') {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return (_jsx("rect", { css: style, y: innerHeight - shiftY * index - BOX_SIZE / 2, x: margin.left, width: `${innerWidth}px`, height: `${BOX_SIZE}px`, onClick: (e) => {
|
|
43
|
+
setActiveSpectrum(e, spectrumID);
|
|
44
|
+
}, "data-no-export": "true" }));
|
|
33
45
|
}
|
|
34
46
|
export default LinesSeries;
|
|
@@ -30,7 +30,7 @@ import Chart1D from './Chart1D';
|
|
|
30
30
|
import FooterBanner from './FooterBanner';
|
|
31
31
|
import BaseLine from './tool/BaseLine';
|
|
32
32
|
import PeakPointer from './tool/PeakPointer';
|
|
33
|
-
import
|
|
33
|
+
import { PivotIndicator } from './tool/PivotIndicator';
|
|
34
34
|
import XLabelPointer from './tool/XLabelPointer';
|
|
35
35
|
import { getXScale } from './utilities/scale';
|
|
36
36
|
function Viewer1D({ emptyText = undefined }) {
|
|
@@ -181,7 +181,6 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
181
181
|
payload: {
|
|
182
182
|
zone: { from, to },
|
|
183
183
|
nucleus: activeTab,
|
|
184
|
-
range: { from: xDomain[0], to: xDomain[1] },
|
|
185
184
|
},
|
|
186
185
|
});
|
|
187
186
|
break;
|
|
@@ -230,7 +229,6 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
230
229
|
logger,
|
|
231
230
|
dispatchPreferences,
|
|
232
231
|
activeTab,
|
|
233
|
-
xDomain,
|
|
234
232
|
openAnalysisModal,
|
|
235
233
|
]);
|
|
236
234
|
const handelOnDoubleClick = useCallback(() => {
|
|
@@ -297,6 +295,14 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
297
295
|
}
|
|
298
296
|
break;
|
|
299
297
|
}
|
|
298
|
+
case 'phaseCorrection':
|
|
299
|
+
dispatch({
|
|
300
|
+
type: 'SET_ONE_DIMENSION_PIVOT_POINT',
|
|
301
|
+
payload: {
|
|
302
|
+
value: event.x,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
break;
|
|
300
306
|
case 'zoom':
|
|
301
307
|
case 'matrixGenerationExclusionZones':
|
|
302
308
|
if (!showStocsy || !event.shiftKey)
|
|
@@ -338,6 +344,6 @@ function Viewer1D({ emptyText = undefined }) {
|
|
|
338
344
|
width: '100%',
|
|
339
345
|
height: `100%`,
|
|
340
346
|
position: 'absolute',
|
|
341
|
-
}, children: [_jsx(CrossLinePointer, {}), _jsx(BrushXY, { brushType: BRUSH_TYPE.X }), _jsx(XLabelPointer, {}), _jsx(PeakPointer, {}), _jsx(
|
|
347
|
+
}, children: [_jsx(CrossLinePointer, {}), _jsx(BrushXY, { brushType: BRUSH_TYPE.X }), _jsx(XLabelPointer, {}), _jsx(PeakPointer, {}), _jsx(FooterBanner, {}), _jsx(Chart1D, { width: widthProp, height: heightProp, margin: margin, mode: mode, displayerKey: displayerKey }), _jsx(BaseLine, {}), _jsx(PivotIndicator, {})] }) }))] }) })) }), brushData && (_jsx(MultipletAnalysisModal, { isOpen: isOpenAnalysisModal, onClose: closeAnalysisModal, data: data, activeSpectrum: activeSpectrum, scaleX: scaleState.scaleX, ...brushData }))] }));
|
|
342
348
|
}
|
|
343
349
|
export default Viewer1D;
|
|
@@ -11,7 +11,7 @@ import { IntegralIndicator } from './IntegralIndicator';
|
|
|
11
11
|
const stylesOnHover = css `
|
|
12
12
|
pointer-events: bounding-box;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
@document url-prefix("") {
|
|
15
15
|
pointer-events: fill;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -26,7 +26,7 @@ const stylesOnHover = css `
|
|
|
26
26
|
const stylesHighlighted = css `
|
|
27
27
|
pointer-events: bounding-box;
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
@document url-prefix("") {
|
|
30
30
|
pointer-events: fill;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -13,7 +13,7 @@ export declare function sliceArrayForDomain<T extends string[] | NumberArray>(ar
|
|
|
13
13
|
toIndex: number;
|
|
14
14
|
}): T;
|
|
15
15
|
export declare function useMatrix(): {
|
|
16
|
-
x:
|
|
16
|
+
x: never[] | Float64Array;
|
|
17
17
|
matrixY: Float64Array[];
|
|
18
18
|
} | null;
|
|
19
19
|
interface InterpolateColorsPointsOptions {
|
|
@@ -22,10 +22,12 @@ function useAtoms(range) {
|
|
|
22
22
|
for (const [id, topicMoleculeObject] of Object.entries(topicMolecule)) {
|
|
23
23
|
const atoms = [];
|
|
24
24
|
const diaIDsObject = topicMoleculeObject.getDiaIDsObject();
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (diaIDsObject) {
|
|
26
|
+
for (const id of diaIDs) {
|
|
27
|
+
const existingAtoms = diaIDsObject[id]?.existingAtoms;
|
|
28
|
+
if (existingAtoms?.length > 0) {
|
|
29
|
+
atoms.push(...existingAtoms);
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
if (atoms.length > 0) {
|
|
@@ -12,12 +12,13 @@ import { useDispatch } from '../../context/DispatchContext';
|
|
|
12
12
|
import { useLogger } from '../../context/LoggerContext';
|
|
13
13
|
import { useShareData } from '../../context/ShareDataContext';
|
|
14
14
|
import { ActionsButtonsPopover, } from '../../elements/ActionsButtonsPopover';
|
|
15
|
+
import { useDialogData } from '../../elements/DialogManager';
|
|
15
16
|
import { ResizerWithScale } from '../../elements/ResizerWithScale';
|
|
16
17
|
import { HighlightEventSource, useHighlight } from '../../highlight';
|
|
17
18
|
import { useActiveSpectrumRangesViewState } from '../../hooks/useActiveSpectrumRangesViewState';
|
|
18
19
|
import { useResizerStatus } from '../../hooks/useResizerStatus';
|
|
19
20
|
import useSpectrum from '../../hooks/useSpectrum';
|
|
20
|
-
import {
|
|
21
|
+
import { EditRangeModal } from '../../modal/editRange/EditRangeModal';
|
|
21
22
|
import { IntegralIndicator } from '../integral/IntegralIndicator';
|
|
22
23
|
import { useScaleX } from '../utilities/scale';
|
|
23
24
|
import { AssignmentLabel } from './AssignmentLabel';
|
|
@@ -43,7 +44,8 @@ function Range({ range, selectedTool, relativeFormat }) {
|
|
|
43
44
|
const { logger } = useLogger();
|
|
44
45
|
const spectrum = useSpectrum();
|
|
45
46
|
const { showIntegralsValues } = useActiveSpectrumRangesViewState();
|
|
46
|
-
const
|
|
47
|
+
const { isDialogOpen } = useDialogData();
|
|
48
|
+
const isBlockedByEditing = selectedTool && isDialogOpen(EditRangeModal);
|
|
47
49
|
function handleOnStopResizing(position) {
|
|
48
50
|
if (!spectrum || !isSpectrum1D(spectrum))
|
|
49
51
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PivotIndicator(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -8,17 +8,21 @@ const styles = {
|
|
|
8
8
|
top: '0px',
|
|
9
9
|
left: '0px',
|
|
10
10
|
width: 1,
|
|
11
|
-
backgroundColor: '
|
|
11
|
+
backgroundColor: 'yellow',
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
export function PivotIndicator() {
|
|
14
14
|
const { height, toolOptions: { selectedTool, data: { pivot }, }, } = useChartData();
|
|
15
15
|
const { scaleX } = useScaleChecked();
|
|
16
16
|
if (options.phaseCorrection.id !== selectedTool)
|
|
17
17
|
return null;
|
|
18
|
+
const x = Math.round(scaleX()(pivot.value));
|
|
19
|
+
return _jsx(Indicator, { height: height, x: x });
|
|
20
|
+
}
|
|
21
|
+
function Indicator(props) {
|
|
22
|
+
const { x, height } = props;
|
|
18
23
|
return (_jsx("div", { style: {
|
|
19
24
|
...styles,
|
|
20
|
-
transform: `translate(${
|
|
25
|
+
transform: `translate(${x}px, 0px)`,
|
|
21
26
|
height,
|
|
22
27
|
} }));
|
|
23
28
|
}
|
|
24
|
-
export default VerticalIndicator;
|
|
@@ -8,13 +8,14 @@ import { MouseTracker } from '../EventsTrackers/MouseTracker';
|
|
|
8
8
|
import { useChartData } from '../context/ChartContext';
|
|
9
9
|
import { useDispatch } from '../context/DispatchContext';
|
|
10
10
|
import { useMapKeyModifiers } from '../context/KeyModifierContext';
|
|
11
|
+
import { usePrintPage } from '../elements/print';
|
|
11
12
|
import Spinner from '../loader/Spinner';
|
|
12
13
|
import { options } from '../toolbar/ToolTypes';
|
|
13
14
|
import { PhaseTraces } from './1d-tracer/phase-correction-traces';
|
|
14
15
|
import Chart2D from './Chart2D';
|
|
15
16
|
import FooterBanner from './FooterBanner';
|
|
16
17
|
import SlicingView from './SlicingView';
|
|
17
|
-
import PivotIndicator from './tools/PivotIndicator';
|
|
18
|
+
import { PivotIndicator } from './tools/PivotIndicator';
|
|
18
19
|
import XYLabelPointer from './tools/XYLabelPointer';
|
|
19
20
|
import { get2DDimensionLayout, getLayoutID } from './utilities/DimensionLayout';
|
|
20
21
|
import { get2DXScale, get2DYScale } from './utilities/scale';
|
|
@@ -159,9 +160,12 @@ function Viewer2D({ emptyText = undefined }) {
|
|
|
159
160
|
export function ViewerResponsiveWrapper(props) {
|
|
160
161
|
const dispatch = useDispatch();
|
|
161
162
|
const { width, height, children } = props;
|
|
163
|
+
const printOptions = usePrintPage();
|
|
162
164
|
useEffect(() => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
if (!printOptions) {
|
|
166
|
+
dispatch({ type: 'SET_DIMENSIONS', payload: { width, height } });
|
|
167
|
+
}
|
|
168
|
+
}, [width, height, dispatch, printOptions]);
|
|
165
169
|
return children;
|
|
166
170
|
}
|
|
167
171
|
export default Viewer2D;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function PivotIndicator(): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
-
export default PivotIndicator;
|
|
1
|
+
export declare function PivotIndicator(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -9,7 +9,7 @@ function getStyle(direction, translate) {
|
|
|
9
9
|
position: 'absolute',
|
|
10
10
|
top: '0px',
|
|
11
11
|
left: '0px',
|
|
12
|
-
backgroundColor: '
|
|
12
|
+
backgroundColor: 'yellow',
|
|
13
13
|
zIndex: 9,
|
|
14
14
|
};
|
|
15
15
|
if (direction === 'horizontal') {
|
|
@@ -27,7 +27,7 @@ function getStyle(direction, translate) {
|
|
|
27
27
|
transform: `translateY(${translate}px)`,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function PivotIndicator() {
|
|
30
|
+
export function PivotIndicator() {
|
|
31
31
|
const { pivot, activeTraceDirection } = useActivePhaseTraces();
|
|
32
32
|
const { toolOptions: { selectedTool }, width, height, margin, yDomain, xDomain, mode, } = useChartData();
|
|
33
33
|
if (options.phaseCorrectionTwoDimensions.id !== selectedTool || !pivot) {
|
|
@@ -44,4 +44,3 @@ function PivotIndicator() {
|
|
|
44
44
|
}
|
|
45
45
|
return _jsx("div", { style: getStyle(activeTraceDirection, translate) });
|
|
46
46
|
}
|
|
47
|
-
export default PivotIndicator;
|
|
@@ -15,7 +15,7 @@ import Signal from './Signal';
|
|
|
15
15
|
const stylesOnHover = css `
|
|
16
16
|
pointer-events: bounding-box;
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
@document url-prefix("") {
|
|
19
19
|
pointer-events: fill;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -28,7 +28,7 @@ const stylesOnHover = css `
|
|
|
28
28
|
const stylesHighlighted = css `
|
|
29
29
|
pointer-events: bounding-box;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
@document url-prefix("") {
|
|
32
32
|
pointer-events: fill;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -8,7 +8,7 @@ import { useDispatch } from '../context/DispatchContext';
|
|
|
8
8
|
import { useLoader } from '../context/LoaderContext';
|
|
9
9
|
import { usePreferences } from '../context/PreferencesContext';
|
|
10
10
|
import { useToaster } from '../context/ToasterContext';
|
|
11
|
-
import {
|
|
11
|
+
import { useAlert } from '../elements/Alert';
|
|
12
12
|
import { HighlightEventSource, useHighlightData } from '../highlight/index';
|
|
13
13
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
14
14
|
import useExport from '../hooks/useExport';
|
|
@@ -21,7 +21,7 @@ function KeysListenerTracker(props) {
|
|
|
21
21
|
const dispatch = useDispatch();
|
|
22
22
|
const { dispatch: dispatchPreferences, current: { nuclei }, } = usePreferences();
|
|
23
23
|
const toaster = useToaster();
|
|
24
|
-
const
|
|
24
|
+
const alert = useAlert();
|
|
25
25
|
const openLoader = useLoader();
|
|
26
26
|
const [isSaveModalOpened, openSaveAsDialog, closeSaveAsDialog] = useOnOff(false);
|
|
27
27
|
const { handleChangeOption, handleFullZoomOut, alignSpectraVerticallyHandler, changeDisplayViewModeHandler, } = useToolsFunctions();
|
|
@@ -131,7 +131,7 @@ function KeysListenerTracker(props) {
|
|
|
131
131
|
const buttons = [
|
|
132
132
|
{
|
|
133
133
|
text: 'Yes, for all spectra',
|
|
134
|
-
|
|
134
|
+
onClick: async () => {
|
|
135
135
|
if (zone) {
|
|
136
136
|
const hideLoading = toaster.showLoading({
|
|
137
137
|
message: 'Delete all spectra exclusion zones in progress',
|
|
@@ -148,7 +148,7 @@ function KeysListenerTracker(props) {
|
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
text: 'Yes',
|
|
151
|
-
|
|
151
|
+
onClick: async () => {
|
|
152
152
|
if (spectrumID) {
|
|
153
153
|
const hideLoading = toaster.showLoading({
|
|
154
154
|
message: 'Delete exclusion zones in progress',
|
|
@@ -166,7 +166,7 @@ function KeysListenerTracker(props) {
|
|
|
166
166
|
},
|
|
167
167
|
{ text: 'No' },
|
|
168
168
|
];
|
|
169
|
-
|
|
169
|
+
alert.showAlert({
|
|
170
170
|
message: 'Are you sure you want to delete the exclusion zone/s?',
|
|
171
171
|
buttons,
|
|
172
172
|
});
|
|
@@ -177,7 +177,7 @@ function KeysListenerTracker(props) {
|
|
|
177
177
|
const buttons = [
|
|
178
178
|
{
|
|
179
179
|
text: 'Yes',
|
|
180
|
-
|
|
180
|
+
onClick: async () => {
|
|
181
181
|
if (zone) {
|
|
182
182
|
const hideLoading = toaster.showLoading({
|
|
183
183
|
message: 'Delete all spectra exclusion zones in progress',
|
|
@@ -195,7 +195,7 @@ function KeysListenerTracker(props) {
|
|
|
195
195
|
},
|
|
196
196
|
{ text: 'No' },
|
|
197
197
|
];
|
|
198
|
-
|
|
198
|
+
alert.showAlert({
|
|
199
199
|
message: 'Are you sure you want to delete the Matrix generation exclusion zones?',
|
|
200
200
|
buttons,
|
|
201
201
|
});
|
|
@@ -241,7 +241,7 @@ function KeysListenerTracker(props) {
|
|
|
241
241
|
dispatch,
|
|
242
242
|
remove,
|
|
243
243
|
assignmentData,
|
|
244
|
-
|
|
244
|
+
alert,
|
|
245
245
|
toaster,
|
|
246
246
|
dispatchPreferences,
|
|
247
247
|
activeTab,
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { produce } from 'immer';
|
|
1
2
|
import { createContext, useContext } from 'react';
|
|
3
|
+
import { usePrintPage } from '../elements/print';
|
|
2
4
|
import { initialState } from '../reducer/Reducer';
|
|
3
5
|
export const ChartContext = createContext(initialState);
|
|
4
6
|
export const ChartDataProvider = ChartContext.Provider;
|
|
5
7
|
export function useChartData() {
|
|
6
|
-
|
|
8
|
+
const data = useContext(ChartContext);
|
|
9
|
+
const printOptions = usePrintPage();
|
|
10
|
+
if (!printOptions)
|
|
11
|
+
return data;
|
|
12
|
+
const { width, height } = printOptions;
|
|
13
|
+
const updatedData = produce(data, (draft) => {
|
|
14
|
+
draft.width = width;
|
|
15
|
+
draft.height = height;
|
|
16
|
+
});
|
|
17
|
+
return updatedData;
|
|
7
18
|
}
|
|
@@ -4,7 +4,7 @@ interface ShareDataState<T> {
|
|
|
4
4
|
setData: (data: T) => void;
|
|
5
5
|
}
|
|
6
6
|
export declare function useShareData<T>(): ShareDataState<T>;
|
|
7
|
-
export declare function ShareDataProvider
|
|
7
|
+
export declare function ShareDataProvider({ children }: {
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -8,14 +8,12 @@ export function useShareData() {
|
|
|
8
8
|
}
|
|
9
9
|
return context;
|
|
10
10
|
}
|
|
11
|
-
export function ShareDataProvider({ children
|
|
11
|
+
export function ShareDataProvider({ children }) {
|
|
12
12
|
const [data, setData] = useState(null);
|
|
13
13
|
const state = useMemo(() => {
|
|
14
14
|
return {
|
|
15
15
|
data,
|
|
16
|
-
setData
|
|
17
|
-
setData(newData);
|
|
18
|
-
},
|
|
16
|
+
setData,
|
|
19
17
|
};
|
|
20
18
|
}, [data]);
|
|
21
19
|
return (_jsx(ShareDataContext.Provider, { value: state, children: children }));
|
|
@@ -3,6 +3,7 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
interface ToasterContextProps {
|
|
4
4
|
toaster: OverlayToaster | null;
|
|
5
5
|
showLoading: (options: ToastProps) => () => void;
|
|
6
|
+
showAsyncLoading: (options: ToastProps) => Promise<() => void>;
|
|
6
7
|
show: (options: ToastProps) => void;
|
|
7
8
|
}
|
|
8
9
|
export declare function useToaster(): ToasterContextProps;
|
|
@@ -22,13 +22,22 @@ export function ToasterProvider({ children }) {
|
|
|
22
22
|
timeout: 0,
|
|
23
23
|
...otherProps,
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
function dismiss() {
|
|
26
26
|
if (toastKey) {
|
|
27
27
|
toasterRef.current?.dismiss(toastKey);
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
|
+
return dismiss;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
function showAsyncLoading(options) {
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
const hideLoading = showLoading(options);
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
resolve(hideLoading);
|
|
37
|
+
}, 100);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return { toaster: toasterRef.current, showLoading, showAsyncLoading, show };
|
|
32
41
|
}, []);
|
|
33
42
|
return (_jsxs(_Fragment, { children: [_jsx(OverlayToaster, { className: Classes.DARK, position: Position.BOTTOM, ref: toasterRef }), _jsx(ToasterContext.Provider, { value: toaster, children: children })] }));
|
|
34
43
|
}
|
|
@@ -17,9 +17,7 @@ export function ActionsButtonsPopover(props) {
|
|
|
17
17
|
}
|
|
18
18
|
`, children: buttons
|
|
19
19
|
.filter((button) => button?.visible !== false)
|
|
20
|
-
.map(({ title, ...otherProps }, index, array) => (_jsxs(Fragment, { children: [_jsx(Button, { tooltipProps: { content: title || '', compact: true }, ...otherProps }), index < array.length - 1 && (
|
|
21
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
22
|
-
_jsx("div", { style: {
|
|
20
|
+
.map(({ title, visible, ...otherProps }, index, array) => (_jsxs(Fragment, { children: [_jsx(Button, { tooltipProps: { content: title || '', compact: true }, ...otherProps }), index < array.length - 1 && (_jsx("div", { style: {
|
|
23
21
|
margin: direction === 'row' ? `0 ${space}px` : `${space}px 0`,
|
|
24
22
|
} }, `spacer-${index}`))] }, title || index))) }), ...otherProps, children: children }));
|
|
25
23
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { ButtonProps } from '@blueprintjs/core';
|
|
3
|
+
import React, { ReactNode } from 'react';
|
|
4
|
+
export interface AlertButton extends ButtonProps {
|
|
5
|
+
text: ReactNode;
|
|
6
|
+
preventClose?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface AlertConfig {
|
|
9
|
+
message: ReactNode;
|
|
10
|
+
buttons: AlertButton[];
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}
|
|
13
|
+
interface AlertContextType {
|
|
14
|
+
showAlert: (config: AlertConfig) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function useAlert(): AlertContextType;
|
|
17
|
+
export declare const AlertProvider: React.FC<{
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @emotion/react */
|
|
3
|
+
import { Button, Dialog, DialogBody, DialogFooter, } from '@blueprintjs/core';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import { v4 } from '@lukeed/uuid';
|
|
6
|
+
import { createContext, useState, useContext, useMemo, } from 'react';
|
|
7
|
+
const Message = styled.p `
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
text-align: center;
|
|
11
|
+
color: #af0000;
|
|
12
|
+
`;
|
|
13
|
+
const Footer = styled(DialogFooter) `
|
|
14
|
+
button {
|
|
15
|
+
margin: 0 3px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
button:first-of-type {
|
|
19
|
+
margin-right: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
button:last-of-type {
|
|
23
|
+
margin-left: 0;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const ButtonsGroup = styled.div `
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: row-reverse;
|
|
29
|
+
`;
|
|
30
|
+
const Body = styled(DialogBody) `
|
|
31
|
+
background-color: white;
|
|
32
|
+
padding: 25px;
|
|
33
|
+
|
|
34
|
+
p {
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const Alert = styled(Dialog) `
|
|
39
|
+
border-top: 10px solid rgb(237 0 0);
|
|
40
|
+
`;
|
|
41
|
+
const AlertContext = createContext(null);
|
|
42
|
+
export function useAlert() {
|
|
43
|
+
const context = useContext(AlertContext);
|
|
44
|
+
if (!context) {
|
|
45
|
+
throw new Error('Alert context was not found');
|
|
46
|
+
}
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
export const AlertProvider = ({ children, }) => {
|
|
50
|
+
const [alerts, setAlerts] = useState([]);
|
|
51
|
+
function hideAlert(id) {
|
|
52
|
+
setAlerts((prevAlerts) => prevAlerts.filter((alert) => alert.id !== id));
|
|
53
|
+
}
|
|
54
|
+
const alertState = useMemo(() => {
|
|
55
|
+
function showAlert(config) {
|
|
56
|
+
const id = v4();
|
|
57
|
+
setAlerts((prevAlerts) => [...prevAlerts, { id, ...config }]);
|
|
58
|
+
}
|
|
59
|
+
return { showAlert };
|
|
60
|
+
}, []);
|
|
61
|
+
return (_jsxs(_Fragment, { children: [_jsx(Alerts, { alerts: alerts, onHide: hideAlert }), _jsx(AlertContext.Provider, { value: alertState, children: children })] }));
|
|
62
|
+
};
|
|
63
|
+
function Alerts(props) {
|
|
64
|
+
const { alerts, onHide } = props;
|
|
65
|
+
function optionsHandler(e, options) {
|
|
66
|
+
const { onClick = () => null, preventClose = false, id } = options;
|
|
67
|
+
onClick(e);
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
if (!preventClose) {
|
|
70
|
+
onHide(id);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return alerts.map(({ id, buttons, message, onClose }) => (_jsxs(Alert, { isOpen: true, onClose: () => {
|
|
74
|
+
onHide(id);
|
|
75
|
+
onClose?.();
|
|
76
|
+
}, role: "alertdialog", children: [_jsx(Body, { children: _jsx(Message, { className: "message", children: message }) }), _jsx(Footer, { children: _jsx(ButtonsGroup, { children: buttons.map((item, index) => {
|
|
77
|
+
const { text, onClick, preventClose, ...otherItemProps } = item;
|
|
78
|
+
return (_jsx(Button, { onClick: (e) => optionsHandler(e, { onClick, preventClose, id }), ...otherItemProps, children: text }, index));
|
|
79
|
+
}) }) })] }, id)));
|
|
80
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ContextMenuProps as BluePrintContextMenuProps, MenuItemProps } from '@blueprintjs/core';
|
|
1
|
+
import { ContextMenuProps as BluePrintContextMenuProps, MenuItemProps, TooltipProps } from '@blueprintjs/core';
|
|
2
2
|
import { ComponentProps, ElementType, ReactNode } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type ContextMenuCheck = boolean | ((data: any) => boolean);
|
|
4
|
+
export interface ContextMenuItem extends Omit<MenuItemProps, 'disabled'> {
|
|
4
5
|
data?: object;
|
|
6
|
+
tooltip?: TooltipProps;
|
|
7
|
+
disabled?: ContextMenuCheck;
|
|
8
|
+
visible?: ContextMenuCheck;
|
|
5
9
|
}
|
|
6
10
|
type ElementProps<E = 'div'> = E extends ElementType ? ComponentProps<E> : never;
|
|
7
11
|
export interface BaseContextMenuProps {
|
|
@@ -11,6 +15,7 @@ export interface BaseContextMenuProps {
|
|
|
11
15
|
export interface ContextMenuProps<E> extends BaseContextMenuProps, Omit<BluePrintContextMenuProps, 'onSelect' | 'content' | 'children'> {
|
|
12
16
|
as?: E;
|
|
13
17
|
children: ReactNode;
|
|
18
|
+
data?: any;
|
|
14
19
|
}
|
|
15
20
|
export declare function ContextMenu<E extends ElementType = 'div'>(props: ContextMenuProps<E> & ElementProps<E>): import("react/jsx-runtime").JSX.Element;
|
|
16
21
|
export {};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Menu, MenuItem, showContextMenu, } from '@blueprintjs/core';
|
|
2
|
+
import { Menu, MenuItem, showContextMenu, Tooltip, } from '@blueprintjs/core';
|
|
3
3
|
export function ContextMenu(props) {
|
|
4
|
-
const { options, onSelect, children, as: Wrapper = 'div', ...other } = props;
|
|
4
|
+
const { options, onSelect, children, as: Wrapper = 'div', data, ...other } = props;
|
|
5
5
|
function handleContextMenu(event) {
|
|
6
6
|
if (!Array.isArray(options) || options.length === 0) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
const content = (_jsx(Menu, { children: options
|
|
9
|
+
const content = (_jsx(Menu, { children: options
|
|
10
|
+
.filter(({ visible = true }) => typeof visible === 'function' ? visible(data) : visible)
|
|
11
|
+
.map(({ tooltip = {}, ...options }) => {
|
|
12
|
+
const { disabled = false, visible, ...otherOptions } = options;
|
|
13
|
+
const isDisabled = typeof disabled === 'function' ? disabled(data) : disabled;
|
|
14
|
+
return (_jsx(Tooltip, { disabled: !tooltip?.content, renderTarget: ({ isOpen, ...targetProps }) => (_jsx("div", { ...targetProps, children: _jsx(MenuItem, { disabled: isDisabled, ...otherOptions, onClick: () => onSelect(otherOptions?.data) }) })), ...tooltip }, otherOptions.text));
|
|
15
|
+
}) }));
|
|
10
16
|
event.preventDefault();
|
|
11
17
|
showContextMenu({
|
|
12
18
|
content,
|