nmrium 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/IntegralResizable.js +13 -13
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +30 -31
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +5 -5
- package/lib/component/1d/ranges/Range.js +24 -33
- package/lib/component/2d/zones/Signal.js +8 -8
- package/lib/component/2d/zones/Zone.js +3 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -1
- package/lib/component/NMRium.js +22 -29
- package/lib/component/assignment/AssignmentsContext.d.ts +35 -0
- package/lib/component/assignment/AssignmentsContext.js +83 -0
- package/lib/component/assignment/AssignmentsReducer.d.ts +32 -0
- package/lib/component/assignment/AssignmentsReducer.js +39 -0
- package/lib/component/assignment/actions/initAssignment.d.ts +5 -0
- package/lib/component/assignment/actions/initAssignment.js +62 -0
- package/lib/component/assignment/actions/removeAssignment.d.ts +16 -0
- package/lib/component/assignment/actions/removeAssignment.js +24 -0
- package/lib/component/assignment/actions/setActiveAssignment.d.ts +10 -0
- package/lib/component/assignment/actions/setActiveAssignment.js +8 -0
- package/lib/component/assignment/actions/toggleAssignment.d.ts +7 -0
- package/lib/component/assignment/actions/toggleAssignment.js +44 -0
- package/lib/component/assignment/index.d.ts +0 -18
- package/lib/component/assignment/index.js +12 -266
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.d.ts +2 -0
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.js +3 -0
- package/lib/component/context/GlobalContext.d.ts +12 -3
- package/lib/component/context/GlobalContext.js +1 -1
- package/lib/component/elements/ActionButtons.d.ts +10 -0
- package/lib/component/elements/ActionButtons.js +14 -0
- package/lib/component/elements/Button.d.ts +30 -5
- package/lib/component/elements/Button.js +151 -4
- package/lib/component/elements/ContextMenu.js +6 -6
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +5 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +38 -10
- package/lib/component/elements/ReactTable/ReactTable.d.ts +3 -1
- package/lib/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib/component/elements/ReactTable/Style.d.ts +1 -3
- package/lib/component/elements/ReactTable/Style.js +1 -7
- package/lib/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib/component/elements/resizer/DivResizer.d.ts +2 -0
- package/lib/component/elements/resizer/DivResizer.js +107 -0
- package/lib/component/elements/resizer/Resizer.d.ts +18 -0
- package/lib/component/elements/resizer/Resizer.js +12 -0
- package/lib/component/elements/resizer/SVGResizer.d.ts +2 -0
- package/lib/component/elements/resizer/SVGResizer.js +71 -0
- package/lib/component/elements/resizer/useDraggable.d.ts +19 -0
- package/lib/component/elements/resizer/useDraggable.js +52 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +4 -15
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib/component/header/RangesPickingOptionPanel.js +3 -16
- package/lib/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib/component/header/Zones2DOptionPanel.js +3 -14
- package/lib/component/hooks/useExport.js +11 -9
- package/lib/component/loader/DropZone.js +1 -0
- package/lib/component/modal/AlignSpectraModal.js +2 -1
- package/lib/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib/component/modal/LoadJCAMPModal.js +7 -6
- package/lib/component/modal/ModalStyle.js +4 -26
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -1
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib/component/modal/PredictSpectraModal.js +2 -7
- package/lib/component/modal/SaveAsModal.d.ts +1 -1
- package/lib/component/modal/SaveAsModal.js +2 -1
- package/lib/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib/component/modal/setting/GeneralSettings.js +3 -1
- package/lib/component/modal/setting/settingsValidation.d.ts +8 -0
- package/lib/component/modal/setting/settingsValidation.js +40 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +4 -3
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.d.ts +10 -0
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +60 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +11 -5
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +20 -11
- package/lib/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +12 -11
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +16 -9
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -3
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +5 -18
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +5 -7
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +5 -9
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +20 -20
- package/lib/component/panels/header/SpectraAutomaticPickingButton.d.ts +2 -0
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +30 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib/component/reducer/Reducer.d.ts +2 -0
- package/lib/component/reducer/Reducer.js +4 -1
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +9 -0
- package/lib/component/reducer/actions/AssignmentsActions.js +18 -0
- package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
- package/lib/component/reducer/actions/LoadActions.js +10 -5
- package/lib/component/reducer/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +16 -16
- package/lib/component/reducer/types/Types.d.ts +1 -0
- package/lib/component/reducer/types/Types.js +1 -0
- package/lib/component/utility/Export.d.ts +3 -3
- package/lib/component/utility/Export.js +10 -9
- package/lib/component/utility/FormatNumber.js +1 -1
- package/lib/component/workspaces/Workspace.d.ts +2 -4
- package/lib/component/workspaces/basic.js +8 -9
- package/lib/data/SpectraManager.js +23 -15
- package/lib/data/data1d/Data1DManager.d.ts +1 -1
- package/lib/data/data1d/Data1DManager.js +2 -1
- package/lib/data/data1d/Spectrum1D/toJSON.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib/data/data1d/database.d.ts +1 -2
- package/lib/data/data1d/database.js +1 -1
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +1 -4
- package/lib/data/data2d/Data2DManager.d.ts +1 -1
- package/lib/data/data2d/Data2DManager.js +2 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/data2d/Spectrum2D/toJSON.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/IntegralResizable.js +12 -12
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +29 -30
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +6 -6
- package/lib-cjs/component/1d/ranges/Range.js +26 -35
- package/lib-cjs/component/2d/zones/Signal.js +9 -9
- package/lib-cjs/component/2d/zones/Zone.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +2 -2
- package/lib-cjs/component/NMRium.js +22 -29
- package/lib-cjs/component/assignment/AssignmentsContext.js +88 -0
- package/lib-cjs/component/assignment/AssignmentsReducer.js +45 -0
- package/lib-cjs/component/assignment/actions/initAssignment.js +65 -0
- package/lib-cjs/component/assignment/actions/removeAssignment.js +29 -0
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +11 -0
- package/lib-cjs/component/assignment/actions/toggleAssignment.js +47 -0
- package/lib-cjs/component/assignment/index.js +15 -269
- package/lib-cjs/component/assignment/utilities/filterForIDsWithAssignment.js +7 -0
- package/lib-cjs/component/context/GlobalContext.js +1 -1
- package/lib-cjs/component/elements/ActionButtons.js +20 -0
- package/lib-cjs/component/elements/Button.js +150 -4
- package/lib-cjs/component/elements/ContextMenu.js +6 -6
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +42 -14
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib-cjs/component/elements/ReactTable/Style.js +1 -9
- package/lib-cjs/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib-cjs/component/elements/resizer/DivResizer.js +113 -0
- package/lib-cjs/component/elements/resizer/Resizer.js +18 -0
- package/lib-cjs/component/elements/resizer/SVGResizer.js +77 -0
- package/lib-cjs/component/elements/resizer/useDraggable.js +55 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +3 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +2 -15
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib-cjs/component/header/Zones2DOptionPanel.js +2 -13
- package/lib-cjs/component/hooks/useExport.js +11 -9
- package/lib-cjs/component/loader/DropZone.js +1 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +2 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib-cjs/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib-cjs/component/modal/LoadJCAMPModal.js +7 -6
- package/lib-cjs/component/modal/ModalStyle.js +4 -26
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +5 -1
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +2 -7
- package/lib-cjs/component/modal/SaveAsModal.js +2 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib-cjs/component/modal/setting/GeneralSettings.js +3 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +66 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +67 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +12 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +15 -14
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -16
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +21 -21
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +37 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib-cjs/component/reducer/Reducer.js +4 -1
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +21 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +9 -4
- package/lib-cjs/component/reducer/preferencesReducer.js +16 -16
- package/lib-cjs/component/reducer/types/Types.js +2 -1
- package/lib-cjs/component/utility/Export.js +10 -9
- package/lib-cjs/component/utility/FormatNumber.js +1 -1
- package/lib-cjs/component/workspaces/basic.js +8 -9
- package/lib-cjs/data/SpectraManager.js +23 -15
- package/lib-cjs/data/data1d/Data1DManager.js +2 -1
- package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib-cjs/data/data2d/Data2DManager.js +2 -1
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +25 -26
- package/lib/component/1d/Resizable.d.ts +0 -12
- package/lib/component/1d/Resizable.js +0 -105
- package/lib-cjs/component/1d/Resizable.js +0 -110
|
@@ -31,6 +31,7 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
31
31
|
const react_1 = require("@emotion/react");
|
|
32
32
|
const react_2 = require("react");
|
|
33
33
|
const PreferencesContext_1 = require("../../context/PreferencesContext");
|
|
34
|
+
const ActionButtons_1 = __importDefault(require("../../elements/ActionButtons"));
|
|
34
35
|
const CloseButton_1 = __importDefault(require("../../elements/CloseButton"));
|
|
35
36
|
const Tab_1 = __importDefault(require("../../elements/Tab/Tab"));
|
|
36
37
|
const Tabs_1 = __importStar(require("../../elements/Tab/Tabs"));
|
|
@@ -42,6 +43,7 @@ const ControllersTabContent_1 = __importDefault(require("./ControllersTabContent
|
|
|
42
43
|
const DisplayTabContent_1 = __importDefault(require("./DisplayTabContent"));
|
|
43
44
|
const FormattingTabContent_1 = __importDefault(require("./FormattingTabContent"));
|
|
44
45
|
const WorkspaceItem_1 = __importDefault(require("./WorkspaceItem"));
|
|
46
|
+
const settingsValidation_1 = require("./settingsValidation");
|
|
45
47
|
const styles = (0, react_1.css) `
|
|
46
48
|
.main-content {
|
|
47
49
|
width: 100%;
|
|
@@ -173,6 +175,6 @@ function GeneralSettings({ onClose }) {
|
|
|
173
175
|
const renderItem = (0, react_2.useCallback)((item) => {
|
|
174
176
|
return ((0, jsx_runtime_1.jsx)(WorkspaceItem_1.default, { item: item, onSave: addWorkSpaceHandler, onDelete: deleteWorkSpaceHandler }));
|
|
175
177
|
}, [addWorkSpaceHandler, deleteWorkSpaceHandler]);
|
|
176
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "General Settings" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "workspace-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Workspace : " }), (0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, renderItem: renderItem, selectedKey: preferences?.workspace.current, onSelect: ChangeWorkspaceHandler })] }), (0, jsx_runtime_1.jsx)("div", { className: "main-content", children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { ref: refForm, initialValues: preferences.current, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Controllers", tabid: "controllers", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(ControllersTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Formatting", tabid: "formatting", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(FormattingTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Display", tabid: "display", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(DisplayTabContent_1.default, { preferences: preferences.current.display }) }) })] }) }, JSON.stringify(preferences.current)) }), (0, jsx_runtime_1.
|
|
178
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: [ModalStyle_1.ModalStyles, styles], children: [(0, jsx_runtime_1.jsxs)("div", { className: "header handle", children: [(0, jsx_runtime_1.jsx)("span", { children: "General Settings" }), (0, jsx_runtime_1.jsx)(CloseButton_1.default, { onClick: onClose, className: "close-bt" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "workspace-container", children: [(0, jsx_runtime_1.jsx)("span", { className: "label", children: "Workspace : " }), (0, jsx_runtime_1.jsx)(DropDownButton_1.default, { data: workspacesList, renderItem: renderItem, selectedKey: preferences?.workspace.current, onSelect: ChangeWorkspaceHandler })] }), (0, jsx_runtime_1.jsx)("div", { className: "main-content", children: (0, jsx_runtime_1.jsx)(FormikForm_1.default, { ref: refForm, initialValues: preferences.current, validationSchema: settingsValidation_1.validation, onSubmit: submitHandler, children: (0, jsx_runtime_1.jsxs)(Tabs_1.default, { position: Tabs_1.PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [(0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Controllers", tabid: "controllers", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(ControllersTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Formatting", tabid: "formatting", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(FormattingTabContent_1.default, {}) }) }), (0, jsx_runtime_1.jsx)(Tab_1.default, { tablabel: "Display", tabid: "display", children: (0, jsx_runtime_1.jsx)("div", { className: "inner-content", children: (0, jsx_runtime_1.jsx)(DisplayTabContent_1.default, { preferences: preferences.current.display }) }) })] }) }, JSON.stringify(preferences.current)) }), (0, jsx_runtime_1.jsx)("div", { className: "footer-container", children: (0, jsx_runtime_1.jsx)(ActionButtons_1.default, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: handleSave, doneLabel: "Save", onCancel: handleReset, cancelLabel: "Reset" }) })] }));
|
|
177
179
|
}
|
|
178
180
|
exports.default = GeneralSettings;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.validation = void 0;
|
|
27
|
+
const Yup = __importStar(require("yup"));
|
|
28
|
+
const formattingValidation = (obj) => Object.keys(obj.formatting.nuclei).reduce((validate, key) => {
|
|
29
|
+
validate[key] = Yup.object().shape({
|
|
30
|
+
name: Yup.string().trim().required('Nucleus is a required field'),
|
|
31
|
+
ppm: Yup.string().trim().required('PPM format is a required field'),
|
|
32
|
+
hz: Yup.string().trim().required('Hz format is a required field'),
|
|
33
|
+
});
|
|
34
|
+
return validate;
|
|
35
|
+
}, {});
|
|
36
|
+
exports.validation = Yup.lazy((obj) => Yup.object().shape({
|
|
37
|
+
formatting: Yup.object().shape({
|
|
38
|
+
nuclei: Yup.object()
|
|
39
|
+
.shape(formattingValidation(obj))
|
|
40
|
+
.test('Unique', 'Nuclei need te be unique', function check(nuclei) {
|
|
41
|
+
let nucleusFrequencies = {};
|
|
42
|
+
for (const key of Object.keys(nuclei)) {
|
|
43
|
+
const _key = nuclei[key].name?.toLowerCase() || '';
|
|
44
|
+
if (_key) {
|
|
45
|
+
if (nucleusFrequencies[_key]) {
|
|
46
|
+
++nucleusFrequencies[_key].value;
|
|
47
|
+
nucleusFrequencies[_key].fields.push(key);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
nucleusFrequencies[_key] = { value: 1, fields: [key] };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const errors = Object.keys(nucleusFrequencies).reduce((errorList, key) => {
|
|
55
|
+
const { value, fields } = nucleusFrequencies[key];
|
|
56
|
+
if (value > 1) {
|
|
57
|
+
for (let field of fields) {
|
|
58
|
+
errorList.push(new Yup.ValidationError(`${key} nucleus must te be unique`, nuclei[key].name, `${this.path}.${field}.name`));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return errorList;
|
|
62
|
+
}, []);
|
|
63
|
+
return new Yup.ValidationError(errors);
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
}));
|
|
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
7
|
/** @jsxImportSource @emotion/react */
|
|
8
8
|
const cheminfo_font_1 = require("cheminfo-font");
|
|
9
|
-
const
|
|
9
|
+
const fa_1 = require("react-icons/fa");
|
|
10
10
|
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
11
11
|
const BasicPanelStyle_1 = require("../extra/BasicPanelStyle");
|
|
12
12
|
const DefaultPanelHeader_1 = __importDefault(require("../header/DefaultPanelHeader"));
|
|
13
|
+
const SpectraAutomaticPickingButton_1 = require("../header/SpectraAutomaticPickingButton");
|
|
14
|
+
const AutomaticAssignmentTable_1 = __importDefault(require("./AutomaticAssignmentTable"));
|
|
15
|
+
const useAutoAssignments_1 = require("./useAutoAssignments");
|
|
13
16
|
function AutomaticAssignment() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return ((0, jsx_runtime_1.jsxs)("div", { css: BasicPanelStyle_1.tablePanelStyle, children: [(0, jsx_runtime_1.jsx)(DefaultPanelHeader_1.default, { showSettingButton: false, canDelete: false, children: (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "automatic assignment", onClick: automaticAssignmentHandler, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAssignment2, { style: { fontSize: '18px' } }) }) }), (0, jsx_runtime_1.jsx)("div", { className: "inner-container" })] }));
|
|
17
|
+
const { getAssignments, assignments, restAssignments } = (0, useAutoAssignments_1.useAutoAssignments)();
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("div", { css: BasicPanelStyle_1.tablePanelStyle, children: [(0, jsx_runtime_1.jsxs)(DefaultPanelHeader_1.default, { showSettingButton: false, canDelete: false, children: [(0, jsx_runtime_1.jsx)(SpectraAutomaticPickingButton_1.SpectraAutomaticPickingButton, {}), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "automatic assignment", onClick: getAssignments, children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAssignment2, { style: { fontSize: '18px' } }) }), (0, jsx_runtime_1.jsx)(ButtonToolTip_1.default, { popupTitle: "reset assignment", onClick: restAssignments, children: (0, jsx_runtime_1.jsx)(fa_1.FaBolt, {}) })] }), (0, jsx_runtime_1.jsx)("div", { className: "inner-container", children: (0, jsx_runtime_1.jsx)(AutomaticAssignmentTable_1.default, { data: assignments }) })] }));
|
|
17
19
|
}
|
|
18
20
|
exports.default = AutomaticAssignment;
|
|
@@ -6,15 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const cheminfo_font_1 = require("cheminfo-font");
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
9
10
|
const ReactTable_1 = __importDefault(require("../../elements/ReactTable/ReactTable"));
|
|
11
|
+
const Types_1 = require("../../reducer/types/Types");
|
|
10
12
|
const NoTableData_1 = __importDefault(require("../extra/placeholder/NoTableData"));
|
|
11
|
-
function
|
|
13
|
+
function AutomaticAssignmentTable({ data }) {
|
|
14
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
12
15
|
const assignHandler = (0, react_1.useCallback)((e, row) => {
|
|
13
16
|
e.preventDefault();
|
|
14
17
|
e.stopPropagation();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const assignments = row.original.assignment;
|
|
19
|
+
dispatch({
|
|
20
|
+
type: Types_1.SET_AUTOMATIC_ASSIGNMENTS,
|
|
21
|
+
payload: { assignments },
|
|
22
|
+
});
|
|
23
|
+
}, [dispatch]);
|
|
18
24
|
const COLUMNS = (0, react_1.useMemo)(() => [
|
|
19
25
|
{
|
|
20
26
|
index: 1,
|
|
@@ -25,6 +31,7 @@ function PeaksTable({ data }) {
|
|
|
25
31
|
{
|
|
26
32
|
index: 2,
|
|
27
33
|
Header: 'Score',
|
|
34
|
+
accessor: 'score',
|
|
28
35
|
},
|
|
29
36
|
{
|
|
30
37
|
index: 3,
|
|
@@ -38,6 +45,6 @@ function PeaksTable({ data }) {
|
|
|
38
45
|
Cell: ({ row }) => ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "assign-button", onClick: (e) => assignHandler(e, row), children: (0, jsx_runtime_1.jsx)(cheminfo_font_1.SvgNmrAssignment, {}) })),
|
|
39
46
|
},
|
|
40
47
|
], [assignHandler]);
|
|
41
|
-
return data && data.length > 0 ? ((0, jsx_runtime_1.jsx)(ReactTable_1.default, { data: data, columns: COLUMNS })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {}));
|
|
48
|
+
return data && data.length > 0 ? ((0, jsx_runtime_1.jsx)(ReactTable_1.default, { data: data, columns: COLUMNS, onClick: assignHandler, highlightActiveRow: true })) : ((0, jsx_runtime_1.jsx)(NoTableData_1.default, {}));
|
|
42
49
|
}
|
|
43
|
-
exports.default = (0, react_1.memo)(
|
|
50
|
+
exports.default = (0, react_1.memo)(AutomaticAssignmentTable);
|
|
@@ -0,0 +1,67 @@
|
|
|
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.useAutoAssignments = void 0;
|
|
7
|
+
const nmr_processing_1 = require("nmr-processing");
|
|
8
|
+
const full_1 = __importDefault(require("openchemlib/full"));
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const ChartContext_1 = require("../../context/ChartContext");
|
|
11
|
+
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
12
|
+
const Alert_1 = require("../../elements/popup/Alert");
|
|
13
|
+
const Types_1 = require("../../reducer/types/Types");
|
|
14
|
+
function mapSpectra(data) {
|
|
15
|
+
return data.reduce((acc, spectrum) => {
|
|
16
|
+
const { id, info } = spectrum;
|
|
17
|
+
const dimension = spectrum.info.dimension;
|
|
18
|
+
if (dimension === 1) {
|
|
19
|
+
const ranges = spectrum.ranges.values;
|
|
20
|
+
acc.push({ id, info, ranges });
|
|
21
|
+
}
|
|
22
|
+
else if (dimension === 2) {
|
|
23
|
+
const zones = spectrum.zones.values;
|
|
24
|
+
acc.push({ id, info, zones });
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
}, []);
|
|
28
|
+
}
|
|
29
|
+
function useAutoAssignments() {
|
|
30
|
+
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
31
|
+
const { data, molecules } = (0, ChartContext_1.useChartData)();
|
|
32
|
+
const originData = (0, react_1.useRef)();
|
|
33
|
+
const alert = (0, Alert_1.useAlert)();
|
|
34
|
+
const [assignments, setAssignments] = (0, react_1.useState)([]);
|
|
35
|
+
const restAssignments = (0, react_1.useCallback)(() => {
|
|
36
|
+
dispatch({
|
|
37
|
+
type: Types_1.SET_AUTOMATIC_ASSIGNMENTS,
|
|
38
|
+
payload: { assignments: originData.current },
|
|
39
|
+
});
|
|
40
|
+
}, [dispatch]);
|
|
41
|
+
const getAssignments = (0, react_1.useCallback)(() => {
|
|
42
|
+
void (async () => {
|
|
43
|
+
const hideLoading = await alert.showLoading('Auto Assignments');
|
|
44
|
+
const molecule = full_1.default.Molecule.fromMolfile(molecules[0]?.molfile || '');
|
|
45
|
+
const spectra = mapSpectra(data);
|
|
46
|
+
if (!originData.current) {
|
|
47
|
+
originData.current = spectra;
|
|
48
|
+
}
|
|
49
|
+
const result = await (0, nmr_processing_1.getAssignments)({
|
|
50
|
+
spectra,
|
|
51
|
+
molecule,
|
|
52
|
+
}, { minScore: 0 });
|
|
53
|
+
dispatch({
|
|
54
|
+
type: Types_1.SET_AUTOMATIC_ASSIGNMENTS,
|
|
55
|
+
payload: { assignments: result[0].assignment },
|
|
56
|
+
});
|
|
57
|
+
hideLoading();
|
|
58
|
+
setAssignments(result);
|
|
59
|
+
})();
|
|
60
|
+
}, [alert, data, dispatch, molecules]);
|
|
61
|
+
return (0, react_1.useMemo)(() => ({
|
|
62
|
+
getAssignments,
|
|
63
|
+
assignments,
|
|
64
|
+
restAssignments,
|
|
65
|
+
}), [assignments, getAssignments, restAssignments]);
|
|
66
|
+
}
|
|
67
|
+
exports.useAutoAssignments = useAutoAssignments;
|
|
@@ -9,8 +9,9 @@ const react_1 = require("@emotion/react");
|
|
|
9
9
|
const cheminfo_font_1 = require("cheminfo-font");
|
|
10
10
|
const react_2 = require("react");
|
|
11
11
|
const fa_1 = require("react-icons/fa");
|
|
12
|
-
const
|
|
12
|
+
const AssignmentsContext_1 = require("../../assignment/AssignmentsContext");
|
|
13
13
|
const DispatchContext_1 = require("../../context/DispatchContext");
|
|
14
|
+
const GlobalContext_1 = require("../../context/GlobalContext");
|
|
14
15
|
const ButtonToolTip_1 = __importDefault(require("../../elements/ButtonToolTip"));
|
|
15
16
|
const MenuButton_1 = __importDefault(require("../../elements/MenuButton"));
|
|
16
17
|
const ToolTip_1 = __importDefault(require("../../elements/ToolTip/ToolTip"));
|
|
@@ -61,17 +62,22 @@ const MOL_EXPORT_MENU = [
|
|
|
61
62
|
},
|
|
62
63
|
];
|
|
63
64
|
function MoleculePanelHeader({ currentIndex, molecules, onMoleculeIndexChange = () => null, onOpenMoleculeEditor = () => null, actionsOptions = {}, }) {
|
|
65
|
+
const { rootRef } = (0, GlobalContext_1.useGlobal)();
|
|
64
66
|
const alert = (0, Alert_1.useAlert)();
|
|
65
67
|
const dispatch = (0, DispatchContext_1.useDispatch)();
|
|
66
68
|
const modal = (0, Modal_1.useModal)();
|
|
67
|
-
const assignmentData = (0,
|
|
69
|
+
const assignmentData = (0, AssignmentsContext_1.useAssignmentData)();
|
|
68
70
|
const saveAsSVGHandler = (0, react_2.useCallback)(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
if (!rootRef)
|
|
72
|
+
return;
|
|
73
|
+
(0, Export_1.exportAsSVG)(rootRef, `molSVG${currentIndex}`, 'molFile');
|
|
74
|
+
}, [rootRef, currentIndex]);
|
|
71
75
|
const saveAsPNGHandler = (0, react_2.useCallback)(() => {
|
|
72
|
-
|
|
76
|
+
if (!rootRef)
|
|
77
|
+
return;
|
|
78
|
+
(0, Export_1.copyPNGToClipboard)(rootRef, `molSVG${currentIndex}`);
|
|
73
79
|
alert.success('MOL copied as PNG to clipboard');
|
|
74
|
-
}, [alert, currentIndex]);
|
|
80
|
+
}, [rootRef, alert, currentIndex]);
|
|
75
81
|
const saveAsMolHandler = (0, react_2.useCallback)(() => {
|
|
76
82
|
if (molecules[currentIndex]) {
|
|
77
83
|
void (0, Export_1.copyTextToClipboard)(molecules[currentIndex].molfile).then((flag) => {
|
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toggleDiaIDs = exports.getCurrentDiaIDsToHighlight = exports.getHighlightsOnHover = exports.findDatumAndSignalIndex = exports.extractFromAtom = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
function getElements(activeTab) {
|
|
5
|
+
const nuclei = activeTab.split(',');
|
|
6
|
+
return nuclei.map((nucleus) => nucleus.replace(/[0-9]/g, ''));
|
|
7
|
+
}
|
|
8
|
+
function extractFromAtom(atom, activeTab, axis) {
|
|
9
|
+
const elements = getElements(activeTab);
|
|
6
10
|
if (elements.length > 0 && Object.keys(atom).length > 0) {
|
|
7
|
-
const dim =
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
const dim = axis === 'x' ? 0 : axis === 'y' ? 1 : null;
|
|
12
|
+
switch (dim !== null && elements[dim]) {
|
|
13
|
+
case atom.atomLabel: {
|
|
10
14
|
// take always oclID if atom type is same as element of activeTab)
|
|
11
15
|
return { oclIDs: [atom.oclID], nbAtoms: atom.nbAtoms };
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
case 'H': {
|
|
14
18
|
// if we are in proton spectrum and use then the IDs of attached hydrogens of an atom
|
|
15
19
|
return {
|
|
16
20
|
oclIDs: atom.hydrogenOCLIDs,
|
|
17
21
|
nbAtoms: atom.nbAtoms * atom.nbHydrogens,
|
|
18
22
|
};
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
24
|
+
default:
|
|
25
|
+
return {
|
|
26
|
+
oclIDs: [atom.oclID].concat(atom.hydrogenOCLIDs),
|
|
27
|
+
nbAtoms: atom.nbAtoms + atom.nbAtoms * atom.nbHydrogens,
|
|
28
|
+
};
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
return { oclIDs: [], nbAtoms: 0 };
|
|
29
32
|
}
|
|
30
33
|
exports.extractFromAtom = extractFromAtom;
|
|
31
|
-
function findDatumAndSignalIndex(
|
|
34
|
+
function findDatumAndSignalIndex(data, id) {
|
|
32
35
|
// if datum could be found then the id is on range/zone level
|
|
33
|
-
let datum =
|
|
36
|
+
let datum = data.find((_datum) => _datum.id === id);
|
|
34
37
|
let signalIndex;
|
|
35
38
|
if (!datum) {
|
|
36
39
|
// figure out the datum via id
|
|
37
|
-
for (const
|
|
38
|
-
signalIndex =
|
|
40
|
+
for (const record of data) {
|
|
41
|
+
signalIndex = record.signals.findIndex((signal) => signal.id === id);
|
|
39
42
|
if (signalIndex >= 0) {
|
|
40
|
-
datum =
|
|
43
|
+
datum = record;
|
|
41
44
|
break;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -45,74 +48,53 @@ function findDatumAndSignalIndex(spectraData, id) {
|
|
|
45
48
|
return { datum, signalIndex };
|
|
46
49
|
}
|
|
47
50
|
exports.findDatumAndSignalIndex = findDatumAndSignalIndex;
|
|
48
|
-
function getHighlightsOnHover(
|
|
51
|
+
function getHighlightsOnHover(assignments, oclIDs, data) {
|
|
49
52
|
// set all IDs to highlight when hovering over an atom from assignment data
|
|
50
53
|
let highlights = [];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
datum = result.datum;
|
|
65
|
-
signalIndex = result.signalIndex;
|
|
66
|
-
stop = true;
|
|
67
|
-
}
|
|
68
|
-
if (datum) {
|
|
69
|
-
highlights.push(datum.id);
|
|
70
|
-
if (signalIndex !== undefined) {
|
|
71
|
-
highlights.push(datum.signals[signalIndex].id);
|
|
54
|
+
const assignmentsByKey = assignments.data.assignments;
|
|
55
|
+
for (const key in assignmentsByKey) {
|
|
56
|
+
const assignments = assignmentsByKey[key];
|
|
57
|
+
for (const axis in assignments) {
|
|
58
|
+
if (assignments[axis]?.some((oclKey) => oclIDs.includes(oclKey))) {
|
|
59
|
+
highlights = highlights.concat(assignments[axis]);
|
|
60
|
+
const { datum, signalIndex } = findDatumAndSignalIndex(data, key);
|
|
61
|
+
if (datum) {
|
|
62
|
+
highlights.push(datum.id);
|
|
63
|
+
if (signalIndex !== undefined) {
|
|
64
|
+
highlights.push(datum.signals[signalIndex].id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
|
-
if (stop) {
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
69
|
}
|
|
78
70
|
return highlights;
|
|
79
71
|
}
|
|
80
72
|
exports.getHighlightsOnHover = getHighlightsOnHover;
|
|
81
|
-
function getCurrentDiaIDsToHighlight(assignmentData
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
: displayerMode === Constants_1.DISPLAYER_MODE.DM_2D
|
|
92
|
-
? axisOnHover
|
|
93
|
-
? axisOnHover === 'x'
|
|
94
|
-
? assignmentOnHover.x || []
|
|
95
|
-
: axisOnHover === 'y'
|
|
96
|
-
? assignmentOnHover.y || []
|
|
97
|
-
: (assignmentOnHover.x || []).concat(assignmentOnHover.y || [])
|
|
98
|
-
: (assignmentOnHover.x || []).concat(assignmentOnHover.y || [])
|
|
99
|
-
: []
|
|
100
|
-
: [];
|
|
73
|
+
function getCurrentDiaIDsToHighlight(assignmentData) {
|
|
74
|
+
const { highlighted, assignments } = assignmentData.data;
|
|
75
|
+
const assignment = highlighted ? assignments[highlighted.id] : null;
|
|
76
|
+
const axisHover = highlighted ? highlighted.axis : null;
|
|
77
|
+
if (axisHover && assignment && assignment[axisHover]) {
|
|
78
|
+
return assignment[axisHover];
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
return (assignment?.x || []).concat(assignment?.y || []);
|
|
82
|
+
}
|
|
101
83
|
}
|
|
102
84
|
exports.getCurrentDiaIDsToHighlight = getCurrentDiaIDsToHighlight;
|
|
103
|
-
function toggleDiaIDs(
|
|
104
|
-
let
|
|
85
|
+
function toggleDiaIDs(diaIDs, atomInformation) {
|
|
86
|
+
let _diaIDs = diaIDs ? diaIDs.slice() : [];
|
|
105
87
|
const { nbAtoms, oclIDs } = atomInformation;
|
|
106
88
|
let tempNbAtoms = nbAtoms;
|
|
107
89
|
oclIDs.forEach((_oclID) => {
|
|
108
|
-
if (
|
|
90
|
+
if (_diaIDs.includes(_oclID)) {
|
|
109
91
|
tempNbAtoms *= -1;
|
|
110
|
-
|
|
92
|
+
_diaIDs = _diaIDs.filter((_id) => _id !== _oclID);
|
|
111
93
|
}
|
|
112
94
|
else {
|
|
113
|
-
|
|
95
|
+
_diaIDs.push(_oclID);
|
|
114
96
|
}
|
|
115
97
|
});
|
|
116
|
-
return [
|
|
98
|
+
return [_diaIDs, tempNbAtoms];
|
|
117
99
|
}
|
|
118
100
|
exports.toggleDiaIDs = toggleDiaIDs;
|