nmrium 0.54.0 → 0.56.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.
Files changed (142) hide show
  1. package/lib/component/1d/Chart1D.js +3 -1
  2. package/lib/component/1d/Viewer1D.js +36 -11
  3. package/lib/component/1d/XAxis.js +1 -1
  4. package/lib/component/1d/integral/IntegralsSeries.js +2 -2
  5. package/lib/component/1d/integral/Integration.d.ts +3 -1
  6. package/lib/component/1d/integral/Integration.js +3 -2
  7. package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
  8. package/lib/component/1d/matrix/Boxplot.js +97 -0
  9. package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
  10. package/lib/component/1d/matrix/Stocsy.js +101 -0
  11. package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
  12. package/lib/component/1d/matrix/useMatrix.js +93 -0
  13. package/lib/component/1d/peaks/PeakEditionManager.js +5 -3
  14. package/lib/component/1d/ranges/AssignmentActionsButtons.d.ts +1 -0
  15. package/lib/component/1d/ranges/AssignmentActionsButtons.js +3 -3
  16. package/lib/component/1d/ranges/AssignmentLabel.d.ts +1 -1
  17. package/lib/component/1d/ranges/AssignmentLabel.js +31 -4
  18. package/lib/component/1d/ranges/Atoms.js +4 -5
  19. package/lib/component/1d/ranges/Range.js +48 -6
  20. package/lib/component/1d/ranges/Ranges.js +2 -1
  21. package/lib/component/1d/ranges/RangesIntegrals.js +11 -4
  22. package/lib/component/1d/utilities/scale.d.ts +2 -1
  23. package/lib/component/1d/utilities/scale.js +6 -1
  24. package/lib/component/1d-2d/FieldEdition.d.ts +13 -0
  25. package/lib/component/1d-2d/FieldEdition.js +42 -0
  26. package/lib/component/2d/Chart2D.js +5 -3
  27. package/lib/component/2d/zones/Zone.js +18 -2
  28. package/lib/component/2d/zones/ZonesAssignmentsLabels.d.ts +7 -0
  29. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +286 -0
  30. package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -1
  31. package/lib/component/context/PrepareExportContext.d.ts +21 -0
  32. package/lib/component/context/PrepareExportContext.js +124 -0
  33. package/lib/component/context/ShareDataContext.d.ts +10 -0
  34. package/lib/component/context/ShareDataContext.js +22 -0
  35. package/lib/component/elements/ActionsButtonsPopover.d.ts +10 -0
  36. package/lib/component/elements/ActionsButtonsPopover.js +22 -0
  37. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +7 -5
  38. package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
  39. package/lib/component/elements/SVGButton.d.ts +14 -0
  40. package/lib/component/elements/SVGButton.js +6 -0
  41. package/lib/component/elements/SVGGroup.js +15 -13
  42. package/lib/component/elements/SVGText.d.ts +8 -0
  43. package/lib/component/elements/SVGText.js +24 -0
  44. package/lib/component/elements/draggable/SVGDraggable.d.ts +2 -2
  45. package/lib/component/elements/formik/FormikInput.d.ts +2 -1
  46. package/lib/component/elements/formik/FormikInput.js +4 -3
  47. package/lib/component/header/Header.js +7 -10
  48. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  49. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +1 -1
  50. package/lib/component/hooks/useExport.d.ts +1 -1
  51. package/lib/component/hooks/useExport.js +4 -4
  52. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  53. package/lib/component/hooks/useFormatNumberByNucleus.js +8 -7
  54. package/lib/component/hooks/useIntegralPath.d.ts +2 -0
  55. package/lib/component/hooks/useIntegralPath.js +3 -1
  56. package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
  57. package/lib/component/hooks/usePanelPreferences.js +4 -3
  58. package/lib/component/hooks/useSaveSettings.js +7 -14
  59. package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
  60. package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
  61. package/lib/component/hooks/useTriggerNewAssignmentLabel.d.ts +4 -0
  62. package/lib/component/hooks/useTriggerNewAssignmentLabel.js +8 -0
  63. package/lib/component/hooks/useWorkspaceAction.d.ts +7 -0
  64. package/lib/component/hooks/useWorkspaceAction.js +89 -0
  65. package/lib/component/loader/DropZone.js +0 -3
  66. package/lib/component/main/InnerNMRium.js +3 -1
  67. package/lib/component/main/InnerNMRiumContents.js +14 -2
  68. package/lib/component/main/NMRiumStateProvider.js +4 -2
  69. package/lib/component/modal/editRange/forms/components/DeltaInput.js +3 -3
  70. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +17 -12
  71. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +30 -13
  72. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +26 -16
  73. package/lib/component/modal/setting/GeneralSettings.js +7 -21
  74. package/lib/component/modal/setting/WorkspaceItem.js +1 -1
  75. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.d.ts +2 -0
  76. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +99 -0
  77. package/lib/component/modal/setting/settingsValidation.js +36 -40
  78. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
  79. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
  80. package/lib/component/panels/Panels.js +1 -1
  81. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
  82. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +13 -1
  83. package/lib/component/panels/SpectraPanel/base/setting/PlotChart.js +1 -1
  84. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.js +1 -1
  85. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.d.ts +6 -0
  86. package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentLabelColumn.js +16 -0
  87. package/lib/component/panels/ZonesPanel/ZonesPanel.js +18 -2
  88. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +15 -9
  89. package/lib/component/panels/ZonesPanel/ZonesTable.js +2 -2
  90. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +3 -2
  91. package/lib/component/panels/databasePanel/DatabaseTable.js +2 -2
  92. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +1 -1
  93. package/lib/component/reducer/IgnoreActions.js +1 -0
  94. package/lib/component/reducer/Reducer.d.ts +6 -0
  95. package/lib/component/reducer/Reducer.js +6 -0
  96. package/lib/component/reducer/actions/DomainActions.d.ts +12 -4
  97. package/lib/component/reducer/actions/DomainActions.js +35 -5
  98. package/lib/component/reducer/actions/FiltersActions.js +2 -2
  99. package/lib/component/reducer/actions/LoadActions.js +5 -2
  100. package/lib/component/reducer/actions/RangesActions.js +12 -6
  101. package/lib/component/reducer/actions/SpectraActions.d.ts +1 -0
  102. package/lib/component/reducer/actions/SpectraActions.js +7 -2
  103. package/lib/component/reducer/actions/ZonesActions.d.ts +15 -2
  104. package/lib/component/reducer/actions/ZonesActions.js +47 -13
  105. package/lib/component/reducer/helper/setRangesViewProperty.d.ts +1 -0
  106. package/lib/component/reducer/helper/setRangesViewProperty.js +11 -11
  107. package/lib/component/reducer/preferences/actions/addWorkspace.js +4 -23
  108. package/lib/component/reducer/preferences/actions/analyzeSpectra.js +4 -4
  109. package/lib/component/reducer/preferences/actions/initPreferences.js +2 -4
  110. package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
  111. package/lib/component/reducer/preferences/actions/matrixGeneration.js +63 -26
  112. package/lib/component/reducer/preferences/actions/removeWorkspace.js +0 -5
  113. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +0 -4
  114. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  115. package/lib/component/reducer/preferences/actions/setPreferences.js +2 -16
  116. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +5 -2
  117. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +17 -1
  118. package/lib/component/reducer/preferences/preferencesReducer.d.ts +9 -25
  119. package/lib/component/reducer/preferences/preferencesReducer.js +28 -19
  120. package/lib/component/toolbar/ToolBar.js +23 -20
  121. package/lib/component/utility/PathBuilder.d.ts +1 -0
  122. package/lib/component/utility/PathBuilder.js +8 -1
  123. package/lib/component/utility/PreferencesHelper.js +5 -4
  124. package/lib/component/utility/export.js +4 -0
  125. package/lib/component/workspaces/assignment.js +0 -1
  126. package/lib/component/workspaces/basic.js +0 -1
  127. package/lib/component/workspaces/embedded.js +0 -1
  128. package/lib/component/workspaces/exercise.js +26 -29
  129. package/lib/component/workspaces/prediction.js +171 -174
  130. package/lib/component/workspaces/process1D.js +0 -1
  131. package/lib/component/workspaces/simulation.js +35 -38
  132. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -11
  133. package/lib/data/types/common/DeepPartial.d.ts +3 -0
  134. package/lib/data/types/common/DeepPartial.js +1 -0
  135. package/lib/versionInfo.js +1 -1
  136. package/package.json +39 -39
  137. package/lib/component/elements/CustomToolTip.d.ts +0 -8
  138. package/lib/component/elements/CustomToolTip.js +0 -107
  139. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.d.ts +0 -2
  140. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +0 -80
  141. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +0 -2
  142. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +0 -10
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.54.0",
4
+ "version": "0.56.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "url": "git+https://github.com/cheminfo/nmrium.git"
47
47
  },
