nmrium 0.43.0 → 0.43.1-pre.1692874523

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 (124) hide show
  1. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -2
  2. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +2 -2
  3. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
  4. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +2 -2
  5. package/lib/component/2d/Viewer2D.js +1 -3
  6. package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -2
  7. package/lib/component/context/DispatchContext.d.ts +3 -1
  8. package/lib/component/elements/CounterLabel.d.ts +7 -0
  9. package/lib/component/elements/CounterLabel.js +12 -0
  10. package/lib/component/elements/EditableColumn.js +12 -6
  11. package/lib/component/elements/Input.d.ts +3 -12
  12. package/lib/component/elements/Input.js +24 -76
  13. package/lib/component/elements/Message.js +0 -1
  14. package/lib/component/elements/PreferencesButton.d.ts +4 -0
  15. package/lib/component/elements/PreferencesButton.js +6 -0
  16. package/lib/component/elements/formik/FormikInput.d.ts +2 -2
  17. package/lib/component/elements/formik/FormikInput.js +3 -6
  18. package/lib/component/header/Header.js +1 -1
  19. package/lib/component/header/ZeroFillingOptionsPanel.js +4 -4
  20. package/lib/component/main/InnerNMRiumContents.js +1 -2
  21. package/lib/component/modal/AlignSpectraModal.js +78 -29
  22. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +5 -1
  23. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -15
  24. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  25. package/lib/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  26. package/lib/component/modal/aboutUs/AboutUsZakodium.d.ts +1 -0
  27. package/lib/component/modal/aboutUs/AboutUsZakodium.js +33 -0
  28. package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  29. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  30. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  31. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  32. package/lib/component/modal/setting/settingsValidation.js +5 -1
  33. package/lib/component/panels/InformationPanel.js +9 -100
  34. package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  35. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  36. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +10 -6
  37. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
  38. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +5 -5
  39. package/lib/component/panels/Panels.js +6 -7
  40. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  41. package/lib/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  42. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  43. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  44. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  45. package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  46. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -3
  47. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +2 -3
  48. package/lib/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +8 -9
  49. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +18 -1
  50. package/lib/component/panels/databasePanel/DatabasePanel.js +3 -40
  51. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +18 -0
  52. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +53 -0
  53. package/lib/component/panels/header/DefaultPanelHeader.js +4 -10
  54. package/lib/component/panels/predictionPanel/PredictionPanel.js +2 -2
  55. package/lib/component/reducer/IgnoreActions.js +1 -0
  56. package/lib/component/reducer/Reducer.d.ts +2 -2
  57. package/lib/component/reducer/Reducer.js +4 -2
  58. package/lib/component/reducer/actions/DomainActions.js +2 -3
  59. package/lib/component/reducer/actions/MoleculeActions.js +3 -3
  60. package/lib/component/reducer/actions/PreferencesActions.js +1 -2
  61. package/lib/component/reducer/actions/ToolsActions.js +10 -10
  62. package/lib/component/reducer/core/Constants.d.ts +0 -4
  63. package/lib/component/reducer/core/Constants.js +0 -5
  64. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -2
  65. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  66. package/lib/component/toolbar/ToolTypes.js +23 -24
  67. package/lib/data/constants/References.d.ts +5 -3
  68. package/lib/data/data1d/Spectrum1D/getReferenceShift.d.ts +10 -1
  69. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  70. package/lib/versionInfo.js +1 -1
  71. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +1 -2
  72. package/lib-cjs/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +16 -16
  73. package/lib-cjs/component/2d/Viewer2D.js +1 -3
  74. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +1 -2
  75. package/lib-cjs/component/elements/CounterLabel.js +16 -0
  76. package/lib-cjs/component/elements/EditableColumn.js +12 -6
  77. package/lib-cjs/component/elements/Input.js +23 -75
  78. package/lib-cjs/component/elements/Message.js +0 -1
  79. package/lib-cjs/component/elements/PreferencesButton.js +13 -0
  80. package/lib-cjs/component/elements/formik/FormikInput.js +3 -6
  81. package/lib-cjs/component/header/Header.js +1 -1
  82. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +4 -4
  83. package/lib-cjs/component/main/InnerNMRiumContents.js +1 -2
  84. package/lib-cjs/component/modal/AlignSpectraModal.js +100 -28
  85. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +11 -17
  86. package/lib-cjs/component/modal/MultipletAnalysisModal.js +1 -1
  87. package/lib-cjs/component/modal/{AboutUsModal.js → aboutUs/AboutUsModal.js} +4 -3
  88. package/lib-cjs/component/modal/aboutUs/AboutUsZakodium.js +39 -0
  89. package/lib-cjs/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  90. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  91. package/lib-cjs/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  92. package/lib-cjs/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +1 -1
  93. package/lib-cjs/component/modal/setting/settingsValidation.js +4 -0
  94. package/lib-cjs/component/panels/InformationPanel.js +7 -98
  95. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
  96. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +2 -2
  97. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +4 -5
  98. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  99. package/lib-cjs/component/panels/Panels.js +6 -7
  100. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  101. package/lib-cjs/component/panels/RangesPanel/TableColumns/RelativeColumn.js +1 -1
  102. package/lib-cjs/component/panels/RangesPanel/TableColumns/SignalDeltaColumn.js +1 -1
  103. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +1 -2
  104. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +2 -2
  105. package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
  106. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +4 -5
  107. package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalDeltaColumn.js +7 -8
  108. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +3 -40
  109. package/lib-cjs/component/panels/databasePanel/DatabaseSearchOptions.js +60 -0
  110. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -9
  111. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +2 -2
  112. package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
  113. package/lib-cjs/component/reducer/Reducer.js +4 -2
  114. package/lib-cjs/component/reducer/actions/DomainActions.js +2 -3
  115. package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
  116. package/lib-cjs/component/reducer/actions/PreferencesActions.js +1 -2
  117. package/lib-cjs/component/reducer/actions/ToolsActions.js +9 -9
  118. package/lib-cjs/component/reducer/core/Constants.js +1 -6
  119. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +1 -2
  120. package/lib-cjs/component/toolbar/ToolTypes.js +23 -24
  121. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +1 -1
  122. package/lib-cjs/versionInfo.js +1 -1
  123. package/package.json +3 -3
  124. /package/lib/component/modal/{AboutUsModal.d.ts → aboutUs/AboutUsModal.d.ts} +0 -0
