nmrium 0.26.0 → 0.27.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 (425) hide show
  1. package/lib/component/1d/Chart1D.js +3 -2
  2. package/lib/component/1d/FooterBanner.js +1 -1
  3. package/lib/component/1d/Integral.d.ts +2 -1
  4. package/lib/component/1d/Integral.js +5 -12
  5. package/lib/component/1d/IntegralResizable.d.ts +2 -1
  6. package/lib/component/1d/IntegralResizable.js +10 -5
  7. package/lib/component/1d/IntegralsSeries.js +3 -3
  8. package/lib/component/1d/Line.d.ts +2 -2
  9. package/lib/component/1d/PeakAnnotation.js +5 -4
  10. package/lib/component/1d/database/DatabaseElements.d.ts +3 -0
  11. package/lib/component/1d/database/DatabaseElements.js +18 -0
  12. package/lib/component/1d/database/DatabaseSpectrum.d.ts +3 -0
  13. package/lib/component/1d/database/DatabaseSpectrum.js +58 -0
  14. package/lib/component/1d/{ResurrectedDatabaseRanges.d.ts → database/ResurrectedDatabaseRanges.d.ts} +0 -0
  15. package/lib/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
  16. package/lib/component/1d/jCouplingGraph/JGraph.js +4 -10
  17. package/lib/component/1d/multiAnalysis/AnalysisRange.js +10 -5
  18. package/lib/component/1d/ranges/Range.d.ts +2 -1
  19. package/lib/component/1d/ranges/Range.js +17 -9
  20. package/lib/component/1d/ranges/Ranges.js +6 -3
  21. package/lib/component/1d/tool/XLabelPointer.js +1 -1
  22. package/lib/component/2d/Chart2D.js +2 -1
  23. package/lib/component/2d/Contours.js +4 -1
  24. package/lib/component/2d/FooterBanner.js +1 -1
  25. package/lib/component/2d/tools/XYLabelPointer.js +1 -1
  26. package/lib/component/2d/tools/slicing/HorizontalSliceChart.d.ts +2 -2
  27. package/lib/component/2d/tools/slicing/SliceScale.d.ts +1 -1
  28. package/lib/component/2d/tools/slicing/VerticalSliceChart.d.ts +2 -2
  29. package/lib/component/EventsTrackers/KeysListenerTracker.js +10 -4
  30. package/lib/component/NMRium.d.ts +5 -1
  31. package/lib/component/NMRium.js +6 -3
  32. package/lib/component/SplitPaneWrapper.d.ts +4 -0
  33. package/lib/component/SplitPaneWrapper.js +8 -0
  34. package/lib/component/context/GlobalContext.d.ts +3 -0
  35. package/lib/component/context/GlobalContext.js +1 -1
  36. package/lib/component/context/PreferencesContext.d.ts +15 -12
  37. package/lib/component/context/PreferencesContext.js +1 -1
  38. package/lib/component/elements/Button.js +1 -1
  39. package/lib/component/elements/ColorInput.js +2 -2
  40. package/lib/component/elements/ContextMenu.d.ts +8 -3
  41. package/lib/component/elements/EditableColumn.d.ts +3 -2
  42. package/lib/component/elements/EditableColumn.js +27 -20
  43. package/lib/component/elements/Input.d.ts +9 -1
  44. package/lib/component/elements/Input.js +18 -5
  45. package/lib/component/elements/Select.d.ts +1 -0
  46. package/lib/component/elements/Select.js +21 -15
  47. package/lib/component/elements/ToggleButton.d.ts +2 -1
  48. package/lib/component/elements/ToggleButton.js +2 -2
  49. package/lib/component/elements/draggble/SVGDraggable.d.ts +17 -0
  50. package/lib/component/elements/draggble/SVGDraggable.js +33 -0
  51. package/lib/component/elements/{resizer → draggble}/useDraggable.d.ts +9 -6
  52. package/lib/component/elements/draggble/useDraggable.js +70 -0
  53. package/lib/component/elements/formik/FormikColorPicker.d.ts +1 -0
  54. package/lib/component/elements/formik/FormikColorPicker.js +10 -7
  55. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +5 -4
  56. package/lib/component/elements/formik/FormikColumnFormatField.js +2 -2
  57. package/lib/component/elements/formik/FormikInput.d.ts +1 -0
  58. package/lib/component/elements/formik/FormikInput.js +6 -3
  59. package/lib/component/elements/formik/FormikSlider.d.ts +1 -0
  60. package/lib/component/elements/formik/FormikSlider.js +6 -3
  61. package/lib/component/elements/popup/Alert/Provider.js +1 -1
  62. package/lib/component/elements/resizer/DivResizer.js +17 -62
  63. package/lib/component/elements/resizer/Resizer.d.ts +3 -1
  64. package/lib/component/elements/resizer/SVGResizer.js +24 -53
  65. package/lib/component/elements/resizer/useResizer.d.ts +11 -0
  66. package/lib/component/elements/resizer/useResizer.js +65 -0
  67. package/lib/component/hooks/useExport.d.ts +1 -1
  68. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +3 -0
  69. package/lib/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +0 -9
  70. package/lib/component/hooks/usePanelPreferences.d.ts +7 -0
  71. package/lib/component/hooks/usePanelPreferences.js +54 -0
  72. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  73. package/lib/component/loader/DefaultSpinnerComponent.d.ts +3 -1
  74. package/lib/component/loader/DefaultSpinnerComponent.js +2 -2
  75. package/lib/component/loader/SpinnerContext.d.ts +3 -3
  76. package/lib/component/loader/SpinnerContext.js +2 -2
  77. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -4
  78. package/lib/component/modal/MoleculeStructureEditorModal.js +22 -1
  79. package/lib/component/modal/editRange/EditRangeModal.js +6 -5
  80. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +2 -0
  81. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
  82. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +3 -1
  83. package/lib/component/modal/editRange/forms/components/SignalsForm.js +12 -9
  84. package/lib/component/modal/setting/DatabasesTabContent.d.ts +6 -0
  85. package/lib/component/modal/setting/DatabasesTabContent.js +75 -0
  86. package/lib/component/modal/setting/DisplayTabContent.js +11 -7
  87. package/lib/component/modal/setting/FormattingTabContent.js +5 -5
  88. package/lib/component/modal/setting/GeneralSettings.js +2 -1
  89. package/lib/component/modal/setting/settingsValidation.d.ts +48 -0
  90. package/lib/component/modal/setting/settingsValidation.js +33 -27
  91. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
  92. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +0 -1
  93. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
  94. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +2 -2
  95. package/lib/component/panels/IntegralsPanel/IntegralTable.js +10 -11
  96. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +1 -1
  97. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +26 -74
  98. package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +8 -0
  99. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +38 -0
  100. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
  101. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +10 -2
  102. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +12 -1
  103. package/lib/component/panels/MoleculesPanel/Utilities.js +11 -0
  104. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +1 -1
  105. package/lib/component/panels/Panels.js +2 -3
  106. package/lib/component/panels/PeaksPanel/PeaksPanel.js +3 -3
  107. package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +1 -1
  108. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +29 -82
  109. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +1 -5
  110. package/lib/component/panels/PeaksPanel/PeaksTable.js +18 -25
  111. package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
  112. package/lib/component/panels/RangesPanel/RangesHeader.js +15 -9
  113. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -10
  114. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +1 -1
  115. package/lib/component/panels/RangesPanel/RangesPreferences.js +55 -66
  116. package/lib/component/panels/RangesPanel/RangesTable.d.ts +11 -6
  117. package/lib/component/panels/RangesPanel/RangesTable.js +3 -7
  118. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +5 -2
  119. package/lib/component/panels/RangesPanel/RangesTableRow.js +3 -3
  120. package/lib/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -2
  121. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.d.ts +2 -1
  122. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
  123. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.d.ts +2 -1
  124. package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
  125. package/lib/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -2
  126. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  127. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.d.ts +2 -2
  128. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
  129. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.d.ts +13 -0
  130. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +14 -0
  131. package/lib/component/panels/RangesPanel/TableColumns/format.js +2 -2
  132. package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.d.ts +18 -0
  133. package/lib/component/panels/SpectrumsPanel/base/setting/PlotChart.js +18 -0
  134. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.d.ts +1 -2
  135. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +7 -68
  136. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
  137. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.d.ts +1 -2
  138. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +7 -68
  139. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
  140. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
  141. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.d.ts +6 -0
  142. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +51 -0
  143. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  144. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.d.ts +5 -1
  145. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
  146. package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +1 -1
  147. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +20 -84
  148. package/lib/component/panels/ZonesPanel/ZonesTable.js +4 -1
  149. package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +5 -1
  150. package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  151. package/lib/component/panels/databasePanel/DatabasePanel.js +73 -40
  152. package/lib/component/panels/databasePanel/DatabasePreferences.js +10 -42
  153. package/lib/component/panels/databasePanel/DatabaseTable.js +23 -11
  154. package/lib/component/panels/databasePanel/useDatabases.d.ts +5 -0
  155. package/lib/component/panels/databasePanel/useDatabases.js +10 -0
  156. package/lib/component/panels/extra/placeholder/NoTableData.d.ts +3 -1
  157. package/lib/component/panels/extra/placeholder/NoTableData.js +2 -2
  158. package/lib/component/panels/extra/preferences/ColumnsHelper.js +3 -3
  159. package/lib/component/panels/extra/preferences/NucleusPreferences.d.ts +13 -0
  160. package/lib/component/panels/extra/preferences/NucleusPreferences.js +22 -0
  161. package/lib/component/panels/extra/preferences/PreferencesContainer.d.ts +6 -0
  162. package/lib/component/panels/extra/preferences/PreferencesContainer.js +10 -0
  163. package/lib/component/panels/extra/preferences/PreferencesGroup.d.ts +7 -0
  164. package/lib/component/panels/extra/preferences/PreferencesGroup.js +21 -0
  165. package/lib/component/reducer/Reducer.d.ts +358 -45
  166. package/lib/component/reducer/Reducer.js +5 -1
  167. package/lib/component/reducer/actions/LoadActions.js +2 -2
  168. package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -2
  169. package/lib/component/reducer/actions/MoleculeActions.js +15 -3
  170. package/lib/component/reducer/actions/PreferencesActions.js +1 -1
  171. package/lib/component/reducer/actions/ToolsActions.js +1 -1
  172. package/lib/component/reducer/preferences/actions/addWorkspace.d.ts +3 -0
  173. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -0
  174. package/lib/component/reducer/preferences/actions/initPreferences.d.ts +3 -0
  175. package/lib/component/reducer/preferences/actions/initPreferences.js +60 -0
  176. package/lib/component/reducer/preferences/actions/removeWorkspace.d.ts +3 -0
  177. package/lib/component/reducer/preferences/actions/removeWorkspace.js +20 -0
  178. package/lib/component/reducer/preferences/actions/resetPreferences.d.ts +3 -0
  179. package/lib/component/reducer/preferences/actions/resetPreferences.js +14 -0
  180. package/lib/component/reducer/preferences/actions/setPanelsPreferences.d.ts +3 -0
  181. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +13 -0
  182. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +3 -0
  183. package/lib/component/reducer/preferences/actions/setPreferences.js +34 -0
  184. package/lib/component/reducer/preferences/actions/setWorkspace.d.ts +3 -0
  185. package/lib/component/reducer/preferences/actions/setWorkspace.js +8 -0
  186. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +7 -0
  187. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +55 -0
  188. package/lib/component/reducer/{preferencesReducer.d.ts → preferences/preferencesReducer.d.ts} +131 -7
  189. package/lib/component/reducer/preferences/preferencesReducer.js +80 -0
  190. package/lib/component/reducer/preferences/utilites/checkKeysExists.d.ts +1 -0
  191. package/lib/component/reducer/preferences/utilites/checkKeysExists.js +14 -0
  192. package/lib/component/reducer/preferences/utilites/filterObject.d.ts +1 -0
  193. package/lib/component/reducer/preferences/utilites/filterObject.js +7 -0
  194. package/lib/component/reducer/preferences/utilites/flatObject.d.ts +1 -0
  195. package/lib/component/reducer/preferences/utilites/flatObject.js +9 -0
  196. package/lib/component/reducer/preferences/utilites/getActiveWorkspace.d.ts +3 -0
  197. package/lib/component/reducer/preferences/utilites/getActiveWorkspace.js +3 -0
  198. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.d.ts +2 -0
  199. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +4 -0
  200. package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.d.ts +5 -0
  201. package/lib/component/reducer/preferences/utilites/mapNucleiFormatting.js +8 -0
  202. package/lib/component/reducer/types/Types.d.ts +2 -0
  203. package/lib/component/reducer/types/Types.js +2 -0
  204. package/lib/component/tool/FloatMoleculeStructures/ActionsButton.d.ts +4 -0
  205. package/lib/component/tool/FloatMoleculeStructures/ActionsButton.js +7 -0
  206. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +14 -0
  207. package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +43 -0
  208. package/lib/component/tool/FloatMoleculeStructures/index.d.ts +15 -0
  209. package/lib/component/tool/FloatMoleculeStructures/index.js +28 -0
  210. package/lib/component/utility/Export.js +6 -0
  211. package/lib/component/utility/PathBuilder.js +2 -1
  212. package/lib/component/utility/formatNumber.d.ts +3 -0
  213. package/lib/component/utility/formatNumber.js +10 -0
  214. package/lib/component/utility/getUniqueNuclei.d.ts +1 -0
  215. package/lib/component/utility/getUniqueNuclei.js +10 -0
  216. package/lib/component/workspaces/Workspace.d.ts +72 -1
  217. package/lib/component/workspaces/basic.js +9 -1
  218. package/lib/component/workspaces/embedded.d.ts +2 -0
  219. package/lib/component/workspaces/embedded.js +32 -0
  220. package/lib/component/workspaces/exercise.js +2 -0
  221. package/lib/component/workspaces/index.d.ts +1 -0
  222. package/lib/component/workspaces/index.js +2 -1
  223. package/lib/component/workspaces/prediction.js +2 -0
  224. package/lib/component/workspaces/process1D.js +2 -0
  225. package/lib/data/data1d/Data1DManager.js +4 -0
  226. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.d.ts +2 -0
  227. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.js +10 -0
  228. package/lib/data/data1d/Spectrum1D/get1DDataXY.d.ts +2 -2
  229. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  230. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
  231. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
  232. package/lib/data/data1d/database.d.ts +8 -13
  233. package/lib/data/data1d/database.js +14 -19
  234. package/lib/data/data1d/filter1d/absolute.d.ts +3 -2
  235. package/lib/data/data1d/filter1d/autoPhaseCorrection.d.ts +3 -2
  236. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +3 -2
  237. package/lib/data/data1d/filter1d/centerMean.d.ts +3 -2
  238. package/lib/data/data1d/filter1d/digitalFilter.d.ts +3 -2
  239. package/lib/data/data1d/filter1d/equallySpaced.d.ts +3 -2
  240. package/lib/data/data1d/filter1d/exclusionZones.js +4 -4
  241. package/lib/data/data1d/filter1d/fft.d.ts +3 -2
  242. package/lib/data/data1d/filter1d/fft.js +2 -2
  243. package/lib/data/data1d/filter1d/fromTo.d.ts +3 -2
  244. package/lib/data/data1d/filter1d/lineBroadening.d.ts +3 -2
  245. package/lib/data/data1d/filter1d/lineBroadening.js +1 -1
  246. package/lib/data/data1d/filter1d/pareto.d.ts +3 -2
  247. package/lib/data/data1d/filter1d/pareto.js +2 -2
  248. package/lib/data/data1d/filter1d/phaseCorrection.d.ts +3 -2
  249. package/lib/data/data1d/filter1d/shiftX.d.ts +2 -1
  250. package/lib/data/data1d/filter1d/standardDeviation.d.ts +3 -2
  251. package/lib/data/data1d/filter1d/zeroFilling.d.ts +3 -2
  252. package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
  253. package/lib/data/data2d/Data2DManager.js +4 -0
  254. package/lib/data/data2d/filter2d/shiftX.d.ts +4 -3
  255. package/lib/data/data2d/filter2d/shiftX.js +2 -2
  256. package/lib/data/data2d/filter2d/shiftY.d.ts +4 -3
  257. package/lib/data/data2d/filter2d/shiftY.js +2 -2
  258. package/lib/data/molecules/Molecule.d.ts +3 -3
  259. package/lib/data/molecules/Molecule.js +7 -1
  260. package/lib/data/molecules/MoleculeManager.d.ts +4 -1
  261. package/lib/data/molecules/MoleculeManager.js +33 -2
  262. package/lib/data/types/data1d/Data1D.d.ts +3 -3
  263. package/lib/data/types/data1d/Info1D.d.ts +1 -0
  264. package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
  265. package/lib/versionInfo.js +1 -1
  266. package/lib-cjs/component/1d/Chart1D.js +3 -2
  267. package/lib-cjs/component/1d/FooterBanner.js +2 -2
  268. package/lib-cjs/component/1d/Integral.js +5 -12
  269. package/lib-cjs/component/1d/IntegralResizable.js +10 -5
  270. package/lib-cjs/component/1d/IntegralsSeries.js +3 -3
  271. package/lib-cjs/component/1d/PeakAnnotation.js +5 -4
  272. package/lib-cjs/component/1d/database/DatabaseElements.js +23 -0
  273. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +60 -0
  274. package/lib-cjs/component/1d/{ResurrectedDatabaseRanges.js → database/ResurrectedDatabaseRanges.js} +9 -6
  275. package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +4 -10
  276. package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +10 -5
  277. package/lib-cjs/component/1d/ranges/Range.js +17 -9
  278. package/lib-cjs/component/1d/ranges/Ranges.js +6 -3
  279. package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
  280. package/lib-cjs/component/2d/Chart2D.js +2 -1
  281. package/lib-cjs/component/2d/Contours.js +4 -1
  282. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  283. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  284. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +10 -4
  285. package/lib-cjs/component/NMRium.js +5 -2
  286. package/lib-cjs/component/SplitPaneWrapper.js +12 -0
  287. package/lib-cjs/component/context/GlobalContext.js +1 -1
  288. package/lib-cjs/component/context/PreferencesContext.js +1 -1
  289. package/lib-cjs/component/elements/Button.js +1 -1
  290. package/lib-cjs/component/elements/ColorInput.js +2 -2
  291. package/lib-cjs/component/elements/EditableColumn.js +27 -20
  292. package/lib-cjs/component/elements/Input.js +18 -5
  293. package/lib-cjs/component/elements/Select.js +20 -14
  294. package/lib-cjs/component/elements/ToggleButton.js +2 -2
  295. package/lib-cjs/component/elements/draggble/SVGDraggable.js +39 -0
  296. package/lib-cjs/component/elements/draggble/useDraggable.js +73 -0
  297. package/lib-cjs/component/elements/formik/FormikColorPicker.js +10 -7
  298. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +2 -2
  299. package/lib-cjs/component/elements/formik/FormikInput.js +6 -3
  300. package/lib-cjs/component/elements/formik/FormikSlider.js +6 -3
  301. package/lib-cjs/component/elements/popup/Alert/Provider.js +1 -1
  302. package/lib-cjs/component/elements/resizer/DivResizer.js +17 -62
  303. package/lib-cjs/component/elements/resizer/SVGResizer.js +24 -53
  304. package/lib-cjs/component/elements/resizer/useResizer.js +71 -0
  305. package/lib-cjs/component/{utility/FormatNumber.js → hooks/useFormatNumberByNucleus.js} +1 -11
  306. package/lib-cjs/component/hooks/usePanelPreferences.js +62 -0
  307. package/lib-cjs/component/loader/DefaultSpinnerComponent.js +2 -2
  308. package/lib-cjs/component/loader/SpinnerContext.js +2 -2
  309. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +24 -1
  310. package/lib-cjs/component/modal/editRange/EditRangeModal.js +6 -5
  311. package/lib-cjs/component/modal/editRange/forms/components/AddSignalFormTab.js +3 -6
  312. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +12 -9
  313. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +80 -0
  314. package/lib-cjs/component/modal/setting/DisplayTabContent.js +11 -7
  315. package/lib-cjs/component/modal/setting/FormattingTabContent.js +4 -4
  316. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -1
  317. package/lib-cjs/component/modal/setting/settingsValidation.js +33 -27
  318. package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +10 -5
  319. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +2 -5
  320. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +10 -11
  321. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +24 -72
  322. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +44 -0
  323. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -23
  324. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +9 -1
  325. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +11 -0
  326. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
  327. package/lib-cjs/component/panels/Panels.js +2 -3
  328. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +4 -4
  329. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +27 -80
  330. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +18 -48
  331. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +15 -9
  332. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +4 -10
  333. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +53 -64
  334. package/lib-cjs/component/panels/RangesPanel/RangesTable.js +3 -7
  335. package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +3 -3
  336. package/lib-cjs/component/panels/RangesPanel/TableColumns/AbsoluteColumn.js +2 -5
  337. package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +2 -2
  338. package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +5 -2
  339. package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeColumn.js +2 -5
  340. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +2 -2
  341. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +3 -4
  342. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.js +16 -0
  343. package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +2 -2
  344. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/PlotChart.js +21 -0
  345. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DHistogram.js +10 -68
  346. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +1 -8
  347. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +10 -68
  348. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +8 -21
  349. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +2 -2
  350. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +55 -0
  351. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  352. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +3 -2
  353. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +18 -82
  354. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +4 -1
  355. package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
  356. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +72 -39
  357. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +10 -42
  358. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +22 -10
  359. package/lib-cjs/component/panels/databasePanel/useDatabases.js +14 -0
  360. package/lib-cjs/component/panels/extra/placeholder/NoTableData.js +2 -2
  361. package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +3 -3
  362. package/lib-cjs/component/panels/extra/preferences/NucleusPreferences.js +29 -0
  363. package/lib-cjs/component/panels/extra/preferences/PreferencesContainer.js +14 -0
  364. package/lib-cjs/component/panels/extra/preferences/PreferencesGroup.js +25 -0
  365. package/lib-cjs/component/reducer/Reducer.js +5 -1
  366. package/lib-cjs/component/reducer/actions/LoadActions.js +2 -2
  367. package/lib-cjs/component/reducer/actions/MoleculeActions.js +17 -3
  368. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -1
  369. package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -1
  370. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +26 -0
  371. package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +67 -0
  372. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +24 -0
  373. package/lib-cjs/component/reducer/preferences/actions/resetPreferences.js +18 -0
  374. package/lib-cjs/component/reducer/preferences/actions/setPanelsPreferences.js +17 -0
  375. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +38 -0
  376. package/lib-cjs/component/reducer/preferences/actions/setWorkspace.js +12 -0
  377. package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +62 -0
  378. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +87 -0
  379. package/lib-cjs/component/reducer/preferences/utilites/checkKeysExists.js +18 -0
  380. package/lib-cjs/component/reducer/preferences/utilites/filterObject.js +11 -0
  381. package/lib-cjs/component/reducer/preferences/utilites/flatObject.js +13 -0
  382. package/lib-cjs/component/reducer/preferences/utilites/getActiveWorkspace.js +7 -0
  383. package/lib-cjs/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +11 -0
  384. package/lib-cjs/component/reducer/preferences/utilites/mapNucleiFormatting.js +12 -0
  385. package/lib-cjs/component/reducer/types/Types.js +5 -3
  386. package/lib-cjs/component/tool/FloatMoleculeStructures/ActionsButton.js +13 -0
  387. package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +50 -0
  388. package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +36 -0
  389. package/lib-cjs/component/utility/Export.js +6 -0
  390. package/lib-cjs/component/utility/PathBuilder.js +2 -1
  391. package/lib-cjs/component/utility/formatNumber.js +17 -0
  392. package/lib-cjs/component/utility/getUniqueNuclei.js +14 -0
  393. package/lib-cjs/component/workspaces/basic.js +9 -1
  394. package/lib-cjs/component/workspaces/embedded.js +35 -0
  395. package/lib-cjs/component/workspaces/exercise.js +2 -0
  396. package/lib-cjs/component/workspaces/index.js +2 -1
  397. package/lib-cjs/component/workspaces/prediction.js +2 -0
  398. package/lib-cjs/component/workspaces/process1D.js +2 -0
  399. package/lib-cjs/data/data1d/Data1DManager.js +4 -0
  400. package/lib-cjs/data/data1d/Spectrum1D/convertDataToFloat64Array.js +14 -0
  401. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +2 -1
  402. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +1 -1
  403. package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +2 -1
  404. package/lib-cjs/data/data1d/database.js +15 -21
  405. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +4 -4
  406. package/lib-cjs/data/data1d/filter1d/fft.js +2 -2
  407. package/lib-cjs/data/data1d/filter1d/lineBroadening.js +1 -1
  408. package/lib-cjs/data/data1d/filter1d/pareto.js +2 -2
  409. package/lib-cjs/data/data1d/filter1d/shiftX.js +2 -2
  410. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
  411. package/lib-cjs/data/data2d/Data2DManager.js +4 -0
  412. package/lib-cjs/data/data2d/filter2d/shiftX.js +4 -4
  413. package/lib-cjs/data/data2d/filter2d/shiftY.js +4 -4
  414. package/lib-cjs/data/molecules/Molecule.js +7 -1
  415. package/lib-cjs/data/molecules/MoleculeManager.js +37 -3
  416. package/lib-cjs/versionInfo.js +1 -1
  417. package/package.json +42 -40
  418. package/lib/component/elements/resizer/useDraggable.js +0 -52
  419. package/lib/component/panels/extra/preferences/defaultValues.d.ts +0 -54
  420. package/lib/component/panels/extra/preferences/defaultValues.js +0 -54
  421. package/lib/component/reducer/preferencesReducer.js +0 -269
  422. package/lib/component/utility/FormatNumber.d.ts +0 -6
  423. package/lib-cjs/component/elements/resizer/useDraggable.js +0 -55
  424. package/lib-cjs/component/panels/extra/preferences/defaultValues.js +0 -61
  425. package/lib-cjs/component/reducer/preferencesReducer.js +0 -276