48
48
  "volta": {
49
- "node": "20.11.0"
49
+ "node": "20.14.0"
50
50
  },
51
51
  "overrides": {
52
52
  "react": "$react",
@@ -57,58 +57,58 @@
57
57
  "react-dom": ">=18.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@blueprintjs/core": "^5.10.1",
60
+ "@blueprintjs/core": "^5.10.3",
61
61
  "@blueprintjs/icons": "^5.9.0",
62
- "@blueprintjs/select": "^5.1.3",
62
+ "@blueprintjs/select": "^5.1.5",
63
63
  "@emotion/react": "^11.11.4",
64
64
  "@emotion/styled": "^11.11.5",
65
65
  "@lukeed/uuid": "^2.0.1",
66
66
  "cheminfo-font": "^1.13.0",
67
67
  "cheminfo-types": "^1.7.3",
68
- "clipboard-polyfill": "^4.0.2",
68
+ "clipboard-polyfill": "^4.1.0",
69
69
  "convert-to-jcamp": "^5.4.10",
70
70
  "d3": "^7.9.0",
71
71
  "eventemitter3": "^5.0.1",
72
72
  "fifo-logger": "^1.0.0",
73
73
  "file-saver": "^2.0.5",
74
74
  "filelist-utils": "^1.11.0",
75
- "formik": "^2.4.5",
76
- "immer": "^10.0.4",
75
+ "formik": "^2.4.6",
76
+ "immer": "^10.1.1",
77
77
  "jszip": "^3.10.1",
78
78
  "lodash": "^4.17.21",
79
79
  "ml-array-max": "^1.2.4",
80
80
  "ml-array-mean": "^1.1.6",
81
81
  "ml-array-median": "^1.1.6",
82
82
  "ml-array-xy-equally-spaced": "^1.2.1",
83
- "ml-baseline-correction-regression": "^1.0.2",
83
+ "ml-baseline-correction-regression": "^2.0.1",
84
84
  "ml-conrec": "^5.0.2",
85
85
  "ml-gsd": "^12.1.6",
86
86
  "ml-matrix": "^6.11.0",
87
87
  "ml-signal-processing": "^1.0.4",
88
- "ml-spectra-processing": "^14.3.0",
88
+ "ml-spectra-processing": "^14.5.0",
89
89
  "ml-stat": "^1.3.3",
90
90
  "ml-tree-similarity": "^2.2.0",
91
91
  "multiplet-analysis": "^2.1.2",
92
92
  "nmr-correlation": "^2.3.3",
93
- "nmr-load-save": "^0.29.3",
94
- "nmr-processing": "^12.2.0",
93
+ "nmr-load-save": "^0.33.1",
94
+ "nmr-processing": "^12.3.2",
95
95
  "nmredata": "^0.9.9",
96
96
  "numeral": "^2.0.6",
97
- "openchemlib": "^8.9.0",
98
- "openchemlib-utils": "^5.15.0",
97
+ "openchemlib": "^8.13.0",
98
+ "openchemlib-utils": "^5.21.1",
99
99
  "papaparse": "^5.4.1",
100
- "re-resizable": "6.9.11",
100
+ "re-resizable": "6.9.17",
101
101
  "react-d3-utils": "^1.0.0",
102
102
  "react-dropzone": "^14.2.3",
103
103
  "react-error-boundary": "^4.0.13",
104
- "react-icons": "^5.1.0",
104
+ "react-icons": "^5.2.1",
105
105
  "react-inspector": "^6.0.2",
106
106
  "react-mf": "^2.0.2",
107
107
  "react-ocl": "^6.1.0",
108
108
  "react-ocl-nmr": "^3.0.1",
109
109
  "react-plot": "^1.4.2",
110
- "react-rnd": "^10.4.1",
111
- "react-science": "^3.1.0",
110
+ "react-rnd": "^10.4.11",
111
+ "react-science": "^4.0.0",
112
112
  "react-slider": "^2.0.6",
113
113
  "react-table": "^7.8.0",
114
114
  "react-transition-group": "^4.4.5",
@@ -117,39 +117,39 @@
117
117
  "yup": "^1.4.0"
118
118
  },