@@ -4,7 +4,6 @@ import { memo } from 'react';
4
4
  import { useChartData } from '../context/ChartContext';
5
5
  import { useScale } from '../context/ScaleContext';
6
6
  import useSpectraByActiveNucleus from '../hooks/useSpectraPerNucleus';
7
- import { DISPLAYER_MODE } from '../reducer/core/Constants';
8
7
  import ExclusionZoneAnnotation from './ExclusionZoneAnnotation';
9
8
  function ExclusionZonesAnnotationsInner({ displayerKey, xDomains, spectra, shiftY, }) {
10
9
  return (_jsx("g", { className: "spectrum-exclusion-zones-group", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: spectra
@@ -20,7 +19,7 @@ function ExclusionZonesAnnotations() {
20
19
  const { displayerKey, xDomains, displayerMode } = useChartData();
21
20
  const { shiftY } = useScale();
22
21
  const spectra = useSpectraByActiveNucleus();
23
- if (displayerMode !== DISPLAYER_MODE.DM_1D)
22
+ if (displayerMode !== '1D')
24
23
  return null;
25
24
  return (_jsx(MemoizedPeakAnnotations, { spectra: spectra, displayerKey: displayerKey, xDomains: xDomains, shiftY: shiftY }));
26
25
  }
@@ -1,13 +1,13 @@
1
1
  import { Ranges, Zones } from 'nmr-processing';
2
2
  import { MoleculeView, StateMoleculeExtended } from '../../../../data/molecules/Molecule';
3
- import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
3
+ import { DisplayerMode } from '../../../reducer/Reducer';
4
4
  interface DraggableStructureProps {
5
5
  zones: Zones;
6
6
  ranges: Ranges;
7
7
  molecule: StateMoleculeExtended;
8
8
  moleculeView: MoleculeView;
9
9
  activeTab: string;
10
- displayerMode: DISPLAYER_MODE;
10
+ displayerMode: DisplayerMode;
11
11
  index?: number;
12
12
  }
13
13
  export declare function DraggableStructure(props: DraggableStructureProps): import("@emotion/react/jsx-runtime").JSX.Element | null;
@@ -36,7 +36,7 @@ export function DraggableStructure(props) {
36
36
  const { zones, ranges, molecule, activeTab, displayerMode, index, moleculeView, } = props;
37
37
  const { viewerRef } = useGlobal();
38
38
  const dispatch = useDispatch();
39
- const openMoleculeEditor = useMoleculeEditor();
39
+ const { modal, openMoleculeEditor } = useMoleculeEditor();
40
40
  const { currentDiaIDsToHighlight, handleOnAtomHover, handleOnClickAtom, assignedDiaIDsMerged, } = useAtomAssignment({ zones, ranges, activeTab, displayerMode });
41
41
  function floatMoleculeHandler() {
42
42
  dispatch({
@@ -58,20 +58,20 @@ export function DraggableStructure(props) {
58
58
  }
59
59
  if (!viewerRef)
60
60
  return null;
61
- return (_jsx(Rnd, { default: moleculeView.floating.bounding, minWidth: 90 + AUTO_CROP_MARGIN * 2, minHeight: 100 + AUTO_CROP_MARGIN * 2, dragHandleClassName: "handle", enableUserSelectHack: false, bounds: viewerRef, style: { zIndex: 1 }, className: "draggable-molecule", onResizeStop: (e, dir, eRef, { width, height }) => dragFloatMoleculeHandler({ width, height }), onDragStop: (e, { x, y }) => {
61
+ return (_jsxs(Rnd, { default: moleculeView.floating.bounding, minWidth: 90 + AUTO_CROP_MARGIN * 2, minHeight: 100 + AUTO_CROP_MARGIN * 2, dragHandleClassName: "handle", enableUserSelectHack: false, bounds: viewerRef, style: { zIndex: 1 }, className: "draggable-molecule", onResizeStop: (e, dir, eRef, { width, height }) => dragFloatMoleculeHandler({ width, height }), onDragStop: (e, { x, y }) => {
62
62
  dragFloatMoleculeHandler({ x, y });
63
- }, resizeHandleWrapperStyle: { backgroundColor: 'white' }, css: style, children: _jsxs("div", { className: "content", onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(ResponsiveChart, { children: ({ width, height }) => {
64
- return (_jsx(OCLnmr, { OCL: OCL, id: `molSVG${index || ''}`, autoCrop: true, autoCropMargin: AUTO_CROP_MARGIN, height: height - AUTO_CROP_MARGIN * 2, width: width - AUTO_CROP_MARGIN * 2, label: molecule.label, labelFontSize: 15, labelColor: "rgb(0,0,0)", molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
65
- ? currentDiaIDsToHighlight
66
- : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
67
- dispatch({
68
- type: 'SET_MOLECULE',
69
- payload: {
70
- molfile,
71
- id: molecule.id,
72
- label: molecule.label,
73
- },
74
- });
75
- }, showAtomNumber: moleculeView.showAtomNumber }));
76
- } })] }) }));
63
+ }, resizeHandleWrapperStyle: { backgroundColor: 'white' }, css: style, children: [_jsxs("div", { className: "content", onDoubleClick: () => openMoleculeEditor(molecule), children: [_jsx(ActionsButton, { onFloatBtnClick: floatMoleculeHandler }), _jsx(ResponsiveChart, { children: ({ width, height }) => {
64
+ return (_jsx(OCLnmr, { OCL: OCL, id: `molSVG${index || ''}`, autoCrop: true, autoCropMargin: AUTO_CROP_MARGIN, height: height - AUTO_CROP_MARGIN * 2, width: width - AUTO_CROP_MARGIN * 2, label: molecule.label, labelFontSize: 15, labelColor: "rgb(0,0,0)", molfile: molecule.molfile, setSelectedAtom: handleOnClickAtom, atomHighlightColor: currentDiaIDsToHighlight?.length > 0 ? 'red' : '#FFD700', atomHighlightOpacity: 0.35, highlights: currentDiaIDsToHighlight?.length > 0
65
+ ? currentDiaIDsToHighlight
66
+ : assignedDiaIDsMerged, setHoverAtom: handleOnAtomHover, setMolfile: (molfile) => {
67
+ dispatch({
68
+ type: 'SET_MOLECULE',
69
+ payload: {
70
+ molfile,
71
+ id: molecule.id,
72
+ label: molecule.label,
73
+ },
74
+ });
75
+ }, showAtomNumber: moleculeView.showAtomNumber }));
76
+ } })] }), modal] }));
77
77
  }
@@ -1,13 +1,13 @@
1
1
  import { Zones, Ranges } from 'nmr-processing';
2
2
  import { MoleculesView, StateMoleculeExtended } from '../../../../data/molecules/Molecule';
3
- import { DISPLAYER_MODE } from '../../../reducer/core/Constants';
3
+ import { DisplayerMode } from '../../../reducer/Reducer';
4
4
  interface FloatMoleculeStructuresProps {
5
5
  zones: Zones;
6
6
  ranges: Ranges;
7
7
  molecules: StateMoleculeExtended[];
8
8
  moleculesView: MoleculesView;
9
9
  activeTab: string;
10
- displayerMode: DISPLAYER_MODE;
10
+ displayerMode: DisplayerMode;
11
11
  }
12
12
  export declare function FloatMoleculeStructuresInner(props: FloatMoleculeStructuresProps): import("react/jsx-runtime").JSX.Element | null;
13
13
  export default function FloatMoleculeStructures(): import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,6 @@ import { useChartData } from '../context/ChartContext';
9
9
  import { useDispatch } from '../context/DispatchContext';
10
10
  import Spinner from '../loader/Spinner';
11
11
  import { options } from '../toolbar/ToolTypes';
12
- import { assert } from '../utility/assert';
13
12
  import Chart2D from './Chart2D';
14
13
  import FooterBanner from './FooterBanner';
15
14
  import SlicingView from './SlicingView';
@@ -28,7 +27,6 @@ function Viewer2D({ emptyText = undefined }) {
28
27
  if (spectra?.length === 1) {
29
28
  const id = spectra[0].id;
30
29
  const spectrum = data.find((datum) => datum.id === id && !datum.info.isFid);
31
- assert(spectrum, `Spectrum with id ${id} not found`);
32
30
  return spectrum;
33
31
  }
34
32
  return null;
@@ -122,7 +120,7 @@ function Viewer2D({ emptyText = undefined }) {
122
120
  margin: 'auto',
123
121
  position: 'relative',
124
122
  overflow: 'hidden',
125
- }, children: _jsxs(MouseTracker, { style: { width: '100%', height: `100%`, position: 'absolute' }, children: [selectedTool && selectedTool === options.slicing.id && (_jsx(SlicingView, {})), _jsx(CrossLinePointer, {}), spectrumData && (_jsx(XYLabelPointer, { data1D: spectrumData, layout: DIMENSION })), _jsx(BrushXY, { brushType: BRUSH_TYPE.XY, dimensionBorder: DIMENSION.CENTER_2D }), _jsxs(_Fragment, { children: [spectrumData[0] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.X, dimensionBorder: DIMENSION.TOP_1D, height: margin.top })), spectrumData[1] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.Y, dimensionBorder: DIMENSION.LEFT_1D, width: margin.left }))] }), spectrumData && (_jsx(FooterBanner, { data1D: spectrumData, layout: DIMENSION })), _jsx(Chart2D, { spectra: spectrumData })] }) }))] })) }));
123
+ }, children: _jsxs(MouseTracker, { style: { width: '100%', height: `100%`, position: 'absolute' }, children: [selectedTool && selectedTool === options.slicing.id && (_jsx(SlicingView, {})), _jsx(CrossLinePointer, {}), _jsx(XYLabelPointer, { data1D: spectrumData, layout: DIMENSION }), _jsx(BrushXY, { brushType: BRUSH_TYPE.XY, dimensionBorder: DIMENSION.CENTER_2D }), _jsxs(_Fragment, { children: [spectrumData[0] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.X, dimensionBorder: DIMENSION.TOP_1D, height: margin.top })), spectrumData[1] && (_jsx(BrushXY, { brushType: BRUSH_TYPE.Y, dimensionBorder: DIMENSION.LEFT_1D, width: margin.left }))] }), _jsx(FooterBanner, { data1D: spectrumData, layout: DIMENSION }), _jsx(Chart2D, { spectra: spectrumData })] }) }))] })) }));
126
124
  }
