nmrium 0.20.1 → 0.22.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/ExclusionZonesAnnotations.js +1 -2
- package/lib/component/1d/Integral.js +1 -6
- package/lib/component/1d/Viewer1D.js +4 -4
- package/lib/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib/component/1d/utilities/scale.d.ts +1 -1
- package/lib/component/1d/utilities/scale.js +7 -6
- package/lib/component/2d/Viewer2D.js +5 -5
- package/lib/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib/component/NMRium.d.ts +9 -2
- package/lib/component/NMRium.js +9 -9
- package/lib/component/elements/EditableColumn.d.ts +1 -1
- package/lib/component/elements/NumberInput.d.ts +1 -2
- package/lib/component/elements/Tab/Tab.js +1 -0
- package/lib/component/header/Header.js +13 -10
- package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
- package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
- package/lib/component/{1d/utilities → hooks}/useIntegralPath.d.ts +0 -0
- package/lib/component/hooks/useIntegralPath.js +53 -0
- package/lib/component/hooks/useToolsFunctions.js +6 -6
- package/lib/component/hooks/useXScale.d.ts +2 -0
- package/lib/component/hooks/useXScale.js +7 -0
- package/lib/component/loader/DropZone.js +88 -88
- package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib/component/modal/editZone/EditPathLengthFormik.d.ts +5 -0
- package/lib/component/modal/editZone/EditPathLengthFormik.js +72 -0
- package/lib/component/modal/editZone/EditZoneModal.d.ts +8 -0
- package/lib/component/modal/editZone/EditZoneModal.js +96 -0
- package/lib/component/modal/editZone/SignalFormTab.d.ts +6 -0
- package/lib/component/modal/editZone/SignalFormTab.js +6 -0
- package/lib/component/modal/editZone/SignalsForm.d.ts +2 -0
- package/lib/component/modal/editZone/SignalsForm.js +62 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.d.ts +534 -0
- package/lib/component/modal/editZone/validation/EditZoneValidation.js +17 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.d.ts +3 -0
- package/lib/component/modal/editZone/validation/isDefaultPathLength.js +7 -0
- package/lib/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.d.ts +1 -2
- package/lib/component/modal/setting/GeneralSettings.js +13 -9
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.d.ts +2 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +13 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +7 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +38 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/Panels.d.ts +1 -1
- package/lib/component/panels/Panels.js +10 -14
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
- package/lib/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.d.ts +1 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -7
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.d.ts +2 -3
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +24 -30
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +8 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +89 -0
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +6 -6
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +40 -43
- package/lib/component/panels/SummaryPanel/utilities/IsInView.d.ts +6 -0
- package/lib/component/panels/SummaryPanel/utilities/IsInView.js +16 -0
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +29 -0
- package/lib/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +155 -19
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.d.ts +1 -0
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +26 -3
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
- package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +3 -2
- package/lib/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
- package/lib/component/reducer/IgnoreActions.js +2 -1
- package/lib/component/reducer/Reducer.d.ts +20 -34
- package/lib/component/reducer/Reducer.js +7 -8
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- package/lib/component/reducer/actions/DatabaseActions.js +1 -1
- package/lib/component/reducer/actions/DomainActions.d.ts +3 -1
- package/lib/component/reducer/actions/DomainActions.js +20 -1
- package/lib/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib/component/reducer/actions/LoadActions.js +22 -1
- package/lib/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib/component/reducer/actions/RangesActions.js +3 -1
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +43 -56
- package/lib/component/reducer/actions/ZonesActions.d.ts +3 -1
- package/lib/component/reducer/actions/ZonesActions.js +33 -2
- package/lib/component/reducer/helper/Zoom1DManager.d.ts +17 -21
- package/lib/component/reducer/helper/Zoom1DManager.js +53 -69
- package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
- package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib/component/reducer/preferencesReducer.d.ts +3 -8
- package/lib/component/reducer/preferencesReducer.js +87 -37
- package/lib/component/reducer/types/Types.d.ts +3 -1
- package/lib/component/reducer/types/Types.js +3 -1
- package/lib/component/toolbar/FunctionToolBar.js +7 -10
- package/lib/component/toolbar/ToolTypes.js +3 -3
- package/lib/component/workspaces/Workspace.d.ts +6 -0
- package/lib/component/workspaces/Workspace.js +1 -0
- package/lib/component/workspaces/basic.d.ts +2 -0
- package/lib/component/workspaces/basic.js +45 -0
- package/lib/component/workspaces/exercise1D.d.ts +2 -0
- package/lib/component/workspaces/exercise1D.js +45 -0
- package/lib/component/workspaces/index.d.ts +6 -0
- package/lib/component/workspaces/index.js +4 -0
- package/lib/component/workspaces/process1D.d.ts +2 -0
- package/lib/component/workspaces/process1D.js +43 -0
- package/lib/data/constants/DefaultPathLengths.d.ts +6 -0
- package/lib/data/constants/DefaultPathLengths.js +8 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +4 -0
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +11 -0
- package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +11 -0
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +9 -0
- package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +7 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +29 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -0
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +14 -0
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib/data/migration/MigrationManager.js +3 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
- package/lib-cjs/component/1d/Integral.js +1 -6
- package/lib-cjs/component/1d/Viewer1D.js +4 -4
- package/lib-cjs/component/1d/ranges/RangeIntegral.js +2 -6
- package/lib-cjs/component/1d/utilities/scale.js +7 -6
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +98 -81
- package/lib-cjs/component/NMRium.js +10 -10
- package/lib-cjs/component/elements/Tab/Tab.js +1 -0
- package/lib-cjs/component/header/Header.js +13 -10
- package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
- package/lib-cjs/component/hooks/useIntegralPath.js +56 -0
- package/lib-cjs/component/hooks/useToolsFunctions.js +6 -6
- package/lib-cjs/component/hooks/useXScale.js +11 -0
- package/lib-cjs/component/loader/DropZone.js +88 -88
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +1 -1
- package/lib-cjs/component/modal/editZone/EditPathLengthFormik.js +77 -0
- package/lib-cjs/component/modal/editZone/EditZoneModal.js +101 -0
- package/lib-cjs/component/modal/editZone/SignalFormTab.js +11 -0
- package/lib-cjs/component/modal/editZone/SignalsForm.js +67 -0
- package/lib-cjs/component/modal/editZone/validation/EditZoneValidation.js +38 -0
- package/lib-cjs/component/modal/editZone/validation/isDefaultPathLength.js +12 -0
- package/lib-cjs/component/modal/setting/ControllersTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralSettings.js +12 -8
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +18 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +43 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
- package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/Panels.js +11 -15
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -5
- package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +7 -2
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/Constants.js +1 -8
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +4 -5
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +21 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +43 -30
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +94 -0
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +38 -41
- package/lib-cjs/component/panels/SummaryPanel/utilities/IsInView.js +18 -0
- package/lib-cjs/component/panels/SummaryPanel/{Utilities.js → utilities/Utilities.js} +157 -19
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +24 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +12 -7
- package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +5 -2
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
- package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
- package/lib-cjs/component/reducer/IgnoreActions.js +2 -1
- package/lib-cjs/component/reducer/Reducer.js +7 -8
- package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -2
- package/lib-cjs/component/reducer/actions/DomainActions.js +21 -1
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +2 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +22 -1
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +0 -2
- package/lib-cjs/component/reducer/actions/RangesActions.js +2 -0
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +2 -2
- package/lib-cjs/component/reducer/actions/ToolsActions.js +50 -63
- package/lib-cjs/component/reducer/actions/ZonesActions.js +35 -2
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +55 -73
- package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
- package/lib-cjs/component/reducer/preferencesReducer.js +87 -37
- package/lib-cjs/component/reducer/types/Types.js +6 -4
- package/lib-cjs/component/toolbar/FunctionToolBar.js +7 -10
- package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
- package/lib-cjs/component/workspaces/Workspace.js +2 -0
- package/lib-cjs/component/workspaces/basic.js +48 -0
- package/lib-cjs/component/workspaces/exercise1D.js +48 -0
- package/lib-cjs/component/workspaces/index.js +6 -0
- package/lib-cjs/component/workspaces/process1D.js +46 -0
- package/lib-cjs/data/constants/DefaultPathLengths.js +10 -0
- package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +8 -0
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +7 -19
- package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +18 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +2 -21
- package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +14 -0
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +36 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +21 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +13 -8
- package/lib-cjs/data/migration/MigrationManager.js +3 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +15 -16
- package/lib/component/1d/utilities/useIntegralPath.js +0 -63
- package/lib/component/nmriumMode/basic.d.ts +0 -38
- package/lib/component/nmriumMode/basic.js +0 -37
- package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
- package/lib/component/nmriumMode/exercise1D.js +0 -37
- package/lib/component/nmriumMode/process1D.d.ts +0 -38
- package/lib/component/nmriumMode/process1D.js +0 -37
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +0 -25
- package/lib/component/reducer/actions/Zoom.d.ts +0 -16
- package/lib/component/reducer/actions/Zoom.js +0 -92
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +0 -66
- package/lib-cjs/component/nmriumMode/basic.js +0 -39
- package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
- package/lib-cjs/component/nmriumMode/process1D.js +0 -39
- package/lib-cjs/component/reducer/actions/Zoom.js +0 -116
|
@@ -17,7 +17,7 @@ const Constants_1 = require("../reducer/core/Constants");
|
|
|
17
17
|
const Types_1 = require("../reducer/types/Types");
|
|
18
18
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
19
19
|
function KeysListenerTracker() {
|
|
20
|
-
const { keysPreferences, displayerMode, overDisplayer, data } = (0, ChartContext_1.useChartData)();
|
|
20
|
+
const { keysPreferences, displayerMode, overDisplayer, data, activeSpectrum, } = (0, ChartContext_1.useChartData)();
|
|
21
21
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
22
22
|
const alert = (0, Alert_1.useAlert)();
|
|
23
23
|
const openLoader = (0, LoaderContext_1.useLoader)();
|
|
@@ -28,9 +28,6 @@ function KeysListenerTracker() {
|
|
|
28
28
|
const allow1DTool = (0, react_1.useMemo)(() => {
|
|
29
29
|
return displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && data && data.length > 0;
|
|
30
30
|
}, [data, displayerMode]);
|
|
31
|
-
const allow2DTool = (0, react_1.useMemo)(() => {
|
|
32
|
-
return displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && data && data.length > 0;
|
|
33
|
-
}, [data, displayerMode]);
|
|
34
31
|
const deleteHandler = (0, react_1.useCallback)(async (sourceData) => {
|
|
35
32
|
const { type, extra: { id }, } = sourceData;
|
|
36
33
|
switch (type) {
|
|
@@ -125,106 +122,126 @@ function KeysListenerTracker() {
|
|
|
125
122
|
}
|
|
126
123
|
}, [alert, data, dispatch, keysPreferences]);
|
|
127
124
|
const toolsListenerHandler = (0, react_1.useCallback)((e) => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
125
|
+
function check1DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
126
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_1D && !activeSpectrum) {
|
|
127
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
128
|
+
}
|
|
129
|
+
else if (checkSwitch && displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
130
|
+
throw new Error(`Switch to 1D Mode and select a spectrum to proceed with ${label}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function check2DModeWithActiveSpectrum(label, checkSwitch = true) {
|
|
134
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D && !activeSpectrum) {
|
|
135
|
+
throw new Error(`Select a spectrum to proceed with ${label}`);
|
|
136
|
+
}
|
|
137
|
+
else if (checkSwitch && displayerMode === Constants_1.DISPLAYER_MODE.DM_1D) {
|
|
138
|
+
throw new Error(`Switch to 2D Mode and select a spectrum to proceed with ${label}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
if (!e.shiftKey && !e.metaKey) {
|
|
143
|
+
switch (e.key) {
|
|
144
|
+
case 'f':
|
|
145
|
+
handleFullZoomOut();
|
|
146
|
+
break;
|
|
147
|
+
case 'z':
|
|
148
|
+
case 'Escape':
|
|
149
|
+
handleChangeOption(ToolTypes_1.options.zoom.id);
|
|
150
|
+
break;
|
|
151
|
+
case 'r': {
|
|
152
|
+
if (displayerMode === Constants_1.DISPLAYER_MODE.DM_2D) {
|
|
153
|
+
check2DModeWithActiveSpectrum(ToolTypes_1.options.zone2D.label, false);
|
|
154
|
+
handleChangeOption(ToolTypes_1.options.zone2D.id);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.rangesPicking.label, false);
|
|
158
|
+
handleChangeOption(ToolTypes_1.options.rangesPicking.id);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
case 'a': {
|
|
163
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.phaseCorrection.label);
|
|
148
164
|
handleChangeOption(ToolTypes_1.options.phaseCorrection.id);
|
|
165
|
+
break;
|
|
149
166
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
case 'b': {
|
|
153
|
-
if (allow1DTool) {
|
|
167
|
+
case 'b': {
|
|
168
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.baseLineCorrection.label);
|
|
154
169
|
handleChangeOption(ToolTypes_1.options.baseLineCorrection.id);
|
|
170
|
+
break;
|
|
155
171
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
case 'p': {
|
|
159
|
-
if (allow1DTool) {
|
|
172
|
+
case 'p': {
|
|
173
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.peakPicking.label);
|
|
160
174
|
handleChangeOption(ToolTypes_1.options.peakPicking.id);
|
|
175
|
+
break;
|
|
161
176
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
case 'i': {
|
|
165
|
-
if (allow1DTool) {
|
|
177
|
+
case 'i': {
|
|
178
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.integral.label);
|
|
166
179
|
handleChangeOption(ToolTypes_1.options.integral.id);
|
|
180
|
+
break;
|
|
167
181
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
case 'e': {
|
|
171
|
-
if (allow1DTool) {
|
|
182
|
+
case 'e': {
|
|
183
|
+
check1DModeWithActiveSpectrum(ToolTypes_1.options.exclusionZones.label);
|
|
172
184
|
handleChangeOption(ToolTypes_1.options.exclusionZones.id);
|
|
185
|
+
break;
|
|
173
186
|
}
|
|
174
|
-
|
|
187
|
+
default:
|
|
175
188
|
}
|
|
176
|
-
default:
|
|
177
189
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
190
|
+
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
191
|
+
switch (e.key) {
|
|
192
|
+
case 'c': {
|
|
193
|
+
if (allow1DTool) {
|
|
194
|
+
alignSpectrumsVerticallyHandler();
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
184
197
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
198
|
+
case 's': {
|
|
199
|
+
if (allow1DTool) {
|
|
200
|
+
changeDisplayViewModeHandler();
|
|
201
|
+
}
|
|
202
|
+
break;
|
|
190
203
|
}
|
|
191
|
-
|
|
204
|
+
default:
|
|
192
205
|
}
|
|
193
|
-
default:
|
|
194
206
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
if (!e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
208
|
+
switch (e.key) {
|
|
209
|
+
case 'c':
|
|
210
|
+
void saveToClipboardHandler();
|
|
211
|
+
e.preventDefault();
|
|
212
|
+
break;
|
|
213
|
+
case 's':
|
|
214
|
+
void saveAsJSONHandler();
|
|
215
|
+
e.preventDefault();
|
|
216
|
+
break;
|
|
217
|
+
case 'o':
|
|
218
|
+
openLoader();
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
}
|
|
211
223
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
224
|
+
if (e.shiftKey && (e.metaKey || e.ctrlKey)) {
|
|
225
|
+
switch (e.key) {
|
|
226
|
+
case 's':
|
|
227
|
+
case 'S':
|
|
228
|
+
void saveAsHandler();
|
|
229
|
+
e.preventDefault();
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
}
|
|
221
233
|
}
|
|
222
234
|
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
alert.error(e.message);
|
|
237
|
+
}
|
|
223
238
|
}, [
|
|
239
|
+
activeSpectrum,
|
|
240
|
+
alert,
|
|
224
241
|
alignSpectrumsVerticallyHandler,
|
|
225
242
|
allow1DTool,
|
|
226
|
-
allow2DTool,
|
|
227
243
|
changeDisplayViewModeHandler,
|
|
244
|
+
displayerMode,
|
|
228
245
|
handleChangeOption,
|
|
229
246
|
handleFullZoomOut,
|
|
230
247
|
openLoader,
|
|
@@ -22,7 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.NMRiumWorkspaces = void 0;
|
|
26
26
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
27
27
|
/** @jsxImportSource @emotion/react */
|
|
28
28
|
const react_1 = require("@emotion/react");
|
|
@@ -121,12 +121,12 @@ const containerStyles = (0, react_1.css) `
|
|
|
121
121
|
border-right: 0.55px #bbbbbb solid;
|
|
122
122
|
}
|
|
123
123
|
`;
|
|
124
|
-
var
|
|
125
|
-
(function (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})(
|
|
124
|
+
var NMRiumWorkspaces;
|
|
125
|
+
(function (NMRiumWorkspaces) {
|
|
126
|
+
NMRiumWorkspaces["EXERCISE_1D"] = "exercise1D";
|
|
127
|
+
NMRiumWorkspaces["PROCESS_1D"] = "process1D";
|
|
128
|
+
NMRiumWorkspaces["DEFAULT"] = "default";
|
|
129
|
+
})(NMRiumWorkspaces = exports.NMRiumWorkspaces || (exports.NMRiumWorkspaces = {}));
|
|
130
130
|
const defaultPreferences = {};
|
|
131
131
|
const defaultData = {
|
|
132
132
|
spectra: [],
|
|
@@ -134,7 +134,7 @@ const defaultData = {
|
|
|
134
134
|
function NMRium(props) {
|
|
135
135
|
return ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.RootLayout, { style: { width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_error_boundary_1.ErrorBoundary, { FallbackComponent: ErrorOverlay_1.default, children: (0, jsx_runtime_1.jsx)(InnerNMRium, { ...props }, void 0) }, void 0) }, void 0));
|
|
136
136
|
}
|
|
137
|
-
function InnerNMRium({ data: dataProp = defaultData,
|
|
137
|
+
function InnerNMRium({ data: dataProp = defaultData, workspace = NMRiumWorkspaces.DEFAULT, preferences = defaultPreferences, getSpinner = SpinnerContext_1.defaultGetSpinner, onDataChange, emptyText, }) {
|
|
138
138
|
const rootRef = (0, react_2.useRef)(null);
|
|
139
139
|
const elementsWraperRef = (0, react_2.useRef)(null);
|
|
140
140
|
const [show, toggle] = (0, react_use_1.useToggle)(false);
|
|
@@ -162,11 +162,11 @@ function InnerNMRium({ data: dataProp = defaultData, mode = NMRiumMode.DEFAULT,
|
|
|
162
162
|
type: preferencesReducer_1.INIT_PREFERENCES,
|
|
163
163
|
payload: {
|
|
164
164
|
display: preferences,
|
|
165
|
-
|
|
165
|
+
workspace,
|
|
166
166
|
dispatch: dispatchPreferences,
|
|
167
167
|
},
|
|
168
168
|
});
|
|
169
|
-
}, [preferences,
|
|
169
|
+
}, [preferences, workspace]);
|
|
170
170
|
(0, react_2.useEffect)(() => {
|
|
171
171
|
dispatchMiddleWare({ type: Types_1.SET_LOADING_FLAG, isLoading: true });
|
|
172
172
|
if (dataProp) {
|
|
@@ -20,6 +20,7 @@ const styles = (styles) => (0, react_1.css) `
|
|
|
20
20
|
|
|
21
21
|
${styles}
|
|
22
22
|
`;
|
|
23
|
+
/* eslint-enable react/no-unused-prop-types */
|
|
23
24
|
function InternalTab({ tabid, tablabel, isActive, onClick = () => null, canDelete, onDelete = () => null, tabstyles, render, }) {
|
|
24
25
|
let className = 'tab-list-item';
|
|
25
26
|
// use tab identifier if given (higher priority)
|
|
@@ -10,7 +10,7 @@ const react_1 = require("react");
|
|
|
10
10
|
const fa_1 = require("react-icons/fa");
|
|
11
11
|
const constants_1 = require("../../constants");
|
|
12
12
|
const ChartContext_1 = require("../context/ChartContext");
|
|
13
|
-
const
|
|
13
|
+
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
14
14
|
const Modal_1 = require("../elements/popup/Modal");
|
|
15
15
|
const AboutUsModal_1 = __importDefault(require("../modal/AboutUsModal"));
|
|
16
16
|
const GeneralSettings_1 = __importDefault(require("../modal/setting/GeneralSettings"));
|
|
@@ -22,8 +22,7 @@ const RangesPickingOptionPanel_1 = __importDefault(require("./RangesPickingOptio
|
|
|
22
22
|
const ZeroFillingOptionsPanel_1 = __importDefault(require("./ZeroFillingOptionsPanel"));
|
|
23
23
|
const Zones2DOptionPanel_1 = __importDefault(require("./Zones2DOptionPanel"));
|
|
24
24
|
function HeaderInner(props) {
|
|
25
|
-
const { isFullscreen, onMaximize = () => null, selectedOptionPanel } = props;
|
|
26
|
-
const alert = (0, Alert_1.useAlert)();
|
|
25
|
+
const { isFullscreen, onMaximize = () => null, selectedOptionPanel, hideGeneralSettings, } = props;
|
|
27
26
|
const modal = (0, Modal_1.useModal)();
|
|
28
27
|
const selectedPanel = (0, react_1.useMemo)(() => {
|
|
29
28
|
switch (selectedOptionPanel) {
|
|
@@ -44,15 +43,13 @@ function HeaderInner(props) {
|
|
|
44
43
|
}
|
|
45
44
|
}, [selectedOptionPanel]);
|
|
46
45
|
const openGeneralSettingsHandler = (0, react_1.useCallback)(() => {
|
|
47
|
-
modal.show((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, {
|
|
48
|
-
alert.success('Settings saved successfully');
|
|
49
|
-
modal.close();
|
|
50
|
-
} }, void 0), {
|
|
46
|
+
modal.show((0, jsx_runtime_1.jsx)(GeneralSettings_1.default, {}, void 0), {
|
|
51
47
|
position: Modal_1.positions.TOP_CENTER,
|
|
52
48
|
enableResizing: true,
|
|
53
49
|
width: 600,
|
|
50
|
+
height: 400,
|
|
54
51
|
});
|
|
55
|
-
}, [
|
|
52
|
+
}, [modal]);
|
|
56
53
|
const openAboutUs = (0, react_1.useCallback)(() => {
|
|
57
54
|
modal.show((0, jsx_runtime_1.jsx)(AboutUsModal_1.default, {}, void 0), {
|
|
58
55
|
isBackgroundBlur: false,
|
|
@@ -69,11 +66,17 @@ function HeaderInner(props) {
|
|
|
69
66
|
display: 'flex',
|
|
70
67
|
alignItems: 'center',
|
|
71
68
|
justifyContent: 'center',
|
|
72
|
-
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}, void 0) }, void 0), (0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}, void 0) }, void 0), !isFullscreen && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
69
|
+
}, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgLogoNmrium, {}, void 0) }, void 0) }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)("div", { className: "toolOptionsPanel", children: selectedPanel }, void 0)] }, void 0), (0, jsx_runtime_1.jsxs)(analysis_ui_components_1.Toolbar, { orientation: "horizontal", children: [(0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "user-manual", title: "User manual", onClick: () => window.open(constants_1.docsBaseUrl, '_blank'), children: (0, jsx_runtime_1.jsx)(fa_1.FaQuestionCircle, {}, void 0) }, void 0), !hideGeneralSettings && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "general-settings", onClick: openGeneralSettingsHandler, title: "General settings", children: (0, jsx_runtime_1.jsx)(fa_1.FaWrench, {}, void 0) }, void 0)), !isFullscreen && ((0, jsx_runtime_1.jsx)(analysis_ui_components_1.Toolbar.Item, { id: "full-screen", onClick: onMaximize, title: "Full Screen", className: "windowButton", children: (0, jsx_runtime_1.jsx)(fa_1.FaRegWindowMaximize, {}, void 0) }, void 0))] }, void 0)] }, void 0));
|
|
73
70
|
}
|
|
74
71
|
const MemoizedHeader = (0, react_1.memo)(HeaderInner);
|
|
75
72
|
function HeaderWrapper({ isFullscreen, onMaximize }) {
|
|
76
73
|
const { toolOptions: { selectedOptionPanel }, } = (0, ChartContext_1.useChartData)();
|
|
77
|
-
|
|
74
|
+
const { display: { general }, } = (0, PreferencesContext_1.usePreferences)();
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)(MemoizedHeader, { ...{
|
|
76
|
+
selectedOptionPanel,
|
|
77
|
+
isFullscreen,
|
|
78
|
+
onMaximize,
|
|
79
|
+
hideGeneralSettings: general?.hideGeneralSettings || false,
|
|
80
|
+
} }, void 0));
|
|
78
81
|
}
|
|
79
82
|
exports.default = HeaderWrapper;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
3
7
|
const react_1 = require("react");
|
|
4
8
|
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
5
9
|
function useCheckExperimentalFeature() {
|
|
6
10
|
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
7
11
|
return (0, react_1.useMemo)(() => {
|
|
8
|
-
return !preferences
|
|
12
|
+
return !(0, get_1.default)(preferences, 'display.general.hideExperimentalFeatures', false);
|
|
9
13
|
}, [preferences]);
|
|
10
14
|
}
|
|
11
15
|
exports.default = useCheckExperimentalFeature;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
exports.useCheckToolsVisibility = void 0;
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const PreferencesContext_1 = require("../context/PreferencesContext");
|
|
9
|
+
function useCheckToolsVisibility() {
|
|
10
|
+
const preferences = (0, PreferencesContext_1.usePreferences)();
|
|
11
|
+
return (toolKey) => !(0, get_1.default)(preferences, `display.toolBarButtons.${toolKey}`, false);
|
|
12
|
+
}
|
|
13
|
+
exports.useCheckToolsVisibility = useCheckToolsVisibility;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const scale_1 = require("../1d/utilities/scale");
|
|
6
|
+
const ChartContext_1 = require("../context/ChartContext");
|
|
7
|
+
const PathBuilder_1 = require("../utility/PathBuilder");
|
|
8
|
+
const useXScale_1 = require("./useXScale");
|
|
9
|
+
function useIntegralYDomain() {
|
|
10
|
+
const { height, margin, verticalAlign, activeSpectrum, integralsYDomains } = (0, ChartContext_1.useChartData)();
|
|
11
|
+
return (0, react_1.useMemo)(() => (0, scale_1.getIntegralYScale)({
|
|
12
|
+
height,
|
|
13
|
+
margin,
|
|
14
|
+
verticalAlign,
|
|
15
|
+
activeSpectrum,
|
|
16
|
+
integralsYDomains,
|
|
17
|
+
}), [activeSpectrum, height, integralsYDomains, margin, verticalAlign]);
|
|
18
|
+
}
|
|
19
|
+
function useIntegralPath(integralOptions) {
|
|
20
|
+
const { data, activeSpectrum } = (0, ChartContext_1.useChartData)();
|
|
21
|
+
const scaleX = (0, useXScale_1.useXScale)();
|
|
22
|
+
const scaleY = useIntegralYDomain();
|
|
23
|
+
const integral = (0, react_1.useMemo)(() => {
|
|
24
|
+
if (activeSpectrum) {
|
|
25
|
+
const { x, re } = data[activeSpectrum?.index].data;
|
|
26
|
+
const { from, to } = integralOptions;
|
|
27
|
+
return (0, ml_spectra_processing_1.xyIntegral)({ x, y: re }, {
|
|
28
|
+
from,
|
|
29
|
+
to,
|
|
30
|
+
reverse: true,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return { x: [], y: [] };
|
|
34
|
+
}, [activeSpectrum, data, integralOptions]);
|
|
35
|
+
const paths = (0, react_1.useMemo)(() => {
|
|
36
|
+
if (integral) {
|
|
37
|
+
const xySeries = (0, ml_spectra_processing_1.xyReduce)(integral, {
|
|
38
|
+
// from: xDomain[0],
|
|
39
|
+
// to: xDomain[1],
|
|
40
|
+
nbPoints: 200,
|
|
41
|
+
optimize: true,
|
|
42
|
+
});
|
|
43
|
+
const pathBuilder = new PathBuilder_1.PathBuilder();
|
|
44
|
+
pathBuilder.moveTo(scaleX(xySeries.x[0]), scaleY(xySeries.y[0]));
|
|
45
|
+
for (let i = 1; i < xySeries.x.length; i++) {
|
|
46
|
+
pathBuilder.lineTo(scaleX(xySeries.x[i]), scaleY(xySeries.y[i]));
|
|
47
|
+
}
|
|
48
|
+
return pathBuilder.toString();
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
}, [integral, scaleX, scaleY]);
|
|
54
|
+
return paths;
|
|
55
|
+
}
|
|
56
|
+
exports.default = useIntegralPath;
|
|
@@ -10,7 +10,7 @@ const react_1 = require("react");
|
|
|
10
10
|
const DispatchContext_1 = require("../context/DispatchContext");
|
|
11
11
|
const Alert_1 = require("../elements/popup/Alert");
|
|
12
12
|
const Panels_1 = require("../panels/Panels");
|
|
13
|
-
const
|
|
13
|
+
const Zoom1DManager_1 = require("../reducer/helper/Zoom1DManager");
|
|
14
14
|
const Types_1 = require("../reducer/types/Types");
|
|
15
15
|
const ToolTypes_1 = require("../toolbar/ToolTypes");
|
|
16
16
|
function useToolsFunctions() {
|
|
@@ -24,12 +24,12 @@ function useToolsFunctions() {
|
|
|
24
24
|
ToolTypes_1.options.peakPicking.id,
|
|
25
25
|
ToolTypes_1.options.integral.id,
|
|
26
26
|
ToolTypes_1.options.zone2D.id,
|
|
27
|
+
ToolTypes_1.options.exclusionZones.id,
|
|
27
28
|
].includes(selectedTool)) {
|
|
28
|
-
alert.show('Press Shift + Left Mouse button to select zone
|
|
29
|
+
alert.show('Press Shift + Left Mouse button to select zone');
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
openPanel(Panels_1.PANELS_ACCORDION[selectedTool]);
|
|
31
|
+
if (Object.keys(Panels_1.TOOLS_PANELS_ACCORDION).includes(selectedTool)) {
|
|
32
|
+
openPanel(Panels_1.TOOLS_PANELS_ACCORDION[selectedTool]);
|
|
33
33
|
}
|
|
34
34
|
dispatch({
|
|
35
35
|
type: Types_1.SET_SELECTED_TOOL,
|
|
@@ -40,7 +40,7 @@ function useToolsFunctions() {
|
|
|
40
40
|
if (debounceClickEventsRef.current.clicks.length === 0) {
|
|
41
41
|
dispatch({
|
|
42
42
|
type: Types_1.FULL_ZOOM_OUT,
|
|
43
|
-
zoomType:
|
|
43
|
+
zoomType: Zoom1DManager_1.ZoomType.HORIZONTAL,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
const callback = (0, debounce_1.default)(() => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useXScale = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const scale_1 = require("../1d/utilities/scale");
|
|
6
|
+
const ChartContext_1 = require("../context/ChartContext");
|
|
7
|
+
function useXScale() {
|
|
8
|
+
const { width, margin, xDomains, xDomain, mode } = (0, ChartContext_1.useChartData)();
|
|
9
|
+
return (0, react_1.useMemo)(() => (0, scale_1.getXScale)({ width, margin, xDomains, xDomain, mode }), [margin, mode, width, xDomain, xDomains]);
|
|
10
|
+
}
|
|
11
|
+
exports.useXScale = useXScale;
|