119
119
  "devDependencies": {
120
- "@babel/plugin-transform-modules-commonjs": "^7.24.1",
121
- "@babel/preset-react": "^7.24.1",
122
- "@babel/preset-typescript": "^7.24.1",
123
- "@playwright/test": "^1.43.1",
120
+ "@babel/plugin-transform-modules-commonjs": "^7.24.6",
121
+ "@babel/preset-react": "^7.24.6",
122
+ "@babel/preset-typescript": "^7.24.6",
123
+ "@playwright/test": "^1.44.1",
124
124
  "@simbathesailor/use-what-changed": "^2.0.0",
125
125
  "@types/d3": "^7.4.3",
126
- "@types/lodash": "^4.17.0",
127
- "@types/node": "^20.12.7",
126
+ "@types/lodash": "^4.17.4",
127
+ "@types/node": "^20.12.13",
128
128
  "@types/papaparse": "^5.3.14",
129
- "@types/react": "^18.2.79",
130
- "@types/react-dom": "^18.2.25",
129
+ "@types/react": "^18.3.3",
130
+ "@types/react-dom": "^18.3.0",
131
131
  "@types/react-table": "^7.7.20",
132
- "@vitejs/plugin-react-swc": "^3.6.0",
133
- "@vitest/coverage-v8": "^1.5.0",
132
+ "@vitejs/plugin-react-swc": "^3.7.0",
133
+ "@vitest/coverage-v8": "^1.6.0",
134
134
  "cross-env": "^7.0.3",
135
- "cspell": "^8.7.0",
135
+ "cspell": "^8.8.3",
136
136
  "eslint": "^8.57.0",
137
137
  "eslint-config-cheminfo-react": "^11.0.1",
138
- "eslint-config-cheminfo-typescript": "^12.3.0",
138
+ "eslint-config-cheminfo-typescript": "^12.4.0",
139
139
  "modern-normalize": "^2.0.0",
140
140
  "postcss-styled-syntax": "^0.6.4",
141
141
  "prettier": "^3.2.5",
142
- "rc-menu": "^9.13.0",
143
- "react": "^18.2.0",
144
- "react-dom": "^18.2.0",
145
- "react-router-dom": "^6.22.3",
146
- "rimraf": "^5.0.5",
142
+ "rc-menu": "^9.14.0",
143
+ "react": "^18.3.1",
144
+ "react-dom": "^18.3.1",
145
+ "react-router-dom": "^6.23.1",
146
+ "rimraf": "^5.0.7",
147
147
  "rollup-plugin-analyzer": "^4.0.0",
148
- "serve": "^14.2.1",
149
- "stylelint": "^16.3.1",
148
+ "serve": "^14.2.3",
149
+ "stylelint": "^16.6.1",
150
150
  "stylelint-config-standard": "^36.0.0",
151
151
  "typescript": "^5.4.5",
152
- "vite": "^5.2.9",
153
- "vitest": "^1.5.0"
152
+ "vite": "^5.2.12",
153
+ "vitest": "^1.6.0"
154
154
  }