127
125
  export function ViewerResponsiveWrapper(props) {
128
126
  const dispatch = useDispatch();
@@ -11,7 +11,6 @@ import { HighlightEventSource, useHighlightData } from '../highlight/index';
11
11
  import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
12
12
  import useExport from '../hooks/useExport';
13
13
  import useToolsFunctions from '../hooks/useToolsFunctions';
14
- import { DISPLAYER_MODE } from '../reducer/core/Constants';
15
14
  import { options } from '../toolbar/ToolTypes';
16
15
  function KeysListenerTracker(props) {
17
16
  const { mainDivRef } = props;
@@ -46,7 +45,7 @@ function KeysListenerTracker(props) {
46
45
  }, [mainDivRef]);
47
46
  const assignmentData = useAssignmentData();
48
47
  const allow1DTool = useMemo(() => {
49
- return displayerMode === DISPLAYER_MODE.DM_1D && data && data.length > 0;
48
+ return displayerMode === '1D' && data && data.length > 0;
50
49
  }, [data, displayerMode]);
51
50
  const deleteHandler = useCallback(async (sourceData) => {
52
51
  const { type, extra } = sourceData;
@@ -16,7 +16,9 @@ import { SpectrumActions } from '../reducer/actions/SpectrumsActions';
16
16
  import { ToolsActions } from '../reducer/actions/ToolsActions';
17
17
  import { ZonesActions } from '../reducer/actions/ZonesActions';
18
18
  import { ActionType } from '../reducer/types/ActionType';
19
- export type Action = ToolsActions | SpectrumActions | SpectraAnalysisActions | LoadActions | IntegralsActions | RangesActions | DatabaseActions | DimensionsActions | AssignmentsActions | DomainActions | PreferencesActions | PeaksActions | MoleculeActions | ZonesActions | FiltersActions | CorrelationsActions | ActionType<'INITIALIZE_NMRIUM'>;
19
+ export type Action = ToolsActions | SpectrumActions | SpectraAnalysisActions | LoadActions | IntegralsActions | RangesActions | DatabaseActions | DimensionsActions | AssignmentsActions | DomainActions | PreferencesActions | PeaksActions | MoleculeActions | ZonesActions | FiltersActions | CorrelationsActions | ActionType<'INITIALIZE_NMRIUM'> | ActionType<'SECRET_THROW_ERROR', {
20
+ randomNumber: number;
21
+ }>;
20
22
  export type Dispatch = (action: Action) => void;
21
23
  export declare const dispatchContext: import("react").Context<Dispatch>;
22
24
  export declare const DispatchProvider: import("react").Provider<Dispatch>;
@@ -0,0 +1,7 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ interface CounterLabelProps {
3
+ children: ReactNode;
4
+ style?: CSSProperties;
5
+ }
6
+ export declare function CounterLabel(props: CounterLabelProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ const labelStyle = {
3
+ margin: 0,
4
+ textAlign: 'right',
5
+ lineHeight: '22px',
6
+ padding: '0 5px',
7
+ whiteSpace: 'nowrap',
8
+ };
9
+ export function CounterLabel(props) {
10
+ const { children, style = {} } = props;
11
+ return _jsx("p", { style: { ...labelStyle, ...style }, children: children });
12
+ }
@@ -5,6 +5,7 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
5
5
  const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, textOverFlowEllipses = false, ...InputProps } = props;
6
6
  const [enabled, enableEdit] = useState();
7
7
  const [isValid, setValid] = useState(true);
8
+ const [val, setVal] = useState(value);
8
9
  useEffect(() => {
9
10
  enableEdit(editStatus);
10
11
  }, [editStatus]);
@@ -22,13 +23,13 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
22
23
  window.removeEventListener('mousedown', mouseClickCallback);
23
24
  }
24
25
  }, []);