@@ -244,9 +244,15 @@ function KeysListenerTracker() {
244
244
  saveAsJSONHandler,
245
245
  saveToClipboardHandler,
246
246
  ]);
247
+ function checkNotInputField(e) {
248
+ const tags = ['input', 'textarea'];
249
+ const tagName = e.composedPath()[0].tagName.toLowerCase();
250
+ if (!tags.includes(tagName))
251
+ return true;
252
+ return false;
253
+ }
247
254
  const handleOnKeyDown = useCallback((e) => {
248
- if (!['input', 'textarea'].includes(e.target.localName) &&
249
- overDisplayer) {
255
+ if (checkNotInputField(e) && overDisplayer) {
250
256
  const num = Number(e.code.substr(e.code.length - 1)) || 0;
251
257
  if (num > 0) {
252
258
  keysPreferencesListenerHandler(e, num);
@@ -269,8 +275,8 @@ function KeysListenerTracker() {
269
275
  toolsListenerHandler,
270
276
  ]);
271
277
  useEffect(() => {
272
- document.addEventListener('keydown', handleOnKeyDown, true);
273
- return () => document.removeEventListener('keydown', handleOnKeyDown, true);
278
+ document.addEventListener('keydown', handleOnKeyDown);
279
+ return () => document.removeEventListener('keydown', handleOnKeyDown);
274
280
  }, [handleOnKeyDown]);
275
281
  return null;
276
282
  }
@@ -1,11 +1,12 @@
1
1
  /** @jsxImportSource @emotion/react */
2
+ import { InitialSeparation } from 'analysis-ui-components/lib-esm/components/SplitPane';
2
3
  import { CorrelationData } from 'nmr-correlation';
3
4
  import { ReactElement, ReactNode } from 'react';
4
5
  import { Datum1D } from '../data/types/data1d';
5
6
  import { Datum2D } from '../data/types/data2d';
6
7
  import { PanelPreferencesType } from '../types/PanelPreferencesType';
7
8
  import { State } from './reducer/Reducer';
8
- export declare type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction';
9
+ export declare type NMRiumWorkspace = 'exercise' | 'process1D' | 'default' | 'prediction' | 'embedded';
9
10
  export interface NMRiumProps {
10
11
  data?: NMRiumData;
11
12
  onDataChange?: (data: State) => void;
@@ -23,6 +24,8 @@ export declare type NMRiumPreferences = Partial<{
23
24
  hideSetSumFromMolecule: boolean;
24
25
  hideGeneralSettings: boolean;
25
26
  experimentalFeatures: PanelPreferencesType;
27
+ hidePanelOnLoad: boolean;
28
+ initialPanelWidth?: InitialSeparation;
26
29
  }>;
27
30
  panels: Partial<{
28
31
  spectraPanel: PanelPreferencesType;
@@ -37,6 +40,7 @@ export declare type NMRiumPreferences = Partial<{
37
40
  multipleSpectraAnalysisPanel: PanelPreferencesType;
38
41
  databasePanel: PanelPreferencesType;
39
42
  predictionPanel: PanelPreferencesType;
43
+ automaticAssignmentPanel: PanelPreferencesType;
40
44
  }>;
41
45
  toolBarButtons: Partial<{
42
46
  zoomTool: boolean;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
- import { RootLayout, SplitPane } from 'analysis-ui-components';
4
+ import { RootLayout } from 'analysis-ui-components';
5
5
  import { useEffect, useCallback, useReducer, useMemo, useRef, memo, } from 'react';
6
6
  import { ErrorBoundary } from 'react-error-boundary';
7
7
  import { useToggle, useFullscreen } from 'react-use';
@@ -10,6 +10,7 @@ import Viewer1D from './1d/Viewer1D';
10
10
  import Viewer2D from './2d/Viewer2D';
11
11
  import ErrorOverlay from './ErrorOverlay';
12
12
  import KeysListenerTracker from './EventsTrackers/KeysListenerTracker';
13
+ import { SplitPaneWrapper } from './SplitPaneWrapper';
13
14
  import { AssignmentProvider } from './assignment';
14
15
  import { ChartDataProvider } from './context/ChartContext';
15
16
  import { DispatchProvider } from './context/DispatchContext';
@@ -25,7 +26,7 @@ import Panels from './panels/Panels';
25
26
  import checkActionType from './reducer/IgnoreActions';
26
27
  import { spectrumReducer, initialState, dispatchMiddleware, initState, } from './reducer/Reducer';
27
28
  import { DISPLAYER_MODE } from './reducer/core/Constants';
28
- import preferencesReducer, { preferencesInitialState, initPreferencesState, } from './reducer/preferencesReducer';
29
+ import preferencesReducer, { preferencesInitialState, initPreferencesState, } from './reducer/preferences/preferencesReducer';
29
30
  import { INITIATE, SET_LOADING_FLAG, SET_MOUSE_OVER_DISPLAYER, } from './reducer/types/Types';
30
31
  import ToolBar from './toolbar/ToolBar';
31
32
  const viewerContainerStyle = css `
@@ -86,6 +87,7 @@ function NMRium(props) {
86
87
  function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = defaultPreferences, getSpinner = defaultGetSpinner, onDataChange, emptyText, }) {
87
88
  const rootRef = useRef(null);
88
89
  const elementsWrapperRef = useRef(null);
90
+ const viewerRef = useRef(null);
89
91
  const [show, toggle] = useToggle(false);
90
92
  const isFullscreen = useFullscreen(rootRef, show, {
91
93
  onClose: () => {
@@ -149,6 +151,7 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
149
151
  return (_jsx(GlobalProvider, { value: {
150
152
  rootRef: rootRef.current,
151
153
  elementsWrapperRef: elementsWrapperRef.current,
154
+ viewerRef: viewerRef.current,
152
155
  }, children: _jsx(PreferencesProvider, { value: preferencesState, children: _jsx("div", { ref: mainDivRef, style: { height: '100%', position: 'relative' }, children: _jsx(AlertProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(DispatchProvider, { value: dispatchMiddleWare, children: _jsx(ChartDataProvider, { value: state, children: _jsx(ModalProvider, { wrapperRef: elementsWrapperRef.current, children: _jsx(HighlightProvider, { children: _jsx(AssignmentProvider, { spectraData: spectraData, children: _jsx(SpinnerProvider, { value: getSpinner, children: _jsx("div", { className: "nmrium-container", ref: rootRef, css: containerStyles, onContextMenu: preventContextMenuHandler, style: { height: '100%', width: '100%' }, children: _jsx(DropZone, { children: _jsxs("div", { style: {
153
156
  display: 'flex',
154
157
  flexDirection: 'column',
@@ -158,7 +161,7 @@ function InnerNMRium({ data: dataProp = defaultData, workspace, preferences = de
158
161
  display: 'flex',
159
162
  flexDirection: 'row',
160
163
  height: '100%',
161
- }, children: [_jsx(ToolBar, {}), _jsxs(SplitPane, { initialSeparation: "590px", orientation: "horizontal", sideSeparation: "end", children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, {}), _jsx("div", { "data-test-id": "viewer", style: {
164
+ }, children: [_jsx(ToolBar, {}), _jsxs(SplitPaneWrapper, { children: [_jsxs("div", { css: viewerContainerStyle, children: [_jsx(KeysListenerTracker, {}), _jsx("div", { "data-test-id": "viewer", ref: viewerRef, style: {
162
165
  width: '100%',
163
166
  height: '100%',
164
167
  }, children: displayerMode ===
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare function SplitPaneWrapper({ children }: {
3
+ children: any;
4
+ }): JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SplitPane } from 'analysis-ui-components';
3
+ import { usePreferences } from './context/PreferencesContext';
4
+ export function SplitPaneWrapper({ children }) {
5
+ const { current } = usePreferences();
6
+ const general = current?.display?.general || {};
7
+ return (_jsx(SplitPane, { initialSeparation: general?.initialPanelWidth || '560px', orientation: "horizontal", sideSeparation: "end", initialClosed: general?.hidePanelOnLoad || false, children: children }));
8
+ }
@@ -2,12 +2,15 @@
2
2
  export declare const GlobalConetxt: import("react").Context<{
3
3
  rootRef: HTMLDivElement | null;
4
4
  elementsWrapperRef: HTMLDivElement | null;
5
+ viewerRef: HTMLDivElement | null;
5
6
  }>;
6
7
  export declare const GlobalProvider: import("react").Provider<{
7
8
  rootRef: HTMLDivElement | null;
8
9
  elementsWrapperRef: HTMLDivElement | null;
10
+ viewerRef: HTMLDivElement | null;
9
11
  }>;
10
12
  export declare function useGlobal(): {
11
13
  rootRef: HTMLDivElement | null;
12
14
  elementsWrapperRef: HTMLDivElement | null;
15
+ viewerRef: HTMLDivElement | null;
13
16
  };
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext } from 'react';
2
- export const GlobalConetxt = createContext({ rootRef: null, elementsWrapperRef: null });
2
+ export const GlobalConetxt = createContext({ rootRef: null, elementsWrapperRef: null, viewerRef: null });
3
3
  export const GlobalProvider = GlobalConetxt.Provider;
4
4
  export function useGlobal() {
5
5
  return useContext(GlobalConetxt);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { PreferencesState } from '../reducer/preferencesReducer';
2
+ import { PreferencesState } from '../reducer/preferences/preferencesReducer';
3
3
  export declare const PreferencesContext: import("react").Context<PreferencesState>;
4
4
  export declare const PreferencesProvider: import("react").Provider<PreferencesState>;
5
5
  export declare function usePreferences(): {
@@ -10,6 +10,17 @@ export declare function usePreferences(): {
10
10
  };
11
11
  workspaces: Record<string, import("../workspaces/Workspace").Workspace>;
12
12
  dispatch: (action?: ({
13
+ type: "ADD_WORKSPACE";
14
+ payload: {
15
+ workspace: string;
16
+ data: Omit<import("../workspaces/Workspace").Workspace, "label" | "version">;
17
+ };
18
+ } | {
19
+ type: "SET_WORKSPACE" | "REMOVE_WORKSPACE";
20
+ payload: {
21
+ workspace: string;
22
+ };
23
+ } | {
13
24
  type: "INIT_PREFERENCES";
14
25
  payload: {
15
26
  display: Partial<{
@@ -18,6 +29,8 @@ export declare function usePreferences(): {
18
29
  hideSetSumFromMolecule: boolean;
19
30
  hideGeneralSettings: boolean;
20
31
  experimentalFeatures: import("../../types/PanelPreferencesType").PanelPreferencesType;
32
+ hidePanelOnLoad: boolean;
33
+ initialPanelWidth?: import("analysis-ui-components/lib-esm/components/SplitPane").InitialSeparation | undefined;
21
34
  }>;
22
35
  panels: Partial<{
23
36
  spectraPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
@@ -32,6 +45,7 @@ export declare function usePreferences(): {
32
45
  multipleSpectraAnalysisPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
33
46
  databasePanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
34
47
  predictionPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
48
+ automaticAssignmentPanel: import("../../types/PanelPreferencesType").PanelPreferencesType;
35
49
  }>;
36
50
  toolBarButtons: Partial<{
37
51
  zoomTool: boolean;
@@ -66,17 +80,6 @@ export declare function usePreferences(): {
66
80
  key: string;
67
81
  value: string;
68
82
  };
69
- } | {
70
- type: "SET_WORKSPACE" | "REMOVE_WORKSPACE";
71
- payload: {
72
- workspace: string;
73
- };
74
- } | {
75
- type: "ADD_WORKSPACE";
76
- payload: {
77
- workspace: string;
78
- data: Omit<import("../workspaces/Workspace").Workspace, "label" | "version">;
79
- };
80
83
  } | {
81
84
  type: "RESET_PREFERENCES";
82
85
  }) | undefined) => void;
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext, useMemo } from 'react';
2
- import { preferencesInitialState, WORKSPACES, } from '../reducer/preferencesReducer';
2
+ import { preferencesInitialState, WORKSPACES, } from '../reducer/preferences/preferencesReducer';
3
3
  import Workspaces from '../workspaces';
4
4
  export const PreferencesContext = createContext(preferencesInitialState);
5
5
  export const PreferencesProvider = PreferencesContext.Provider;
@@ -128,7 +128,7 @@ const Button = (props) => {
128
128
  borderRadius,
129
129
  }),
130
130
  style,
131
- ], ...restProps, children: _jsxs("span", { style: { flex: 1 }, children: [" ", props.children] }) }));
131
+ ], ...restProps, children: _jsxs("span", { style: { flex: 1, pointerEvents: 'none' }, children: [" ", props.children] }) }));
132
132
  };
133
133
  function ThemeButton(props) {
134
134
  const { colorTheme, ...buttonProps } = props;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
+ import { ColorPicker } from 'analysis-ui-components';
4
5
  import { useCallback, memo, useState, useEffect } from 'react';
5
- import { ChromePicker } from 'react-color';
6
6
  const style = css `
7
7
  display: flex;
8
8
  margin: 5px 0px;
@@ -83,6 +83,6 @@ function ColorInput(props) {
83
83
  setColor(hex);
84
84
  onColorChange({ ...colorEvent, hex, name });
85
85
  }, [name, onColorChange]);
86
- return (_jsxs("div", { css: style, children: [_jsx("span", { className: "inputLabel", children: label }), _jsxs("div", { style: { flex: 4 }, children: [_jsxs("div", { className: "swatch", onClick: handleClick, children: [_jsx("div", { className: "color", style: { backgroundColor: selectedColor } }), _jsx("input", { type: "hidden", value: selectedColor, name: name })] }), displayColorPicker ? (_jsxs("div", { className: "color-popover", children: [_jsx("div", { className: "cover", onClick: handleClose }), _jsx(ChromePicker, { color: { hex: selectedColor }, onChangeComplete: handleOnColorChanged })] })) : null] })] }));
86
+ return (_jsxs("div", { css: style, children: [_jsx("span", { className: "inputLabel", children: label }), _jsxs("div", { style: { flex: 4 }, children: [_jsxs("div", { className: "swatch", onClick: handleClick, children: [_jsx("div", { className: "color", style: { backgroundColor: selectedColor } }), _jsx("input", { type: "hidden", value: selectedColor, name: name })] }), displayColorPicker ? (_jsxs("div", { className: "color-popover", children: [_jsx("div", { className: "cover", onClick: handleClose }), _jsx(ColorPicker, { color: { hex: selectedColor }, onChangeComplete: handleOnColorChanged })] })) : null] })] }));
87
87
  }
88
88
  export default memo(ColorInput);
@@ -1,5 +1,10 @@
1
1
  /// <reference types="react" />
2
- declare const _default: import("react").ForwardRefExoticComponent<{
3
- context: any;
4
- } & import("react").RefAttributes<unknown>>;
2
+ interface ContextMenuItem {
3
+ onClick: <T>(data: T) => void;
4
+ label: string;
5
+ }
6
+ export interface ContextMenuProps {
7
+ context: ContextMenuItem[] | null;
8
+ }
9
+ declare const _default: import("react").ForwardRefExoticComponent<ContextMenuProps & import("react").RefAttributes<unknown>>;
5
10
  export default _default;
@@ -6,6 +6,7 @@ interface EditableColumnProps {
6
6
  editStatus?: boolean;
7
7
  value: string | number;
8
8
  style?: CSSProperties;
9
+ validate?: (value?: any) => boolean;
9
10
  }
10
- declare const _default: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
11
- export default _default;
11
+ declare const EditableColumn: import("react").ForwardRefExoticComponent<EditableColumnProps & import("react").RefAttributes<unknown>>;
12
+ export default EditableColumn;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useState, } from 'react';
3
3
  import Input from './Input';
4
- // TODO: remove this hacky ref usage.
5
- function EditableColumn(props, ref) {
6
- const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, } = props;
4
+ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
5
+ const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, } = props;
7
6
  const [enabled, enableEdit] = useState();
7
+ const [isValid, setValid] = useState(true);
8
8
  useEffect(() => {
9
9
  enableEdit(editStatus);
10
10
  }, [editStatus]);
@@ -22,25 +22,32 @@ function EditableColumn(props, ref) {
22
22
  window.removeEventListener('mousedown', mouseClickCallback);
23
23
  }
24
24
  }, []);