155
- }
155
+ }
@@ -1,8 +0,0 @@
1
- export interface ToolTipItem {
2
- title: string;
3
- shortcuts?: string[];
4
- subTitles?: ToolTipItem[];
5
- description?: string;
6
- link?: string;
7
- }
8
- export declare function CustomToolTip(props: ToolTipItem): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,107 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- const styles = {
5
- titleContainer: {
6
- display: 'flex',
7
- justifyContent: 'space-between',
8
- flexWrap: 'wrap',
9
- alignItems: 'center',
10
- },
11
- title: {
12
- fontSize: '0.9rem',
13
- flex: 1,
14
- padding: '5px 0',
15
- textAlign: 'left',
16
- color: 'white',
17
- },
18
- description: {
19
- paddingTop: '1rem',
20
- fontSize: '0.7rem',
21
- textAlign: 'left',
22
- color: 'white',
23
- },
24
- shortcutContainer: {
25
- display: 'flex',
26
- textWrap: 'nowrap',
27
- color: 'white',
28
- },
29
- shortcutItem: {
30
- display: 'flex',
31
- justifyContent: 'center',
32
- alignItems: 'center',
33
- padding: '0.2rem',
34
- border: '1px solid #ccc',
35
- borderRadius: '4px',
36
- height: 'calc(0.2rem + 20px)',
37
- minWidth: 'calc(0.2rem + 20px)' /* Adjust padding and border width */,
38
- marginLeft: '5px',
39
- fontSize: '0.75rem',
40
- fontWeight: 'bold',
41
- },
42
- };
43
- export function CustomToolTip(props) {
44
- const { title, shortcuts = [], subTitles = [], description = '', link, } = props;
45
- return (_jsxs("div", { style: {
46
- width: 250,
47
- padding: '0.5rem',
48
- }, children: [_jsxs("div", { style: styles.titleContainer, children: [_jsx("span", { style: styles.title, children: title }), _jsx(ShortCuts, { shortcuts: shortcuts })] }), _jsx(SubTitles, { items: subTitles }), (description || link) && (_jsxs("p", { style: styles.description, children: [description, link && (_jsx("a", { style: description ? { paddingLeft: '5px' } : {}, target: "_blank", href: link, rel: "noreferrer", children: "Learn more" }))] }))] }));
49
- }
50
- function ShortCuts({ shortcuts, style = {}, }) {
51
- return (_jsx("div", { style: styles.shortcutContainer, children: shortcuts.map((key, index) => {
52
- return (_jsx("div", { style: {
53
- ...styles.shortcutItem,
54
- ...(index === 0 && { margin: 0 }),
55
- ...style,
56
- }, children: _jsx("span", { children: key }) }, key));
57
- }) }));
58
- }
59
- const subTitleStyle = css `
60
- padding-left: 5px;
61
- list-style: none;
62
-
63
- li {
64
- position: relative;
65
- padding-left: 15px;
66
- box-sizing: border-box;
67
-
68
- &::before {
69
- position: absolute;
70
- top: 15px;
71
- left: 0;
72
- width: 10px;
73
- height: 1px;
74
- margin: auto;
75
- content: '';
76
- background-color: white;
77
- }
78
-
79
- &::after {
80
- position: absolute;
81
- top: 0;
82
- bottom: 0;
83
- left: 0;
84
- width: 1px;
85
- height: 100%;
86
- content: '';
87
- background-color: white;
88
- }
89
-
90
- &:last-child::after {
91
- height: 15px;
92
- }
93
- }
94
-
95
- li:first-child {
96
- padding-top: 5px;
97
-
98
- &::before {
99
- top: 20px;
100
- }
101
- }
102
- `;
103
- function SubTitles({ items }) {
104
- if (!items || items.length === 0)
105
- return null;
106
- return (_jsx("ul", { css: subTitleStyle, children: items.map(({ shortcuts = [], title }) => (_jsx("li", { children: _jsxs("div", { style: styles.titleContainer, children: [_jsx("span", { style: { ...styles.title, fontSize: '0.7rem' }, children: title }), _jsx(ShortCuts, { style: { padding: '0.1rem' }, shortcuts: shortcuts })] }) }, title))) }));
107
- }
@@ -1,2 +0,0 @@
1
- declare function FormattingTabContent(): import("@emotion/react/jsx-runtime").JSX.Element;
2
- export default FormattingTabContent;
@@ -1,80 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- /** @jsxImportSource @emotion/react */
3
- import { css } from '@emotion/react';
4
- import { v4 } from '@lukeed/uuid';
5
- import { useFormikContext } from 'formik';
6
- import lodashGet from 'lodash/get';
7
- import { FaPlus, FaTimes } from 'react-icons/fa';
8
- import Button from '../../../elements/Button';
9
- import { GroupPane } from '../../../elements/GroupPane';
10
- import FormikInput from '../../../elements/formik/FormikInput';
11
- const styles = css `
12
- .counter-col {
13
- width: 30px;
14
- }
15
-
16
- .nucleus-label-col {
17
- display: flex;
18
- justify-content: center;
19
- width: 80px;
20
- }
21
-
22
- .input {
23
- width: 100% !important;
24
- margin: 0 !important;
25
- }
26
-
27
- .nucleus-format-input-col {
28
- text-align: center;
29
- width: 100px;
30
- }
31
-
32
- th {
33
- font-size: 11px;
34
- font-weight: 600;
35
- }
36
-
37
- .operation-container {
38
- display: flex;
39
- }
40
-
41
- .add {
42
- background-color: transparent;
43
- border: 0;
44
- outline: none;
45
-
46
- svg {
47
- font-size: 14px;
48
- fill: green;
49
- }
50
- }
51
- `;
52
- function FormattingTabContent() {
53
- const { values, setFieldValue } = useFormikContext();
54
- const nuclei = lodashGet(values, 'formatting.nuclei', {});
55
- function deleteHandler(key) {
56
- const _nuclei = {};
57
- for (const nucleus in nuclei) {
58
- if (nucleus !== key) {
59
- _nuclei[nucleus] = nuclei[nucleus];
60
- }
61
- }
62
- void setFieldValue('formatting.nuclei', _nuclei);
63
- }
64
- function addHandler() {
65
- const newFormat = {
66
- name: '',
67
- ppm: '0.00',
68
- hz: '0.00',
69
- };
70
- const key = v4();
71
- const newNuclei = { ...nuclei, [key]: newFormat };
72
- void setFieldValue('formatting.nuclei', newNuclei);
73
- }
74
- const nucleiList = Object.keys(nuclei);
75
- return (_jsx(GroupPane, { text: "Number formatting for crosshair and info line", children: _jsx("div", { css: styles, children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "counter-col", children: "#" }), _jsx("th", { className: "nucleus-label-col", children: "Nucleus " }), _jsx("th", { className: "nucleus-format-input-col", children: "\u03B4 (ppm)" }), _jsx("th", { className: "nucleus-format-input-col", children: "Coupling (Hz)" }), _jsx("th", { className: "nucleus-format-input-col" })] }) }), _jsx("tbody", { children: nucleiList?.map((key, index) => {
76
- const num = index + 1;
77
- return (_jsxs("tr", { children: [_jsxs("td", { className: "counter-col", children: [_jsxs("span", { children: [num, " - "] }), ' '] }), _jsx("td", { className: "nucleus-label-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.name`, className: "input", checkErrorAfterInputTouched: false }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.ppm`, className: "input" }) }), _jsx("td", { className: "nucleus-format-input-col", children: _jsx(FormikInput, { name: `formatting.nuclei.${key}.hz`, className: "input" }) }), _jsxs("td", { className: "operation-container", children: [_jsx(Button.Danger, { style: { fontSize: '14px' }, fill: "clear", onClick: () => deleteHandler(key), children: _jsx(FaTimes, {}) }), nucleiList.length === index + 1 && (_jsx(Button.Done, { fill: "clear", style: { fontSize: '14px' }, onClick: addHandler, children: _jsx(FaPlus, {}) }))] })] }, key));
78
- }) })] }) }) }));
79
- }
80
- export default FormattingTabContent;
@@ -1,2 +0,0 @@
1
- import { Formatting } from 'nmr-load-save';
2
- export declare function mapNucleiFormatting(formatting: Formatting): Formatting;
@@ -1,10 +0,0 @@
1
- export function mapNucleiFormatting(formatting) {
2
- const { nuclei, ...res } = formatting;
3
- return {
4
- nuclei: Object.fromEntries(Object.keys(nuclei).map((key) => [
5
- nuclei[key].name.trim().toLowerCase(),
6
- nuclei[key],
7
- ])),
8
- ...res,
9
- };
10
- }