25
- const startEditHandler = useCallback(() => {
26
+ function startEditHandler() {
26
27
  window.addEventListener('mousedown', mouseClickCallback);
27
28
  onEditStart(true);
28
29
  enableEdit(true);
29
- }, [mouseClickCallback, onEditStart]);
30
- const editHandler = useCallback((event) => {
31
- const valid = validate(event?.target.value);
30
+ }
31
+ function editHandler(event) {
32
+ const valid = validate(val);
32
33
  setValid(valid);
33
34
  // when press Enter or Tab
34
35
  if (valid && ['Enter', 'Tab'].includes(event.key)) {
@@ -40,7 +41,10 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
40
41
  enableEdit(false);
41
42
  window.removeEventListener('mousedown', mouseClickCallback);
42
43
  }
43
- }, [mouseClickCallback, onSave, validate]);
44
+ }
45
+ function handleChange(e) {
46
+ setVal(e.target.value);
47
+ }
44
48
  return (_jsxs("div", { style: {
45
49
  display: 'table',
46
50
  width: '100%',
@@ -62,8 +66,10 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
62
66
  width: '100%',
63
67
  },
64
68
  input: {
69
+ padding: '5px',
65
70
  width: '100%',
71
+ minWidth: '60px',
66
72
  },
67
- }, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler, ...InputProps }) }))] }));
73
+ }, autoSelect: true, className: "editable-column", value: val, type: type, onChange: handleChange, onKeyUp: editHandler, onMouseDown: (e) => e.stopPropagation(), ...InputProps }) }))] }));
68
74
  });