25
- const editModeHandler = useCallback((flag, event = null) => {
26
- if (!flag) {
27
- // when press Enter or Tab
25
+ const startEditHandler = useCallback(() => {
26
+ window.addEventListener('mousedown', mouseClickCallback);
27
+ onEditStart(true);
28
+ enableEdit(true);
29
+ }, [mouseClickCallback, onEditStart]);
30
+ const editHandler = useCallback((event) => {
31
+ const valid = validate(event?.target.value);
32
+ setValid(valid);
33
+ // when press Enter or Tab
34
+ if (valid) {
28
35
  if (['Enter', 'Tab'].includes(event.key)) {
29
36
  onSave(event);
30
- }
31
- // close edit mode if press Enter, Tab or Escape
32
- if (['Enter', 'Tab', 'Escape'].includes(event.key)) {
33
- enableEdit(flag);
34
- window.removeEventListener('mousedown', mouseClickCallback);
37
+ enableEdit(false);
35
38
  }
36
39
  }
37
- else {
38
- // start edit mode and add mouse listener to handle mouse click outside the input to finish the mode
39
- window.addEventListener('mousedown', mouseClickCallback);
40
- onEditStart(event);
41
- enableEdit(flag);
40
+ // close edit mode if press Enter, Tab or Escape
41
+ if (['Escape'].includes(event.key)) {
42
+ enableEdit(false);
43
+ window.removeEventListener('mousedown', mouseClickCallback);
42
44
  }
43
- }, [mouseClickCallback, onEditStart, onSave]);
44
- return (_jsxs("div", { style: { display: 'table', width: '100%', height: '100%', ...style }, onDoubleClick: (event) => editModeHandler(true, event), children: [!enabled && (_jsx("span", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyDown: (e) => editModeHandler(false, e) }) }))] }));
45
- }
46
- export default forwardRef(EditableColumn);
45
+ }, [mouseClickCallback, onSave, validate]);
46
+ return (_jsxs("div", { style: { display: 'table', width: '100%', height: '100%', ...style }, onDoubleClick: startEditHandler, children: [!enabled && (_jsx("span", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
47
+ inputWrapper: {
48
+ width: '100%',
49
+ ...(!isValid && { borderColor: 'red' }),
50
+ },
51
+ }, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler }) }))] }));
52
+ });
53
+ export default EditableColumn;
@@ -1,5 +1,11 @@
1
1
  import { CSSProperties, ReactElement } from 'react';
