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
|
@@ -0,0 +1,36 @@
|
|
|
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.mapPeaks = void 0;
|
|
7
|
+
const generateID_1 = __importDefault(require("../../../utilities/generateID"));
|
|
8
|
+
const getSpectrumErrorValue_1 = require("../getSpectrumErrorValue");
|
|
9
|
+
const getShiftX_1 = require("../shift/getShiftX");
|
|
10
|
+
function checkPeak(peak, datum, error) {
|
|
11
|
+
// check if the Peak is already exists
|
|
12
|
+
for (const { x } of datum.peaks?.values || []) {
|
|
13
|
+
if (Math.abs(peak.x - x) < error) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
function mapPeaks(peaks, datum) {
|
|
20
|
+
const shiftX = (0, getShiftX_1.getShiftX)(datum);
|
|
21
|
+
const error = (0, getSpectrumErrorValue_1.getSpectrumErrorValue)(datum);
|
|
22
|
+
return peaks.reduce((acc, newPeak) => {
|
|
23
|
+
// check if the peak is already exists
|
|
24
|
+
if (checkPeak(newPeak, datum, error))
|
|
25
|
+
return acc;
|
|
26
|
+
acc.push({
|
|
27
|
+
id: newPeak?.id || (0, generateID_1.default)(),
|
|
28
|
+
originalX: newPeak.x - shiftX,
|
|
29
|
+
x: newPeak.x,
|
|
30
|
+
y: newPeak.y,
|
|
31
|
+
width: newPeak.width,
|
|
32
|
+
});
|
|
33
|
+
return acc;
|
|
34
|
+
}, []);
|
|
35
|
+
}
|
|
36
|
+
exports.mapPeaks = mapPeaks;
|
|
@@ -0,0 +1,21 @@
|
|
|
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.initiateRanges = void 0;
|
|
7
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
8
|
+
const mapRanges_1 = require("./mapRanges");
|
|
9
|
+
function initiateRanges(options, datum) {
|
|
10
|
+
return (0, merge_1.default)({
|
|
11
|
+
values: [],
|
|
12
|
+
options: {
|
|
13
|
+
sum: undefined,
|
|
14
|
+
isSumConstant: true,
|
|
15
|
+
sumAuto: true,
|
|
16
|
+
},
|
|
17
|
+
}, options.ranges, {
|
|
18
|
+
values: (0, mapRanges_1.mapRanges)(options?.ranges?.values || [], datum),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.initiateRanges = initiateRanges;
|
|
@@ -7,19 +7,24 @@ exports.mapRanges = void 0;
|
|
|
7
7
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
8
8
|
const SignalsKinds_1 = require("../../../constants/SignalsKinds");
|
|
9
9
|
const generateID_1 = __importDefault(require("../../../utilities/generateID"));
|
|
10
|
+
const getSpectrumErrorValue_1 = require("../getSpectrumErrorValue");
|
|
10
11
|
const getShiftX_1 = require("../shift/getShiftX");
|
|
12
|
+
function checkRange(range, datum, error) {
|
|
13
|
+
// check if the range is already exists
|
|
14
|
+
for (const { from, to } of datum.ranges?.values || []) {
|
|
15
|
+
if (Math.abs(range.from - from) < error &&
|
|
16
|
+
Math.abs(range.to - to) < error) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
11
21
|
function mapRanges(ranges, datum) {
|
|
12
22
|
const { x, re } = datum.data;
|
|
13
23
|
const shiftX = (0, getShiftX_1.getShiftX)(datum);
|
|
14
|
-
const error = (
|
|
24
|
+
const error = (0, getSpectrumErrorValue_1.getSpectrumErrorValue)(datum);
|
|
15
25
|
return ranges.reduce((acc, newRange) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (Math.abs(newRange.from - from) < error &&
|
|
19
|
-
Math.abs(newRange.to - to) < error) {
|
|
20
|
-
return acc;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
26
|
+
if (checkRange(newRange, datum, error))
|
|
27
|
+
return acc;
|
|
23
28
|
const absolute = (0, ml_spectra_processing_1.xyIntegration)({ x, y: re }, { from: newRange.from, to: newRange.to, reverse: true });
|
|
24
29
|
const signals = newRange.signals.map((signal) => {
|
|
25
30
|
const { kind = null, id, ...resSignal } = signal;
|
|
@@ -16,6 +16,9 @@ function migrate(data) {
|
|
|
16
16
|
migrateToVersion2_1.default,
|
|
17
17
|
];
|
|
18
18
|
let index = data?.version || 0;
|
|
19
|
+
if (index > exports.CURRENT_EXPORT_VERSION) {
|
|
20
|
+
throw new Error('This file can not be imported using the current NMRium version, Please move to the new one !!! ');
|
|
21
|
+
}
|
|
19
22
|
return migrationPipe(migrationsFuncs.slice(index))(data);
|
|
20
23
|
}
|
|
21
24
|
exports.migrate = migrate;
|
package/lib-cjs/versionInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib-cjs/component/NMRium.js",
|
|
7
7
|
"module": "lib/component/NMRium.js",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"react-dom": ">=16.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@emotion/react": "^11.
|
|
49
|
-
"analysis-ui-components": "^0.10.
|
|
48
|
+
"@emotion/react": "^11.8.1",
|
|
49
|
+
"analysis-ui-components": "^0.10.3",
|
|
50
50
|
"cheminfo-font": "^1.8.1",
|
|
51
|
-
"cheminfo-types": "^
|
|
51
|
+
"cheminfo-types": "^1.1.0",
|
|
52
52
|
"d3": "^7.3.0",
|
|
53
53
|
"eventemitter3": "^4.0.7",
|
|
54
54
|
"file-saver": "^2.0.5",
|
|
@@ -64,22 +64,22 @@
|
|
|
64
64
|
"ml-array-xy-equally-spaced": "^1.2.1",
|
|
65
65
|
"ml-baseline-correction-regression": "^1.0.0",
|
|
66
66
|
"ml-conrec": "^3.2.1",
|
|
67
|
-
"ml-gsd": "^
|
|
68
|
-
"ml-spectra-processing": "^
|
|
67
|
+
"ml-gsd": "^10.1.2",
|
|
68
|
+
"ml-spectra-processing": "^11.0.0",
|
|
69
69
|
"ml-stat": "^1.3.3",
|
|
70
70
|
"multiplet-analysis": "^2.0.0",
|
|
71
|
-
"nmr-correlation": "^2.2.
|
|
72
|
-
"nmr-parser": "^1.7.
|
|
73
|
-
"nmr-processing": "^
|
|
71
|
+
"nmr-correlation": "^2.2.5",
|
|
72
|
+
"nmr-parser": "^1.7.3",
|
|
73
|
+
"nmr-processing": "^7.0.1",
|
|
74
74
|
"nmredata": "^0.6.1",
|
|
75
75
|
"numeral": "^2.0.6",
|
|
76
76
|
"openchemlib": "^7.4.3",
|
|
77
77
|
"openchemlib-utils": "^1.9.0",
|
|
78
|
-
"re-resizable": "^6.9.
|
|
78
|
+
"re-resizable": "^6.9.2",
|
|
79
79
|
"react-color": "2.17.2",
|
|
80
80
|
"react-d3-utils": "^0.5.0",
|
|
81
81
|
"react-draggable": "^4.4.4",
|
|
82
|
-
"react-dropzone": "^
|
|
82
|
+
"react-dropzone": "^12.0.4",
|
|
83
83
|
"react-error-boundary": "^3.1.4",
|
|
84
84
|
"react-icons": "^4.3.1",
|
|
85
85
|
"react-inspector": "^5.1.1",
|
|
@@ -99,18 +99,18 @@
|
|
|
99
99
|
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
|
|
100
100
|
"@babel/preset-react": "^7.16.7",
|
|
101
101
|
"@babel/preset-typescript": "^7.16.7",
|
|
102
|
-
"@playwright/test": "^1.19.
|
|
102
|
+
"@playwright/test": "^1.19.2",
|
|
103
103
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
104
104
|
"@types/d3": "^7.1.0",
|
|
105
|
-
"@types/jest": "^27.4.
|
|
106
|
-
"@types/node": "^17.0.
|
|
105
|
+
"@types/jest": "^27.4.1",
|
|
106
|
+
"@types/node": "^17.0.21",
|
|
107
107
|
"@types/react": "^17.0.39",
|
|
108
108
|
"@types/react-dom": "^17.0.11",
|
|
109
109
|
"@types/react-router-dom": "^5.3.3",
|
|
110
110
|
"@vitejs/plugin-react": "^1.2.0",
|
|
111
111
|
"@zakodium/eslint-config": "^5.1.0",
|
|
112
112
|
"cross-env": "^7.0.3",
|
|
113
|
-
"eslint": "^8.
|
|
113
|
+
"eslint": "^8.10.0",
|
|
114
114
|
"jest": "^27.5.1",
|
|
115
115
|
"modern-normalize": "^1.1.0",
|
|
116
116
|
"prettier": "^2.5.1",
|
|
@@ -118,7 +118,6 @@
|
|
|
118
118
|
"react": "^17.0.2",
|
|
119
119
|
"react-dom": "^17.0.2",
|
|
120
120
|
"react-router-dom": "^5.3.0",
|
|
121
|
-
"reactstrap": "^8.10.1",
|
|
122
121
|
"rimraf": "^3.0.2",
|
|
123
122
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
124
123
|
"serve": "^13.0.2",
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { xyIntegral, xyReduce } from 'ml-spectra-processing';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { useChartData } from '../../context/ChartContext';
|
|
4
|
-
import { useScale } from '../../context/ScaleContext';
|
|
5
|
-
import { PathBuilder } from '../../utility/PathBuilder';
|
|
6
|
-
import { getYScale, reScaleY } from './scale';
|
|
7
|
-
export default function useIntegralPath(integralOptions) {
|
|
8
|
-
const { xDomain, height, yDomain, margin, verticalAlign, data, activeSpectrum, zoom, } = useChartData();
|
|
9
|
-
const { scaleX } = useScale();
|
|
10
|
-
const scaleY = useMemo(() => {
|
|
11
|
-
const scale = zoom.integral.scales[activeSpectrum?.id || ''];
|
|
12
|
-
const scaledYDomain = reScaleY(scale === undefined ? 1 : scale < 0.1 ? 0.05 : scale, {
|
|
13
|
-
domain: [yDomain[0], yDomain[1] / 20],
|
|
14
|
-
height,
|
|
15
|
-
margin,
|
|
16
|
-
});
|
|
17
|
-
return getYScale({
|
|
18
|
-
height,
|
|
19
|
-
margin,
|
|
20
|
-
verticalAlign,
|
|
21
|
-
yDomain: scaledYDomain,
|
|
22
|
-
});
|
|
23
|
-
}, [
|
|
24
|
-
activeSpectrum?.id,
|
|
25
|
-
height,
|
|
26
|
-
margin,
|
|
27
|
-
verticalAlign,
|
|
28
|
-
yDomain,
|
|
29
|
-
zoom.integral.scales,
|
|
30
|
-
]);
|
|
31
|
-
const integral = useMemo(() => {
|
|
32
|
-
if (activeSpectrum) {
|
|
33
|
-
const { x, re } = data[activeSpectrum?.index].data;
|
|
34
|
-
const { from, to } = integralOptions;
|
|
35
|
-
return xyIntegral({ x, y: re }, {
|
|
36
|
-
from,
|
|
37
|
-
to,
|
|
38
|
-
reverse: true,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return { x: [], y: [] };
|
|
42
|
-
}, [activeSpectrum, data, integralOptions]);
|
|
43
|
-
const paths = useMemo(() => {
|
|
44
|
-
if (integral && scaleX) {
|
|
45
|
-
const xySeries = xyReduce(integral, {
|
|
46
|
-
from: xDomain[0],
|
|
47
|
-
to: xDomain[1],
|
|
48
|
-
nbPoints: 200,
|
|
49
|
-
optimize: true,
|
|
50
|
-
});
|
|
51
|
-
const pathBuilder = new PathBuilder();
|
|
52
|
-
pathBuilder.moveTo(scaleX()(xySeries.x[0]), scaleY(xySeries.y[0]));
|
|
53
|
-
for (let i = 1; i < xySeries.x.length; i++) {
|
|
54
|
-
pathBuilder.lineTo(scaleX()(xySeries.x[i]), scaleY(xySeries.y[i]));
|
|
55
|
-
}
|
|
56
|
-
return pathBuilder.toString();
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
}, [integral, scaleX, scaleY, xDomain]);
|
|
62
|
-
return paths;
|
|
63
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
general: {
|
|
3
|
-
disableMultipletAnalysis: boolean;
|
|
4
|
-
hideSetSumFromMolecule: boolean;
|
|
5
|
-
};
|
|
6
|
-
panels: {
|
|
7
|
-
hideSpectraPanel: boolean;
|
|
8
|
-
hideInformationPanel: boolean;
|
|
9
|
-
hidePeaksPanel: boolean;
|
|
10
|
-
hideIntegralsPanel: boolean;
|
|
11
|
-
hideRangesPanel: boolean;
|
|
12
|
-
hideStructuresPanel: boolean;
|
|
13
|
-
hideFiltersPanel: boolean;
|
|
14
|
-
hideZonesPanel: boolean;
|
|
15
|
-
hideSummaryPanel: boolean;
|
|
16
|
-
hideMultipleSpectraAnalysisPanel: boolean;
|
|
17
|
-
hideDatabasePanel: boolean;
|
|
18
|
-
};
|
|
19
|
-
toolBarButtons: {
|
|
20
|
-
hideZoomTool: boolean;
|
|
21
|
-
hideZoomOutTool: boolean;
|
|
22
|
-
hideImport: boolean;
|
|
23
|
-
hideExportAs: boolean;
|
|
24
|
-
hideSpectraStackAlignments: boolean;
|
|
25
|
-
hideSpectraCenterAlignments: boolean;
|
|
26
|
-
hideRealImaginary: boolean;
|
|
27
|
-
hidePeakTool: boolean;
|
|
28
|
-
hideIntegralTool: boolean;
|
|
29
|
-
hideAutoRangesTool: boolean;
|
|
30
|
-
hideZeroFillingTool: boolean;
|
|
31
|
-
hidePhaseCorrectionTool: boolean;
|
|
32
|
-
hideBaseLineCorrectionTool: boolean;
|
|
33
|
-
hideFFTTool: boolean;
|
|
34
|
-
hideMultipleSpectraAnalysisTool: boolean;
|
|
35
|
-
};
|
|
36
|
-
hideExperimentalFeatures: boolean;
|
|
37
|
-
};
|
|
38
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
general: {
|
|
3
|
-
disableMultipletAnalysis: false,
|
|
4
|
-
hideSetSumFromMolecule: false,
|
|
5
|
-
},
|
|
6
|
-
panels: {
|
|
7
|
-
hideSpectraPanel: false,
|
|
8
|
-
hideInformationPanel: false,
|
|
9
|
-
hidePeaksPanel: false,
|
|
10
|
-
hideIntegralsPanel: false,
|
|
11
|
-
hideRangesPanel: false,
|
|
12
|
-
hideStructuresPanel: false,
|
|
13
|
-
hideFiltersPanel: false,
|
|
14
|
-
hideZonesPanel: false,
|
|
15
|
-
hideSummaryPanel: true,
|
|
16
|
-
hideMultipleSpectraAnalysisPanel: true,
|
|
17
|
-
hideDatabasePanel: false,
|
|
18
|
-
},
|
|
19
|
-
toolBarButtons: {
|
|
20
|
-
hideZoomTool: false,
|
|
21
|
-
hideZoomOutTool: false,
|
|
22
|
-
hideImport: false,
|
|
23
|
-
hideExportAs: false,
|
|
24
|
-
hideSpectraStackAlignments: false,
|
|
25
|
-
hideSpectraCenterAlignments: false,
|
|
26
|
-
hideRealImaginary: false,
|
|
27
|
-
hidePeakTool: false,
|
|
28
|
-
hideIntegralTool: false,
|
|
29
|
-
hideAutoRangesTool: false,
|
|
30
|
-
hideZeroFillingTool: false,
|
|
31
|
-
hidePhaseCorrectionTool: false,
|
|
32
|
-
hideBaseLineCorrectionTool: false,
|
|
33
|
-
hideFFTTool: false,
|
|
34
|
-
hideMultipleSpectraAnalysisTool: false,
|
|
35
|
-
},
|
|
36
|
-
hideExperimentalFeatures: true,
|
|
37
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
general: {
|
|
3
|
-
disableMultipletAnalysis: boolean;
|
|
4
|
-
hideSetSumFromMolecule: boolean;
|
|
5
|
-
};
|
|
6
|
-
panels: {
|
|
7
|
-
hideSpectraPanel: boolean;
|
|
8
|
-
hideInformationPanel: boolean;
|
|
9
|
-
hidePeaksPanel: boolean;
|
|
10
|
-
hideIntegralsPanel: boolean;
|
|
11
|
-
hideRangesPanel: boolean;
|
|
12
|
-
hideStructuresPanel: boolean;
|
|
13
|
-
hideFiltersPanel: boolean;
|
|
14
|
-
hideZonesPanel: boolean;
|
|
15
|
-
hideSummaryPanel: boolean;
|
|
16
|
-
hideMultipleSpectraAnalysisPanel: boolean;
|
|
17
|
-
hideDatabasePanel: boolean;
|
|
18
|
-
};
|
|
19
|
-
toolBarButtons: {
|
|
20
|
-
hideZoomTool: boolean;
|
|
21
|
-
hideZoomOutTool: boolean;
|
|
22
|
-
hideImport: boolean;
|
|
23
|
-
hideExportAs: boolean;
|
|
24
|
-
hideSpectraStackAlignments: boolean;
|
|
25
|
-
hideSpectraCenterAlignments: boolean;
|
|
26
|
-
hideRealImaginary: boolean;
|
|
27
|
-
hidePeakTool: boolean;
|
|
28
|
-
hideIntegralTool: boolean;
|
|
29
|
-
hideAutoRangesTool: boolean;
|
|
30
|
-
hideZeroFillingTool: boolean;
|
|
31
|
-
hidePhaseCorrectionTool: boolean;
|
|
32
|
-
hideBaseLineCorrectionTool: boolean;
|
|
33
|
-
hideFFTTool: boolean;
|
|
34
|
-
hideMultipleSpectraAnalysisTool: boolean;
|
|
35
|
-
hideExclusionZonesTool: boolean;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
general: {
|
|
3
|
-
disableMultipletAnalysis: true,
|
|
4
|
-
hideSetSumFromMolecule: false,
|
|
5
|
-
},
|
|
6
|
-
panels: {
|
|
7
|
-
hideSpectraPanel: false,
|
|
8
|
-
hideInformationPanel: false,
|
|
9
|
-
hidePeaksPanel: false,
|
|
10
|
-
hideIntegralsPanel: false,
|
|
11
|
-
hideRangesPanel: true,
|
|
12
|
-
hideStructuresPanel: false,
|
|
13
|
-
hideFiltersPanel: true,
|
|
14
|
-
hideZonesPanel: true,
|
|
15
|
-
hideSummaryPanel: true,
|
|
16
|
-
hideMultipleSpectraAnalysisPanel: true,
|
|
17
|
-
hideDatabasePanel: false,
|
|
18
|
-
},
|
|
19
|
-
toolBarButtons: {
|
|
20
|
-
hideZoomTool: false,
|
|
21
|
-
hideZoomOutTool: false,
|
|
22
|
-
hideImport: true,
|
|
23
|
-
hideExportAs: true,
|
|
24
|
-
hideSpectraStackAlignments: false,
|
|
25
|
-
hideSpectraCenterAlignments: false,
|
|
26
|
-
hideRealImaginary: true,
|
|
27
|
-
hidePeakTool: false,
|
|
28
|
-
hideIntegralTool: false,
|
|
29
|
-
hideAutoRangesTool: true,
|
|
30
|
-
hideZeroFillingTool: true,
|
|
31
|
-
hidePhaseCorrectionTool: true,
|
|
32
|
-
hideBaseLineCorrectionTool: true,
|
|
33
|
-
hideFFTTool: true,
|
|
34
|
-
hideMultipleSpectraAnalysisTool: true,
|
|
35
|
-
hideExclusionZonesTool: true,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
general: {
|
|
3
|
-
disableMultipletAnalysis: boolean;
|
|
4
|
-
hideSetSumFromMolecule: boolean;
|
|
5
|
-
};
|
|
6
|
-
panels: {
|
|
7
|
-
hideSpectraPanel: boolean;
|
|
8
|
-
hideInformationPanel: boolean;
|
|
9
|
-
hidePeaksPanel: boolean;
|
|
10
|
-
hideIntegralsPanel: boolean;
|
|
11
|
-
hideRangesPanel: boolean;
|
|
12
|
-
hideStructuresPanel: boolean;
|
|
13
|
-
hideFiltersPanel: boolean;
|
|
14
|
-
hideZonesPanel: boolean;
|
|
15
|
-
hideSummaryPanel: boolean;
|
|
16
|
-
hideMultipleSpectraAnalysisPanel: boolean;
|
|
17
|
-
hideDatabasePanel: boolean;
|
|
18
|
-
};
|
|
19
|
-
toolBarButtons: {
|
|
20
|
-
hideZoomTool: boolean;
|
|
21
|
-
hideZoomOutTool: boolean;
|
|
22
|
-
hideImport: boolean;
|
|
23
|
-
hideExportAs: boolean;
|
|
24
|
-
hideSpectraStackAlignments: boolean;
|
|
25
|
-
hideSpectraCenterAlignments: boolean;
|
|
26
|
-
hideRealImaginary: boolean;
|
|
27
|
-
hidePeakTool: boolean;
|
|
28
|
-
hideIntegralTool: boolean;
|
|
29
|
-
hideAutoRangesTool: boolean;
|
|
30
|
-
hideZeroFillingTool: boolean;
|
|
31
|
-
hidePhaseCorrectionTool: boolean;
|
|
32
|
-
hideBaseLineCorrectionTool: boolean;
|
|
33
|
-
hideFFTTool: boolean;
|
|
34
|
-
hideMultipleSpectraAnalysisTool: boolean;
|
|
35
|
-
hideExclusionZonesTool: boolean;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
general: {
|
|
3
|
-
disableMultipletAnalysis: true,
|
|
4
|
-
hideSetSumFromMolecule: false,
|
|
5
|
-
},
|
|
6
|
-
panels: {
|
|
7
|
-
hideSpectraPanel: false,
|
|
8
|
-
hideInformationPanel: false,
|
|
9
|
-
hidePeaksPanel: false,
|
|
10
|
-
hideIntegralsPanel: false,
|
|
11
|
-
hideRangesPanel: true,
|
|
12
|
-
hideStructuresPanel: false,
|
|
13
|
-
hideFiltersPanel: false,
|
|
14
|
-
hideZonesPanel: true,
|
|
15
|
-
hideSummaryPanel: true,
|
|
16
|
-
hideMultipleSpectraAnalysisPanel: true,
|
|
17
|
-
hideDatabasePanel: false,
|
|
18
|
-
},
|
|
19
|
-
toolBarButtons: {
|
|
20
|
-
hideZoomTool: false,
|
|
21
|
-
hideZoomOutTool: false,
|
|
22
|
-
hideImport: true,
|
|
23
|
-
hideExportAs: true,
|
|
24
|
-
hideSpectraStackAlignments: false,
|
|
25
|
-
hideSpectraCenterAlignments: false,
|
|
26
|
-
hideRealImaginary: false,
|
|
27
|
-
hidePeakTool: false,
|
|
28
|
-
hideIntegralTool: false,
|
|
29
|
-
hideAutoRangesTool: true,
|
|
30
|
-
hideZeroFillingTool: false,
|
|
31
|
-
hidePhaseCorrectionTool: false,
|
|
32
|
-
hideBaseLineCorrectionTool: false,
|
|
33
|
-
hideFFTTool: false,
|
|
34
|
-
hideMultipleSpectraAnalysisTool: true,
|
|
35
|
-
hideExclusionZonesTool: true,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Types } from 'nmr-correlation';
|
|
2
|
-
import { Datum2D } from '../../../data/types/data2d';
|
|
3
|
-
declare function getAtomType(nucleus: string): string;
|
|
4
|
-
declare function getLabelColor(correlationData: any, correlation: any): string | null;
|
|
5
|
-
declare function findSignalMatch1D(spectrum: Datum2D, link: Types.Link, factor: number, xDomain0: number, xDomain1: number): boolean;
|
|
6
|
-
declare function findSignalMatch2D(spectrum: Datum2D, link: Types.Link, factor: number, xDomain0: number, xDomain1: number, yDomain0: number, yDomain1: number): boolean;
|
|
7
|
-
declare function getAbbreviation(link: Types.Link): string;
|
|
8
|
-
declare function buildNewLink1D(link: any): Link;
|
|
9
|
-
declare function buildNewLink2D(link: Types.Link, axis: 'x' | 'y'): Link;
|
|
10
|
-
declare function cloneCorrelationAndEditLink(correlation: Types.Correlation, link: Types.Link, axis: 'x' | 'y', action: 'add' | 'remove' | 'unmove'): Types.Correlation;
|
|
11
|
-
declare function getEditedCorrelations({ correlationDim1, correlationDim2, selectedCorrelationValueDim1, selectedCorrelationValueDim2, action, link, correlations, }: {
|
|
12
|
-
correlationDim1: any;
|
|
13
|
-
correlationDim2: any;
|
|
14
|
-
selectedCorrelationValueDim1: any;
|
|
15
|
-
selectedCorrelationValueDim2: any;
|
|
16
|
-
action: any;
|
|
17
|
-
link: any;
|
|
18
|
-
correlations: any;
|
|
19
|
-
}): {
|
|
20
|
-
editedCorrelations: Types.Correlation[];
|
|
21
|
-
buildCorrelationDataOptions: {
|
|
22
|
-
skipDataUpdate?: boolean | undefined;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
export { buildNewLink1D, buildNewLink2D, cloneCorrelationAndEditLink, findSignalMatch1D, findSignalMatch2D, getAbbreviation, getAtomType, getEditedCorrelations, getLabelColor, };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Draft } from 'immer';
|
|
2
|
-
import { State } from '../Reducer';
|
|
3
|
-
export declare const ZoomType: {
|
|
4
|
-
HORIZONTAL: string;
|
|
5
|
-
VERTICAL: string;
|
|
6
|
-
STEP_HORIZONTAL: string;
|
|
7
|
-
FULL: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function wheel(deltaY: any, deltaMode: any, draft: Draft<State>, id?: string | null): void;
|
|
10
|
-
declare function setZoom(draft: Draft<State>, options?: {
|
|
11
|
-
scale?: number;
|
|
12
|
-
spectrumID?: string;
|
|
13
|
-
shareYDomain?: boolean;
|
|
14
|
-
}): void;
|
|
15
|
-
declare function setZoom1D(draft: any, height: any, margin: any, index: any, defaultScale?: number): void;
|
|
16
|
-
export { setZoom, setZoom1D };
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { zoomIdentity, scaleLinear } from 'd3';
|
|
2
|
-
import Zoom1DManager, { setAllScales } from '../helper/Zoom1DManager';
|
|
3
|
-
export const ZoomType = {
|
|
4
|
-
HORIZONTAL: 'HORIZONTAL',
|
|
5
|
-
VERTICAL: 'VERTICAL',
|
|
6
|
-
STEP_HORIZONTAL: 'STEP_HORIZONTAL',
|
|
7
|
-
FULL: 'FULL',
|
|
8
|
-
};
|
|
9
|
-
export function wheel(deltaY, deltaMode, draft, id = null) {
|
|
10
|
-
if (draft.activeSpectrum?.id || id) {
|
|
11
|
-
Zoom1DManager(draft.zoom.spectra).wheel(deltaY, id || draft.activeSpectrum?.id);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
const zoomManager = Zoom1DManager(draft.zoom.spectra);
|
|
15
|
-
draft.data.forEach((datum) => {
|
|
16
|
-
if (datum.info.dimension === 1 &&
|
|
17
|
-
draft.activeTab === datum.info.nucleus) {
|
|
18
|
-
zoomManager.wheel(deltaY, datum.id);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function setZoom(draft, options = {}) {
|
|
24
|
-
const { height, margin, activeSpectrum } = draft;
|
|
25
|
-
const { scale = null, spectrumID = null } = options;
|
|
26
|
-
if (scale && !spectrumID) {
|
|
27
|
-
setAllScales(draft.zoom.spectra, scale);
|
|
28
|
-
}
|
|
29
|
-
const zoomManager = Zoom1DManager(draft.zoom.spectra);
|
|
30
|
-
if (activeSpectrum === null && spectrumID === null) {
|
|
31
|
-
const { shareYDomain, yDomain, yDomains } = draft.originDomain;
|
|
32
|
-
draft.yDomains = Object.keys(draft.yDomains).reduce((acc, id) => {
|
|
33
|
-
const scale = zoomManager.getScale(id);
|
|
34
|
-
const _scale = scaleLinear(shareYDomain ? yDomain : yDomains[id], [
|
|
35
|
-
height - margin.bottom,
|
|
36
|
-
margin.top,
|
|
37
|
-
]);
|
|
38
|
-
const [min, max] = shareYDomain ? yDomain : yDomains[id];
|
|
39
|
-
const maxPoint = Math.max(Math.abs(max), Math.abs(min));
|
|
40
|
-
const scalePoint = maxPoint === max ? 0 : min;
|
|
41
|
-
const t = zoomIdentity
|
|
42
|
-
.translate(0, Math.sign(scalePoint) >= 0 ? _scale(scalePoint) : _scale(scalePoint))
|
|
43
|
-
.scale(scale)
|
|
44
|
-
.translate(0, -_scale(0));
|
|
45
|
-
const newYDomain = t.rescaleY(_scale).domain();
|
|
46
|
-
acc[id] = newYDomain;
|
|
47
|
-
return acc;
|
|
48
|
-
}, {});
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
const spectrumId = spectrumID || activeSpectrum?.id;
|
|
52
|
-
if (spectrumId) {
|
|
53
|
-
if (scale) {
|
|
54
|
-
zoomManager.setScale(scale, spectrumId);
|
|
55
|
-
}
|
|
56
|
-
const scaleFactor = scale ? scale : zoomManager.getScale(spectrumId);
|
|
57
|
-
const _scale = scaleLinear(draft.originDomain.yDomains[spectrumId], [
|
|
58
|
-
height - margin.bottom,
|
|
59
|
-
margin.top,
|
|
60
|
-
]);
|
|
61
|
-
const t = zoomIdentity
|
|
62
|
-
.translate(0, _scale(0))
|
|
63
|
-
.scale(scaleFactor)
|
|
64
|
-
.translate(0, -_scale(0));
|
|
65
|
-
const yDomain = t.rescaleY(_scale).domain();
|
|
66
|
-
draft.yDomains = {
|
|
67
|
-
...draft.yDomains,
|
|
68
|
-
[spectrumId]: yDomain,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function setZoom1D(draft, height, margin, index, defaultScale) {
|
|
74
|
-
const { originDomain, tabActiveSpectrum, activeTab } = draft;
|
|
75
|
-
const { id } = tabActiveSpectrum[activeTab.split(',')[index]];
|
|
76
|
-
const { setScale, getScale } = Zoom1DManager(draft.zoom.spectra);
|
|
77
|
-
if (defaultScale) {
|
|
78
|
-
setScale(defaultScale, id);
|
|
79
|
-
}
|
|
80
|
-
const scale = getScale(id);
|
|
81
|
-
const _scale = scaleLinear(originDomain.yDomains[id], [
|
|
82
|
-
height - margin,
|
|
83
|
-
margin,
|
|
84
|
-
]);
|
|
85
|
-
const t = zoomIdentity
|
|
86
|
-
.translate(0, _scale(0))
|
|
87
|
-
.scale(scale)
|
|
88
|
-
.translate(0, -_scale(0));
|
|
89
|
-
let yDomain = t.rescaleY(_scale).domain();
|
|
90
|
-
draft.yDomains[id] = yDomain;
|
|
91
|
-
}
|
|
92
|
-
export { setZoom, setZoom1D };
|