69
75
  export default EditableColumn;
@@ -1,27 +1,18 @@
1
1
  import { CSSProperties, ReactElement } from 'react';
2
- export type InputKeyboardEvent = React.KeyboardEvent & {
3
- target: {
4
- name: string;
5
- value: string | number;
6
- };
7
- };
8
2
  export interface InputStyle {
9
3
  input?: CSSProperties;
10
4
  inputWrapper?: CSSProperties;
11
5
  }
12
- export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style' | 'onKeyDown' | 'onKeyUp'> {
6
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'style'> {
13
7
  style?: InputStyle;
14
- enableAutoSelect?: boolean;
15
- debounceTime?: number;
8
+ autoSelect?: boolean;
16
9
  checkValue?: (element: number | string) => boolean;
17
10
  format?: () => (element: string) => number | string;
18
11
  renderIcon?: (() => ReactElement) | null;
19
12
  canClear?: boolean;
20
13
  onClear?: () => void;
21
- onKeyDown?: (event: InputKeyboardEvent) => void;
22
- onKeyUp?: (event: InputKeyboardEvent) => void;
23
- nullable?: boolean;
24
14
  datalist?: string[];
15
+ debounceTime?: number;
25
16
  }
26
17
  declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
27
18
  export default Input;
@@ -1,12 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import debounce from 'lodash/debounce';
3
- import { useState, useEffect, useRef, forwardRef, useMemo, } from 'react';
3
+ import { useEffect, useRef, forwardRef, useMemo, useState, } from 'react';
4
4
  import useCombinedRefs from '../hooks/useCombinedRefs';