2
- export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style'> {
2
+ export declare type InputKeyboardEvent = React.KeyboardEvent & {
3
+ target: {
4
+ name: string;
5
+ value: string | number;
6
+ };
7
+ };
8
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style' | 'onKeyDown' | 'onKeyUp'> {
3
9
  style?: {
4
10
  input?: CSSProperties;
5
11
  inputWrapper?: CSSProperties;
@@ -11,6 +17,8 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
11
17
  renderIcon?: (() => ReactElement) | null;
12
18
  canClear?: boolean;
13
19
  onClear?: () => void;
20
+ onKeyDown?: (event: InputKeyboardEvent) => void;
21
+ onKeyUp?: (event: InputKeyboardEvent) => void;
14
22
  }
15
23
  declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
16
24
  export default Input;
@@ -39,8 +39,9 @@ const styles = {
39
39
  const Input = forwardRef(({ value = '', name, style = {
40
40
  input: {},
41
41
  inputWrapper: {},
42
- }, onChange = () => null, debounceTime = 0, onKeyDown = () => null, checkValue = () => true, type = 'text', enableAutoSelect = false, className, format = () => (value) => value, onBlur = () => null, onFocus = () => null, renderIcon = null, canClear = false, onClear, ...props }, ref) => {
42
+ }, onChange = () => null, debounceTime = 0, onKeyDown = () => null, onKeyUp = () => null, checkValue = () => true, type = 'text', enableAutoSelect = false, className, format = () => (value) => value, onBlur = () => null, onFocus = () => null, renderIcon = null, canClear = false, onClear, ...props }, ref) => {
43
43
  const [val, setVal] = useState(value);
44
+ const valueRef = useRef(value);
44
45
  const localRef = useRef();
45
46
  const combinedRef = useCombinedRefs([ref, localRef]);
46
47
  const debounceOnChange = useRef(debounce((value) => {
@@ -80,6 +81,7 @@ const Input = forwardRef(({ value = '', name, style = {
80
81
  if (check(_value) && checkValue(_value)) {
81
82
  const formatValue = format();
82
83
  setVal(formatValue(_value));
84
+ valueRef.current = _value;
83
85
  const val = {
84
86
  ...e,
85
87
  target: { name: e.target.name, value: getValue(_value) },
@@ -101,12 +103,23 @@ const Input = forwardRef(({ value = '', name, style = {
101
103
  type,
102
104
  ]);
103
105
  const handleKeyDown = useCallback((event) => {
104
- event.persist();
105
106
  onKeyDown({
106
107
  ...event,
107
- target: { name: event.target.name, value: getValue(val) },
108
+ target: {
109
+ name: event.target.name,
110
+ value: getValue(valueRef.current),
111
+ },
108
112
  });
109
- }, [getValue, onKeyDown, val]);
113
+ }, [getValue, onKeyDown]);
114
+ const handleKeyUp = useCallback((event) => {
115
+ onKeyUp({
116
+ ...event,
117
+ target: {
118
+ name: event.target.name,
119
+ value: getValue(valueRef.current),
120
+ },
121
+ });
122
+ }, [getValue, onKeyUp]);
110
123
  const preventPropagate = useCallback((event) => {
111
124
  event.stopPropagation();
112
125
  }, []);
@@ -120,6 +133,6 @@ const Input = forwardRef(({ value = '', name, style = {
120
133
  }, className: `input ${className || ''}`, children: [renderIcon?.(), _jsx("input", { ...props, ref: combinedRef, name: name, style: {
121
134
  ...styles.input,
122
135
  ...(style?.input ? style.input : {}),
123
- }, "data-test-id": name ? `input-${name}` : '', type: "text", value: val, onChange: onChangeHandler, onKeyDown: handleKeyDown, onKeyPress: preventPropagate, onDoubleClick: (e) => e.stopPropagation(), onFocus: onFocus, onBlur: onBlur }), canClear && val && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) }))] }));
136
+ }, "data-test-id": name ? `input-${name}` : '', type: "text", value: val, onChange: onChangeHandler, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onKeyPress: preventPropagate, onDoubleClick: (e) => e.stopPropagation(), onFocus: onFocus, onBlur: onBlur }), canClear && val && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) }))] }));
124
137
  });
125
138
  export default Input;
@@ -11,6 +11,7 @@ export interface SelectProps {
11
11
  defaultValue?: string | number;
12
12
  name?: string;
13
13
  className?: string;
14
+ placeholder?: string;
14
15
  }
15
16
  declare const Select: import("react").ForwardRefExoticComponent<SelectProps & import("react").RefAttributes<HTMLSelectElement>>;
16
17
  export default Select;
@@ -1,22 +1,14 @@
1
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
3
  import { css } from '@emotion/react';
4
4
  import { forwardRef, useCallback } from 'react';
5
5
  const arrowDownIcon = `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="960px" height="560px" viewBox="0 0 960 560" enable-background="new 0 0 960 560" xml:space="preserve"><g id="Rounded_Rectangle_33_copy_4_1_"><path d="M480,344.181L268.869,131.889c-15.756-15.859-41.3-15.859-57.054,0c-15.754,15.857-15.754,41.57,0,57.431l237.632,238.937c8.395,8.451,19.562,12.254,30.553,11.698c10.993,0.556,22.159-3.247,30.555-11.698l237.631-238.937c15.756-15.86,15.756-41.571,0-57.431s-41.299-15.859-57.051,0L480,344.181z"/></g></svg>')`;
6
- const Select = forwardRef(function Select(props, ref) {
7
- const { data, style = { width: 100 }, onChange = () => null, defaultValue, name = '', className = '', } = props;
8
- const handleOnChanged = useCallback((e) => {
9
- let value = e.target.value;
10
- if (!isNaN(value)) {
11
- value = Number(value);
12
- }
13
- onChange(value);
14
- }, [onChange]);
15
- const styles = css `
6
+ const styles = {
7
+ select: (width) => css `
16
8
  padding: 0px 5px;
17
9
  border: 0.55px solid #cacaca;
18
10
  font-size: 14px;
19
- width: ${style.width ? Number(style.width) - 5 : 115}px;
11
+ width: ${width ? Number(width) - 5 : 115}px;
20
12
  margin: 0;
21
13
  height: 100%;
22
14
  background: ${arrowDownIcon} no-repeat right white;
@@ -26,11 +18,25 @@ const Select = forwardRef(function Select(props, ref) {
26
18
  border-radius: 5px;
27
19
  margin: 0px 5px;
28
20
  align-self: center;
29
- :focus,
21
+ &:focus,
30
22
  input:focus {
31
23
  outline: none;
32
24
  }
33
- `;
34
- return (_jsx("select", { ref: ref, css: styles, name: name, onChange: handleOnChanged, defaultValue: defaultValue, className: className, style: style, children: data.map((d) => (_jsx("option", { value: d.value, children: d.label }, `${d.key}`))) }));
25
+
26
+ &:required:invalid {
27
+ color: #666;
28
+ }
29
+ `,
30
+ };
31
+ const Select = forwardRef(function Select(props, ref) {
32
+ const { data, style = { width: 100 }, onChange = () => null, defaultValue = '', name = '', className = '', placeholder = '', } = props;
33
+ const handleOnChanged = useCallback((e) => {
34
+ let value = e.target.value;
35
+ if (!isNaN(value)) {
36
+ value = Number(value);
37
+ }
38
+ onChange(value);
39
+ }, [onChange]);
40
+ return (_jsxs("select", { ref: ref, css: styles.select(style?.width), name: name, onChange: handleOnChanged, defaultValue: defaultValue, className: className, style: style, required: true, children: [placeholder && (_jsx("option", { value: "", disabled: true, children: placeholder })), data.map((d) => (_jsx("option", { value: d.value, children: d.label }, `${d.key}`)))] }));
35
41
  });
36
42
  export default Select;
@@ -8,7 +8,8 @@ interface ToggleButtonProps {
8
8
  disabled?: boolean;
9
9
  children: ReactNode;
10
10
  className?: string;
11
+ testID?: string;
11
12
  }
12
- declare function ToggleButton({ children, style, onClick, popupTitle, popupPlacement, defaultValue, disabled, className, }: ToggleButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
13
+ declare function ToggleButton({ children, style, onClick, popupTitle, popupPlacement, defaultValue, disabled, className, testID, }: ToggleButtonProps): import("@emotion/react/jsx-runtime").JSX.Element;
13
14
  declare const _default: import("react").MemoExoticComponent<typeof ToggleButton>;
14
15
  export default _default;
@@ -18,12 +18,12 @@ const styles = css `
18
18
  color: white;
19
19
  }
20
20
  `;
21
- function ToggleButton({ children, style = {}, onClick = () => null, popupTitle = '', popupPlacement = 'right', defaultValue = false, disabled = false, className = '', }) {
21
+ function ToggleButton({ children, style = {}, onClick = () => null, popupTitle = '', popupPlacement = 'right', defaultValue = false, disabled = false, className = '', testID, }) {
22
22
  const [flag, Toggle] = useState(defaultValue);
23
23
  const toggleHandler = useCallback(() => {
24
24
  onClick(!flag);
25
25
  Toggle(!flag);
26
26
  }, [onClick, flag]);
27
- return (_jsx(ToolTip, { title: popupTitle, popupPlacement: popupPlacement, children: _jsx("button", { disabled: disabled, css: styles, style: style, className: (flag ? 'toggle toggle-active ' : 'toggle ') + className, type: "button", onClick: toggleHandler, children: children }) }));
27
+ return (_jsx(ToolTip, { title: popupTitle, popupPlacement: popupPlacement, children: _jsx("button", { "data-test-id": testID, disabled: disabled, css: styles, style: style, className: (flag ? 'toggle toggle-active ' : 'toggle ') + className, type: "button", onClick: toggleHandler, children: children }) }));
28
28
  }
29
29
  export default memo(ToggleButton);
@@ -0,0 +1,17 @@
1
+ import { ReactFragment } from 'react';
2
+ import { Position } from './useDraggable';
3
+ declare type ChildType = Array<React.ReactElement> | React.ReactElement | ReactFragment | boolean | null;
4
+ declare type PositionChangeHandler = (data: Position) => void;
5
+ export interface DraggableProps {
6
+ children?: ChildType | ((x1: number, x2: number) => ChildType);
7
+ initialPosition?: Position;
8
+ width: number;
9
+ height: number;
10
+ onStart?: PositionChangeHandler;
11
+ onMove?: PositionChangeHandler;
12
+ onEnd?: PositionChangeHandler;
13
+ parentElement?: HTMLElement | null;
14
+ dragHandleClassName?: string;
15
+ }
16
+ export default function SVGDraggable(props: DraggableProps): JSX.Element;
17
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
3
+ import useDraggable from './useDraggable';
4
+ export default function SVGDraggable(props) {
5
+ const { children, initialPosition = { x: 0, y: 0 }, width, height, onStart, onMove, onEnd, parentElement, dragHandleClassName, } = props;
6
+ const { position: { value: { x, y }, action, }, onMouseDown, } = useDraggable({
7
+ position: initialPosition,
8
+ parentElement,
9
+ dragHandleClassName,
10
+ });
11
+ useEffect(() => {
12
+ const position = {
13
+ x,
14
+ y,
15
+ };
16
+ switch (action) {
17
+ case 'start':
18
+ onStart?.(position);
19
+ break;
20
+ case 'move':
21
+ onMove?.(position);
22
+ break;
23
+ case 'end':
24
+ onEnd?.(position);
25
+ break;
26
+ default:
27
+ break;
28
+ }
29
+ }, [action, onEnd, onMove, onStart, x, y]);
30
+ return (_jsx("g", { style: {
31
+ transform: `translate(${x}px,${y}px)`,
32
+ }, onMouseDown: onMouseDown, children: typeof children === 'function' ? children(width, height) : children }));
33
+ }
@@ -1,19 +1,22 @@
1
1
  /// <reference types="react" />
2
- interface UseDraggable {
2
+ export interface Position {
3
3
  x: number;
4
- anchor: Anchor;
4
+ y: number;
5
+ }
6
+ interface UseDraggable {
7
+ position: Position;
8
+ parentElement?: HTMLElement | null;
9
+ fromEdge?: boolean;
10
+ dragHandleClassName?: string;
5
11
  }
6
12
  export interface Draggable {
7
13
  onMouseDown: (event: React.MouseEvent<HTMLDivElement | SVGElement, MouseEvent>) => void;
8
14
  position: {
9
- x: number;
15
+ value: Position;
10
16
  action: Action;
11
17
  };
12
- previousPosition: number;
13
18
  isActive: boolean;
14
- anchor: Anchor;
15
19
  }
16
20
  declare type Action = 'start' | 'move' | 'end' | null;
17
- export declare type Anchor = 'RIGHT' | 'LEFT';
18
21
  export default function useDraggable(props: UseDraggable): Draggable;
19
22
  export {};