5
5
  const styles = {
6
- label: {
7
- lineHeight: 2,
8
- userSelect: 'none',
9
- },
10
6
  inputWrapper: {
11
7
  borderRadius: '5px',
12
8
  borderWidth: '0.55px',
@@ -21,7 +17,6 @@ const styles = {
21
17
  outline: 'none',
22
18
  flex: 1,
23
19
  height: '100%',
24
- textAlign: 'center',
25
20
  width: '100%',
26
21
  },
27
22
  clearButton: {
@@ -34,103 +29,56 @@ const styles = {
34
29
  padding: 0,
35
30
  },
36
31
  };
37
- function check(value, type) {
38
- if (type === 'number') {
39
- const pattern = /^(?:-?\d*|\d+)(?:\.\d{0,20})?$/;
40
- if (value.trim() === '' || pattern.test(value)) {
41
- return true;
42
- }
43
- return false;
44
- }
45
- return true;
46
- }
47
- function identity(value) {
48
- return value;
49
- }
50
- function preventPropagate(event) {
51
- event.stopPropagation();
32
+ function mapValue(value) {
33
+ return typeof value === 'number' && value === 0 ? value : value || '';
52
34
  }
53
35
  const Input = forwardRef((props, ref) => {
54
- const { value = '', name, style = {
36
+ const { value: externalValue = undefined, name, style = {
55
37
  input: {},
56
38
  inputWrapper: {},
57
- }, onChange = () => null, debounceTime = 0, onKeyDown = () => null, onKeyUp = () => null, checkValue = () => true, type = 'text', enableAutoSelect = false, className, format = () => identity, onBlur = () => null, onFocus = () => null, renderIcon = null, canClear = false, nullable = false, onClear, datalist = [], ...otherProps } = props;
58
- const [val, setVal] = useState(value ?? '');
59
- const valueRef = useRef(value);
39
+ }, onChange, checkValue = () => true, type = 'text', autoSelect = false, className, renderIcon, canClear = false, onClear, datalist = [], debounceTime = 0, ...otherProps } = props;
40
+ const [internalValue, setInternalValue] = useState();
41
+ const value = debounceTime ? internalValue : externalValue;
60
42
  const localRef = useRef();
61
43
  const combinedRef = useCombinedRefs([ref, localRef]);
62
- const debounceOnChange = useMemo(() => debounce((val) => {
63
- onChange?.(val);
44
+ const debounceOnChange = useMemo(() => debounce((e) => {
45
+ onChange?.(e);
64
46
  }, debounceTime), [debounceTime, onChange]);
65
47
  useEffect(() => {
66
- setVal((prevVal) => (prevVal !== value ? value ?? '' : prevVal));
67
- }, [value]);
68
- useEffect(() => {
69
- if (enableAutoSelect) {
48
+ if (autoSelect) {
70
49
  combinedRef?.current?.select();
71
50
  }
72
- }, [enableAutoSelect, combinedRef]);
73
- function getValue(value) {
74
- const val = type === 'number'
75
- ? String(value).trim() === '-'
76
- ? Number(0)
77
- : nullable && !value
78
- ? null
79
- : Number(value)
80
- : nullable && !value
81
- ? null
82
- : value;
83
- return format()(val);
84
- }
51
+ }, [autoSelect, combinedRef]);
52
+ useEffect(() => {
53
+ if (debounceTime) {
54
+ setInternalValue(externalValue);
55
+ }
56
+ }, [debounceTime, externalValue]);
85
57
  function onChangeHandler(e) {
86
58
  e.stopPropagation();
87
59
  e.preventDefault();
88
- const _value = e.target.value;
89
- if (check(_value, type) && checkValue(_value)) {
90
- const formatValue = format();
91
- setVal(formatValue(_value));
92
- valueRef.current = _value;
93
- const val = {
94
- ...e,
95
- target: { name: e.target.name, value: getValue(_value) },
96
- };
60
+ const val = e.target.value;
61
+ if (checkValue(val)) {
97
62
  if (debounceTime) {
98
- debounceOnChange(val);
63
+ setInternalValue(val);
64
+ debounceOnChange(e);
99
65
  }
100
66
  else {
101
- onChange?.(val);
67
+ onChange?.(e);
102
68
  }
103
69
  }
104
70
  }
105
- function handleKeyDown(event) {
106
- onKeyDown({
107
- ...event,
108
- target: {
109
- name: event.target.name,
110
- value: getValue(valueRef.current),
111
- },
112
- });
113
- }
114
- function handleKeyUp(event) {
115
- onKeyUp({
116
- ...event,
117
- target: {
118
- name: event.target.name,
119
- value: getValue(valueRef.current),
120
- },
121
- });
122
- }
123
71
  function clearHandler() {
124
- setVal('');
72
+ localRef.current?.setAttribute('value', '');
125
73
  onClear?.();
126
74
  }
127
75
  return (_jsxs("div", { style: {
128
- ...(renderIcon || (canClear && { padding: '0 5px' })),
76
+ ...((renderIcon || canClear) && { padding: '0 5px' }),
129
77
  ...styles.inputWrapper,
130
78
  ...style?.inputWrapper,
131
79
  }, className: `input ${className || ''}`, children: [renderIcon?.(), _jsx("input", { ...otherProps, ref: combinedRef, name: name, style: {
132
80
  ...styles.input,
133
81
  ...style?.input,
134
- }, type: "text", value: val, onChange: onChangeHandler, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onKeyPress: preventPropagate, onDoubleClick: (e) => e.stopPropagation(), onFocus: onFocus, onBlur: onBlur, list: `${name || ''}-data-list` }), canClear && val && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), _jsx("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => (_jsx("option", { value: value }, value))) })] }));
82
+ }, type: type, value: mapValue(value), onChange: onChangeHandler, list: `${name || ''}-data-list` }), canClear && value && (_jsx("button", { type: "button", style: styles.clearButton, onClick: clearHandler, children: _jsx("span", { style: { display: 'block', margin: '0 auto' }, children: "\u2715" }) })), _jsx("datalist", { id: `${name || ''}-data-list`, children: datalist.map((value) => (_jsx("option", { value: value }, value))) })] }));
135
83
  });
136
84
  export default Input;
@@ -24,7 +24,6 @@ export const messagesColorPalettes = {
24
24
  function Message(props) {
25
25
  const { style = {}, type, children } = props;
26
26
  return (_jsx("div", { style: {
27
- fontSize: '1rem',
28
27
  padding: '0.375rem 0.75rem',
29
28
  borderRadius: '0.25rem',
30
29
  backgroundColor: messagesColorPalettes[type].tint,
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ type PreferencesButtonProps = Pick<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>;
3
+ export declare function PreferencesButton({ onClick }: PreferencesButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { FaCog } from 'react-icons/fa';
3
+ import ToolTip from './ToolTip/ToolTip';
4
+ export function PreferencesButton({ onClick }) {
5
+ return (_jsx(ToolTip, { title: "Preferences", popupPlacement: "left", children: _jsx("button", { type: "button", onClick: onClick, children: _jsx(FaCog, {}) }) }));
6
+ }
@@ -3,9 +3,9 @@ export interface InputMapValueFunctions {
3
3
  mapOnChangeValue?: (value: string | number) => any;
4
4
  mapValue?: (value: any) => string | number;
5
5
  }
6
- interface FormikInputProps extends InputProps, InputMapValueFunctions {
6
+ interface FormikInputProps extends InputMapValueFunctions {
7
7
  name: string;
8
8
  checkErrorAfterInputTouched?: boolean;
9
9
  }
10
- declare function FormikInput(props: FormikInputProps): import("react/jsx-runtime").JSX.Element;
10
+ declare function FormikInput(props: FormikInputProps & InputProps): import("react/jsx-runtime").JSX.Element;
11
11
  export default FormikInput;
@@ -2,14 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useFormikContext } from 'formik';
3
3
  import lodashGet from 'lodash/get';
4
4
  import Input from '../Input';
5
- function identity(value) {
6
- return value;
7
- }
8
5
  function FormikInput(props) {
9
- const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange = () => null, checkValue = () => true, type = 'text', className = '', value = null, format = () => identity, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
6
+ const { name, style = { label: {}, input: {}, inputWrapper: {} }, onChange, type = 'text', className = '', value = null, checkErrorAfterInputTouched = true, mapOnChangeValue, mapValue, ...resProps } = props;
10
7
  const { values, handleChange, errors, touched, setFieldValue } = useFormikContext();
11
8
  function changeHandler(e) {
12
- onChange(e);
9
+ onChange?.(e);
13
10
  if (mapOnChangeValue) {
14
11
  void setFieldValue(name, mapOnChangeValue(e.target.value));
15
12
  }
@@ -36,6 +33,6 @@ function FormikInput(props) {
36
33
  }
37
34
  : {}),
38
35
  },
39
- }, checkValue: checkValue, className: className, format: format, ...resProps }));
36
+ }, className: className, ...resProps }));
40
37
  }
41
38
  export default FormikInput;
@@ -11,8 +11,8 @@ import Button from '../elements/Button';
11
11
  import { Header } from '../elements/Header';
12
12
  import DropDownButton from '../elements/dropDownButton/DropDownButton';
13
13
  import { useSaveSettings } from '../hooks/useSaveSettings';
14
- import AboutUsModal from '../modal/AboutUsModal';
15
14
  import { LogsHistoryModal } from '../modal/LogsHistoryModal';
15
+ import AboutUsModal from '../modal/aboutUs/AboutUsModal';
16
16
  import GeneralSettingsModal from '../modal/setting/GeneralSettings';
17
17
  import WorkspaceItem from '../modal/setting/WorkspaceItem';
18
18
  import { options } from '../toolbar/ToolTypes';
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Formik } from 'formik';
2
3
  import { Filters } from 'nmr-processing';
3
4
  import { memo, useRef } from 'react';
4
5
  import generateNumbersPowerOfX from '../../data/utilities/generateNumbersPowerOfX';
5
6
  import { useDispatch } from '../context/DispatchContext';
6
7
  import ActionButtons from '../elements/ActionButtons';
7
8
  import Label from '../elements/Label';
9
+ import FormikCheckBox from '../elements/formik/FormikCheckBox';
10
+ import FormikOnChange from '../elements/formik/FormikOnChange';
11
+ import FormikSelect from '../elements/formik/FormikSelect';
8
12
  import { useFilter } from '../hooks/useFilter';
9
13
  import useSpectrum from '../hooks/useSpectrum';
10
14
  import { headerLabelStyle } from './Header';
11
15
  import { HeaderContainer } from './HeaderContainer';
12
- import { Formik } from 'formik';
13
- import FormikSelect from '../elements/formik/FormikSelect';
14
- import FormikCheckBox from '../elements/formik/FormikCheckBox';
15
- import FormikOnChange from '../elements/formik/FormikOnChange';
16
16
  const Sizes = generateNumbersPowerOfX(8, 21);
17
17
  function useInitZeroFillingSize() {
18
18
  const filter = useFilter(Filters.zeroFilling.id);
@@ -11,7 +11,6 @@ import { useChartData } from '../context/ChartContext';
11
11
  import Header from '../header/Header';
12
12
  import DropZone from '../loader/DropZone';
13
13
  import Panels from '../panels/Panels';
14
- import { DISPLAYER_MODE } from '../reducer/core/Constants';
15
14
  import ToolBar from '../toolbar/ToolBar';
16
15
  import { SplitPaneWrapper } from './SplitPaneWrapper';
17
16
  import { StateError } from './StateError';
@@ -77,7 +76,7 @@ export function InnerNMRiumContents(props) {
77
76
  width: '100%',
78
77
  height: '100%',
79
78
  position: 'relative',
80
- }, children: [_jsx(FloatMoleculeStructures, {}), displayerMode === DISPLAYER_MODE.DM_1D ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
79
+ }, children: [_jsx(FloatMoleculeStructures, {}), displayerMode === '1D' ? (_jsx(Viewer1D, { emptyText: emptyText })) : (_jsx(Viewer2D, { emptyText: emptyText }))] })] }), _jsx(Panels, {})] }), _jsx("div", { ref: elementsWrapperRef, id: "main-wrapper", style: {
81
80
  position: 'absolute',
82
81
  pointerEvents: 'none',
83
82
  zIndex: 2,