nmrium 0.31.0 → 0.33.0-pre.1667632695
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +1 -1
- package/lib/component/1d/FooterBanner.js +17 -10
- package/lib/component/1d/LinesSeries.js +1 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +1 -1
- package/lib/component/1d/XAxis.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +2 -1
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
- package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
- package/lib/component/1d/integral/IntegralIndicator.js +27 -0
- package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
- package/lib/component/1d/integral/IntegralResizable.js +69 -0
- package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
- package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
- package/lib/component/1d/multiplicityTree/buildTreeNode.js +3 -3
- package/lib/component/1d/peaks/PeakAnnotation.js +1 -1
- package/lib/component/1d/peaks/usePeakShapesPath.js +10 -6
- package/lib/component/1d/ranges/Range.js +27 -50
- package/lib/component/1d/tool/PeakPointer.js +1 -1
- package/lib/component/1d/utilities/scale.js +2 -2
- package/lib/component/2d/Contours.js +61 -42
- package/lib/component/2d/FooterBanner.js +2 -2
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/2d/Viewer2D.js +11 -14
- package/lib/component/2d/tools/XYLabelPointer.js +2 -2
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
- package/lib/component/2d/zones/IndicationLines.js +5 -8
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/EventsTrackers/KeysListenerTracker.js +14 -15
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +6 -6
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/assignment/actions/initAssignment.js +17 -17
- package/lib/component/assignment/index.js +2 -2
- package/lib/component/context/PreferencesContext.js +3 -6
- package/lib/component/elements/Button.js +1 -1
- package/lib/component/elements/CheckBoxCell.js +1 -1
- package/lib/component/elements/ContextMenu.js +2 -2
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +21 -8
- package/lib/component/elements/GroupPane.d.ts +12 -0
- package/lib/component/elements/GroupPane.js +14 -0
- package/lib/component/elements/Input.js +7 -4
- package/lib/component/elements/IsotopesViewer.js +1 -1
- package/lib/component/elements/Label.js +1 -2
- package/lib/component/elements/MolecularFormulaInput.js +2 -0
- package/lib/component/elements/NumberInput.js +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -1
- package/lib/component/elements/ReactTable/ReactTable.js +72 -38
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.d.ts +3 -2
- package/lib/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
- package/lib/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
- package/lib/component/elements/ReactTable/utility/useRowSpan.js +3 -7
- package/lib/component/elements/accordion/Accordion.js +2 -2
- package/lib/component/elements/draggble/useDraggable.js +1 -3
- package/lib/component/elements/dropDownButton/DropDownList.js +1 -2
- package/lib/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColorPicker.js +5 -8
- package/lib/component/elements/formik/FormikErrorsSummary.js +2 -2
- package/lib/component/elements/formik/FormikForm.js +2 -2
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.js +12 -20
- package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.js +13 -10
- package/lib/component/elements/formik/FormikSelect.js +1 -1
- package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
- package/lib/component/elements/formik/FormikSlider.js +8 -11
- package/lib/component/elements/formik/FormikTextarea.js +1 -1
- package/lib/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
- package/lib/component/elements/popup/Alert/Provider.js +7 -7
- package/lib/component/elements/popup/Alert/index.d.ts +3 -4
- package/lib/component/elements/popup/Alert/index.js +3 -4
- package/lib/component/elements/popup/Modal/ModalContent.js +3 -1
- package/lib/component/elements/popup/Modal/Provider.js +16 -31
- package/lib/component/elements/popup/Modal/index.d.ts +4 -5
- package/lib/component/elements/popup/Modal/index.js +4 -5
- package/lib/component/header/Header.js +1 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useCombinedRefs.js +2 -2
- package/lib/component/hooks/useExport.d.ts +1 -1
- package/lib/component/hooks/useExport.js +9 -6
- package/lib/component/hooks/useFormatNumberByNucleus.js +1 -1
- package/lib/component/hooks/usePanelPreferences.js +9 -7
- package/lib/component/loader/DropZone.js +10 -2
- package/lib/component/modal/AlignSpectraModal.js +1 -1
- package/lib/component/modal/ExportAsMatrixModal.js +1 -1
- package/lib/component/modal/LoadJCAMPModal.js +2 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
- package/lib/component/modal/MultipletAnalysisModal.js +3 -3
- package/lib/component/modal/PredictSpectraModal.js +5 -5
- package/lib/component/modal/editRange/EditRangeModal.js +4 -4
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
- package/lib/component/modal/setting/DatabasesTabContent.js +25 -20
- package/lib/component/modal/setting/DisplayTabContent.js +21 -27
- package/lib/component/modal/setting/FormattingTabContent.js +10 -10
- package/lib/component/modal/setting/GeneralSettings.js +11 -14
- package/lib/component/modal/setting/GeneralTabContent.js +3 -1
- package/lib/component/modal/setting/ToolsTabContent.js +18 -19
- package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -1
- package/lib/component/modal/setting/WorkspaceItem.js +36 -48
- package/lib/component/modal/setting/settingsValidation.d.ts +58 -57
- package/lib/component/modal/setting/settingsValidation.js +14 -12
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
- package/lib/component/panels/InformationPanel.js +52 -56
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/Utilities.js +6 -6
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
- package/lib/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +2 -2
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
- package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
- package/lib/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +5 -5
- package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
- package/lib/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
- package/lib/component/panels/ZonesPanel/ZonesTable.js +8 -8
- package/lib/component/panels/databasePanel/DatabasePanel.js +5 -4
- package/lib/component/panels/databasePanel/DatabaseTable.d.ts +2 -1
- package/lib/component/panels/databasePanel/DatabaseTable.js +20 -5
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +2 -2
- package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +3 -3
- package/lib/component/reducer/Reducer.d.ts +26 -45
- package/lib/component/reducer/Reducer.js +13 -12
- package/lib/component/reducer/actions/CorrelationsActions.js +4 -4
- package/lib/component/reducer/actions/DomainActions.d.ts +2 -2
- package/lib/component/reducer/actions/DomainActions.js +52 -69
- package/lib/component/reducer/actions/FiltersActions.js +15 -6
- package/lib/component/reducer/actions/HistoryActions.js +5 -5
- package/lib/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib/component/reducer/actions/LoadActions.js +12 -0
- package/lib/component/reducer/actions/PeaksActions.js +7 -6
- package/lib/component/reducer/actions/PreferencesActions.js +20 -38
- package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
- package/lib/component/reducer/actions/RangesActions.js +28 -24
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +28 -41
- package/lib/component/reducer/actions/ZonesActions.js +11 -10
- package/lib/component/reducer/core/Constants.js +1 -1
- package/lib/component/reducer/helper/GetClosestNumber.js +2 -1
- package/lib/component/reducer/helper/Zoom1DManager.js +11 -10
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -5
- package/lib/component/reducer/helper/getStrongestPeak.d.ts +1 -1
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -3
- package/lib/component/reducer/preferences/actions/removeWorkspace.js +3 -10
- package/lib/component/reducer/preferences/actions/setPreferences.js +5 -6
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -4
- package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
- package/lib/component/tool/BrushX.js +3 -3
- package/lib/component/tool/BrushXY.js +5 -5
- package/lib/component/tool/CrossLinePointer.js +3 -3
- package/lib/component/toolbar/BasicToolBar.js +9 -8
- package/lib/component/utility/Evaluate.js +2 -2
- package/lib/component/utility/FileUtility.d.ts +2 -9
- package/lib/component/utility/FileUtility.js +11 -28
- package/lib/component/utility/GroupByInfoKey.d.ts +1 -1
- package/lib/component/utility/GroupByInfoKey.js +11 -13
- package/lib/component/utility/PathBuilder.js +1 -1
- package/lib/component/utility/PreferencesHelper.js +2 -3
- package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
- package/lib/component/utility/{Export.js → export.js} +54 -73
- package/lib/component/utility/formatNumber.d.ts +6 -1
- package/lib/component/utility/formatNumber.js +5 -4
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +4 -4
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +16 -18
- package/lib/data/Filters.js +16 -18
- package/lib/data/FiltersManager.js +4 -3
- package/lib/data/PredictionManager.js +8 -10
- package/lib/data/SpectraManager.d.ts +1 -2
- package/lib/data/SpectraManager.js +25 -60
- package/lib/data/data1d/MultipleAnalysis.js +74 -70
- package/lib/data/data1d/Spectrum1D/SumManager.js +1 -1
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
- package/lib/data/data1d/Spectrum1D/index.d.ts +24 -25
- package/lib/data/data1d/Spectrum1D/index.js +24 -25
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
- package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
- package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +35 -1
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +35 -1
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
- package/lib/data/data1d/database.js +45 -28
- package/lib/data/data1d/filter1d/apodization.js +2 -1
- package/lib/data/data1d/filter1d/fft.js +24 -7
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
- package/lib/data/data1d/filter1d/zeroFilling.js +1 -1
- package/lib/data/data2d/Processing2D.d.ts +3 -3
- package/lib/data/data2d/Processing2D.js +10 -20
- package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
- package/lib/data/data2d/Spectrum2D/contours.js +132 -0
- package/lib/data/data2d/Spectrum2D/index.d.ts +10 -11
- package/lib/data/data2d/Spectrum2D/index.js +10 -11
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
- package/lib/data/data2d/Spectrum2D/shift/getShift.js +4 -5
- package/lib/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
- package/lib/data/molecules/MoleculeManager.js +1 -1
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data1d/index.d.ts +12 -13
- package/lib/data/types/data2d/Data2D.d.ts +2 -0
- package/lib/data/types/data2d/Datum2D.d.ts +0 -1
- package/lib/data/types/data2d/index.d.ts +8 -9
- package/lib/data/utilities/RangeUtilities.js +13 -9
- package/lib/data/utilities/ZoneUtilities.js +17 -13
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/data/utilities/checkModifierKeyActivated.js +1 -2
- package/lib/data/utilities/generateChar.js +8 -6
- package/lib/data/utilities/getAtom.js +1 -1
- package/lib/data/utilities/getAtomsFromMF.js +2 -2
- package/lib/data/utilities/getColor.js +3 -3
- package/lib/data/utilities/getSum.js +6 -3
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +16 -9
- package/lib-cjs/component/1d/LinesSeries.js +1 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +1 -1
- package/lib-cjs/component/1d/XAxis.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -1
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
- package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
- package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +4 -4
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -4
- package/lib-cjs/component/1d/multiplicityTree/buildTreeNode.js +3 -3
- package/lib-cjs/component/1d/peaks/PeakAnnotation.js +1 -1
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +10 -6
- package/lib-cjs/component/1d/ranges/Range.js +27 -50
- package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
- package/lib-cjs/component/1d/utilities/scale.js +2 -2
- package/lib-cjs/component/2d/Contours.js +60 -41
- package/lib-cjs/component/2d/FooterBanner.js +2 -2
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +11 -14
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +1 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +5 -8
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +14 -15
- package/lib-cjs/component/NMRium.js +7 -7
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/assignment/actions/initAssignment.js +17 -17
- package/lib-cjs/component/assignment/index.js +2 -2
- package/lib-cjs/component/context/PreferencesContext.js +3 -6
- package/lib-cjs/component/elements/Button.js +1 -1
- package/lib-cjs/component/elements/CheckBoxCell.js +1 -1
- package/lib-cjs/component/elements/ContextMenu.js +2 -2
- package/lib-cjs/component/elements/EditableColumn.js +21 -8
- package/lib-cjs/component/elements/GroupPane.js +18 -0
- package/lib-cjs/component/elements/Input.js +7 -4
- package/lib-cjs/component/elements/IsotopesViewer.js +1 -1
- package/lib-cjs/component/elements/Label.js +1 -2
- package/lib-cjs/component/elements/MolecularFormulaInput.js +2 -0
- package/lib-cjs/component/elements/NumberInput.js +2 -2
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +71 -37
- package/lib-cjs/component/elements/ReactTable/ReactTableFlexLayout.js +2 -2
- package/lib-cjs/component/elements/ReactTable/utility/addCustomColumn.js +3 -3
- package/lib-cjs/component/elements/ReactTable/utility/useRowSpan.js +3 -7
- package/lib-cjs/component/elements/accordion/Accordion.js +2 -2
- package/lib-cjs/component/elements/draggble/useDraggable.js +1 -3
- package/lib-cjs/component/elements/dropDownButton/DropDownList.js +1 -2
- package/lib-cjs/component/elements/formik/FormikCheckBox.js +1 -1
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
- package/lib-cjs/component/elements/formik/FormikErrorsSummary.js +2 -2
- package/lib-cjs/component/elements/formik/FormikForm.js +2 -2
- package/lib-cjs/component/elements/formik/FormikInput.js +12 -20
- package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
- package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
- package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
- package/lib-cjs/component/elements/formik/FormikTextarea.js +1 -1
- package/lib-cjs/component/elements/linearAxis/LinearVerticalAxis.js +2 -2
- package/lib-cjs/component/elements/popup/Alert/Provider.js +8 -8
- package/lib-cjs/component/elements/popup/Alert/index.js +5 -5
- package/lib-cjs/component/elements/popup/Modal/ModalContent.js +3 -1
- package/lib-cjs/component/elements/popup/Modal/Provider.js +16 -31
- package/lib-cjs/component/elements/popup/Modal/index.js +7 -7
- package/lib-cjs/component/header/Header.js +1 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useCombinedRefs.js +2 -2
- package/lib-cjs/component/hooks/useExport.js +14 -11
- package/lib-cjs/component/hooks/useFormatNumberByNucleus.js +1 -1
- package/lib-cjs/component/hooks/usePanelPreferences.js +9 -7
- package/lib-cjs/component/loader/DropZone.js +10 -2
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
- package/lib-cjs/component/modal/LoadJCAMPModal.js +2 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -1
- package/lib-cjs/component/modal/MultipletAnalysisModal.js +3 -3
- package/lib-cjs/component/modal/PredictSpectraModal.js +5 -5
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +4 -4
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib-cjs/component/modal/editRange/forms/validation/EditRangeValidation.js +2 -2
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +25 -20
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +21 -27
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +10 -10
- package/lib-cjs/component/modal/setting/GeneralSettings.js +11 -14
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +3 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +18 -19
- package/lib-cjs/component/modal/setting/WorkspaceItem.js +37 -49
- package/lib-cjs/component/modal/setting/settingsValidation.js +14 -12
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +8 -7
- package/lib-cjs/component/panels/InformationPanel.js +51 -55
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +16 -17
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/ColumnHeader.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleAnalysisCodeEditor.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPreferences.js +18 -17
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisTable.js +2 -2
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/CouplingColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +8 -8
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +6 -6
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListPanel.js +3 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +6 -6
- package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +13 -17
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnHeader.js +16 -17
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +20 -21
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +12 -12
- package/lib-cjs/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -5
- package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +105 -94
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -8
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -4
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +20 -5
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +3 -3
- package/lib-cjs/component/reducer/Reducer.js +12 -11
- package/lib-cjs/component/reducer/actions/CorrelationsActions.js +4 -4
- package/lib-cjs/component/reducer/actions/DomainActions.js +52 -69
- package/lib-cjs/component/reducer/actions/FiltersActions.js +15 -6
- package/lib-cjs/component/reducer/actions/HistoryActions.js +5 -5
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib-cjs/component/reducer/actions/LoadActions.js +12 -0
- package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +20 -38
- package/lib-cjs/component/reducer/actions/RangesActions.js +28 -24
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
- package/lib-cjs/component/reducer/actions/ToolsActions.js +28 -41
- package/lib-cjs/component/reducer/actions/ZonesActions.js +11 -10
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/GetClosestNumber.js +2 -1
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +11 -10
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -5
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -3
- package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +3 -10
- package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +5 -9
- package/lib-cjs/component/reducer/preferences/utilities/mapNucleiFormatting.js +7 -5
- package/lib-cjs/component/tool/BrushX.js +3 -3
- package/lib-cjs/component/tool/BrushXY.js +5 -5
- package/lib-cjs/component/tool/CrossLinePointer.js +3 -3
- package/lib-cjs/component/toolbar/BasicToolBar.js +8 -7
- package/lib-cjs/component/utility/Evaluate.js +2 -2
- package/lib-cjs/component/utility/FileUtility.js +11 -29
- package/lib-cjs/component/utility/GroupByInfoKey.js +11 -13
- package/lib-cjs/component/utility/PathBuilder.js +1 -1
- package/lib-cjs/component/utility/PreferencesHelper.js +2 -3
- package/lib-cjs/component/utility/{Export.js → export.js} +78 -74
- package/lib-cjs/component/utility/formatNumber.js +5 -4
- package/lib-cjs/component/workspaces/exercise.js +4 -4
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +17 -35
- package/lib-cjs/data/FiltersManager.js +4 -3
- package/lib-cjs/data/PredictionManager.js +8 -10
- package/lib-cjs/data/SpectraManager.js +26 -62
- package/lib-cjs/data/data1d/MultipleAnalysis.js +74 -70
- package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/index.js +25 -25
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +6 -5
- package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +8 -10
- package/lib-cjs/data/data1d/Spectrum1D/peaks/lookupPeak.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +2 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +6 -7
- package/lib-cjs/data/data1d/database.js +45 -28
- package/lib-cjs/data/data1d/filter1d/apodization.js +2 -1
- package/lib-cjs/data/data1d/filter1d/fft.js +23 -6
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +1 -1
- package/lib-cjs/data/data1d/filter1d/zeroFilling.js +1 -1
- package/lib-cjs/data/data2d/Processing2D.js +10 -20
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
- package/lib-cjs/data/data2d/Spectrum2D/index.js +11 -11
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -4
- package/lib-cjs/data/data2d/Spectrum2D/shift/getShift.js +4 -5
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +11 -8
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +1 -2
- package/lib-cjs/data/molecules/MoleculeManager.js +1 -1
- package/lib-cjs/data/utilities/RangeUtilities.js +13 -9
- package/lib-cjs/data/utilities/ZoneUtilities.js +17 -13
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/data/utilities/checkModifierKeyActivated.js +1 -2
- package/lib-cjs/data/utilities/generateChar.js +8 -6
- package/lib-cjs/data/utilities/getAtom.js +1 -1
- package/lib-cjs/data/utilities/getAtomsFromMF.js +2 -2
- package/lib-cjs/data/utilities/getColor.js +3 -3
- package/lib-cjs/data/utilities/getSum.js +6 -3
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +36 -31
- package/lib/component/1d/IntegralResizable.js +0 -72
- package/lib/component/elements/popup/helpers.d.ts +0 -1
- package/lib/component/elements/popup/helpers.js +0 -9
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
- package/lib/data/data1d/Data1DManager.d.ts +0 -3
- package/lib/data/data1d/Data1DManager.js +0 -98
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/data2d/Data2DManager.d.ts +0 -3
- package/lib/data/data2d/Data2DManager.js +0 -34
- package/lib/data/types/data2d/Contour.d.ts +0 -4
- package/lib/data/types/data2d/Contour.js +0 -1
- package/lib/data/types/data2d/Contours.d.ts +0 -2
- package/lib/data/types/data2d/Contours.js +0 -1
- package/lib-cjs/component/1d/IntegralResizable.js +0 -77
- package/lib-cjs/component/elements/popup/helpers.js +0 -13
- package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
- package/lib-cjs/data/data1d/Data1DManager.js +0 -104
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/data2d/Data2DManager.js +0 -40
- package/lib-cjs/data/types/data2d/Contour.js +0 -2
- package/lib-cjs/data/types/data2d/Contours.js +0 -2
|
@@ -2,7 +2,7 @@ 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
4
|
const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
5
|
-
const { onSave = () => null, value, type = 'text', style, onEditStart = () => null, editStatus = false, validate = () => true, } = props;
|
|
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
8
|
useEffect(() => {
|
|
@@ -31,11 +31,9 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
31
31
|
const valid = validate(event?.target.value);
|
|
32
32
|
setValid(valid);
|
|
33
33
|
// when press Enter or Tab
|
|
34
|
-
if (valid) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
enableEdit(false);
|
|
38
|
-
}
|
|
34
|
+
if (valid && ['Enter', 'Tab'].includes(event.key)) {
|
|
35
|
+
onSave(event);
|
|
36
|
+
enableEdit(false);
|
|
39
37
|
}
|
|
40
38
|
// close edit mode if press Enter, Tab or Escape
|
|
41
39
|
if (['Escape'].includes(event.key)) {
|
|
@@ -43,11 +41,26 @@ const EditableColumn = forwardRef(function EditableColumn(props, ref) {
|
|
|
43
41
|
window.removeEventListener('mousedown', mouseClickCallback);
|
|
44
42
|
}
|
|
45
43
|
}, [mouseClickCallback, onSave, validate]);
|
|
46
|
-
return (_jsxs("div", { style: {
|
|
44
|
+
return (_jsxs("div", { style: {
|
|
45
|
+
display: 'table',
|
|
46
|
+
width: '100%',
|
|
47
|
+
height: '100%',
|
|
48
|
+
...(textOverFlowEllipses
|
|
49
|
+
? { whiteSpace: 'nowrap', overflow: 'hidden', display: 'inline-flex' }
|
|
50
|
+
: {}),
|
|
51
|
+
...style,
|
|
52
|
+
}, className: "editable-column-input", onDoubleClick: startEditHandler, children: [!enabled && (_jsx("span", { style: {
|
|
53
|
+
display: 'table-cell',
|
|
54
|
+
verticalAlign: 'middle',
|
|
55
|
+
width: 'inherit',
|
|
56
|
+
...(textOverFlowEllipses
|
|
57
|
+
? { textOverflow: 'ellipsis', overflow: 'hidden' }
|
|
58
|
+
: {}),
|
|
59
|
+
}, children: value })), enabled && (_jsx("div", { style: { display: 'table-cell', verticalAlign: 'middle' }, children: _jsx(Input, { style: {
|
|
47
60
|
inputWrapper: {
|
|
48
61
|
width: '100%',
|
|
49
62
|
...(!isValid && { borderColor: 'red' }),
|
|
50
63
|
},
|
|
51
|
-
}, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler }) }))] }));
|
|
64
|
+
}, enableAutoSelect: true, className: "editable-column", value: value, type: type, onKeyUp: editHandler, ...InputProps }) }))] }));
|
|
52
65
|
});
|
|
53
66
|
export default EditableColumn;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
interface GroupPaneProps {
|
|
3
|
+
text: string;
|
|
4
|
+
style?: {
|
|
5
|
+
header?: CSSProperties;
|
|
6
|
+
container?: CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
renderHeader?: (text: string) => ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function GroupPane(props: GroupPaneProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const styles = {
|
|
3
|
+
header: {
|
|
4
|
+
fontSize: '13px',
|
|
5
|
+
color: '#2ca8ff',
|
|
6
|
+
marginBottom: '10px',
|
|
7
|
+
borderBottom: '0.55px solid #f9f9f9',
|
|
8
|
+
padding: '6px 2px',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export function GroupPane(props) {
|
|
12
|
+
const { text, style, children, renderHeader } = props;
|
|
13
|
+
return (_jsxs("div", { style: style?.container, children: [!renderHeader ? (_jsx("p", { style: { ...styles.header, ...style?.header }, children: text })) : (renderHeader(text)), children] }));
|
|
14
|
+
}
|
|
@@ -36,10 +36,13 @@ const styles = {
|
|
|
36
36
|
padding: 0,
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
|
+
function identity(value) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
39
42
|
const Input = forwardRef(({ value = '', name, style = {
|
|
40
43
|
input: {},
|
|
41
44
|
inputWrapper: {},
|
|
42
|
-
}, onChange = () => null, debounceTime = 0, onKeyDown = () => null, onKeyUp = () => null, checkValue = () => true, type = 'text', enableAutoSelect = false, className, format = () =>
|
|
45
|
+
}, 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, onClear, ...props }, ref) => {
|
|
43
46
|
const [val, setVal] = useState(value);
|
|
44
47
|
const valueRef = useRef(value);
|
|
45
48
|
const localRef = useRef();
|
|
@@ -69,7 +72,7 @@ const Input = forwardRef(({ value = '', name, style = {
|
|
|
69
72
|
e.preventDefault();
|
|
70
73
|
function check(value) {
|
|
71
74
|
if (type === 'number') {
|
|
72
|
-
const pattern = /^(
|
|
75
|
+
const pattern = /^(?:-?\d*|\d+)(?:\.\d{0,20})?$/;
|
|
73
76
|
if (value.trim() === '' || pattern.test(value)) {
|
|
74
77
|
return true;
|
|
75
78
|
}
|
|
@@ -129,10 +132,10 @@ const Input = forwardRef(({ value = '', name, style = {
|
|
|
129
132
|
}, [onClear]);
|
|
130
133
|
return (_jsxs("div", { style: {
|
|
131
134
|
...styles.inputWrapper,
|
|
132
|
-
...
|
|
135
|
+
...style?.inputWrapper,
|
|
133
136
|
}, className: `input ${className || ''}`, children: [renderIcon?.(), _jsx("input", { ...props, ref: combinedRef, name: name, style: {
|
|
134
137
|
...styles.input,
|
|
135
|
-
...
|
|
138
|
+
...style?.input,
|
|
136
139
|
}, 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" }) }))] }));
|
|
137
140
|
});
|
|
138
141
|
export default Input;
|
|
@@ -3,7 +3,7 @@ function IsotopesViewer({ value = '', ...othersProps }) {
|
|
|
3
3
|
return (_jsx("div", { ...othersProps,
|
|
4
4
|
// eslint-disable-next-line react/no-danger
|
|
5
5
|
dangerouslySetInnerHTML: {
|
|
6
|
-
__html: value.replace(/(?<isotope
|
|
6
|
+
__html: value.replace(/(?<isotope>\d+)/g, '<sup>$<isotope></sup>'),
|
|
7
7
|
} }));
|
|
8
8
|
}
|
|
9
9
|
export default IsotopesViewer;
|
|
@@ -2,8 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
export default function Label(props) {
|
|
3
3
|
const { title, className = '', children, style, ...otherProps } = props;
|
|
4
4
|
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', ...style?.container }, children: [_jsx("label", { className: className, style: {
|
|
5
|
-
fontSize: '
|
|
6
|
-
fontWeight: 'bold',
|
|
5
|
+
fontSize: '12px',
|
|
7
6
|
color: '#232323',
|
|
8
7
|
paddingRight: '10px',
|
|
9
8
|
width: 'max-content',
|
|
@@ -34,10 +34,10 @@ const NumberInput = forwardRef(({ label, name, defaultValue = 0, style = { label
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
const _ref = ref
|
|
37
|
+
const _ref = ref || localRef;
|
|
38
38
|
_ref.current.value = Number(defaultValue);
|
|
39
39
|
}
|
|
40
40
|
}, [defaultValue, onChange, ref]);
|
|
41
|
-
return (_jsxs("div", { style: { ...styles.container, ...style.container }, children: [_jsx("span", { style: { ...styles.label, ...style.label }, children: label }), _jsx("div", { style: { ...styles.inputContainer, ...style.inputContainer }, children: _jsx("input", { ref: ref
|
|
41
|
+
return (_jsxs("div", { style: { ...styles.container, ...style.container }, children: [_jsx("span", { style: { ...styles.label, ...style.label }, children: label }), _jsx("div", { style: { ...styles.inputContainer, ...style.inputContainer }, children: _jsx("input", { ref: ref || localRef, name: name, style: { ...styles.input, ...style.input }, type: "number", pattern: pattern, defaultValue: defaultValue, step: step, onChange: changeHander, onInput: onInput, min: min, max: max }, defaultValue) })] }));
|
|
42
42
|
});
|
|
43
43
|
export default NumberInput;
|
|
@@ -11,11 +11,12 @@ interface ReactTableProps extends ClickEvent {
|
|
|
11
11
|
}> | null;
|
|
12
12
|
approxItemHeight?: number;
|
|
13
13
|
groupKey?: string;
|
|
14
|
+
indexKey?: string;
|
|
14
15
|
enableVirtualScroll?: boolean;
|
|
15
16
|
highlightActiveRow?: boolean;
|
|
17
|
+
totalCount?: number;
|
|
16
18
|
}
|
|
17
19
|
export interface TableVirtualConfig {
|
|
18
|
-
offsetHeight: number;
|
|
19
20
|
scrollHeight: number;
|
|
20
21
|
numberOfVisibleRows: number;
|
|
21
22
|
index: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
+
/* eslint-disable unicorn/prefer-logical-operator-over-ternary */
|
|
2
3
|
/** @jsxImportSource @emotion/react */
|
|
3
4
|
import { useRef, useCallback, memo, forwardRef, useState, useEffect, } from 'react';
|
|
4
5
|
import { useTable, useSortBy } from 'react-table';
|
|
5
6
|
import { useMeasure } from 'react-use';
|
|
6
7
|
import checkModifierKeyActivated from '../../../data/utilities/checkModifierKeyActivated';
|
|
7
|
-
import useCombinedRefs from '../../hooks/useCombinedRefs';
|
|
8
8
|
import ContextMenu from '../ContextMenu';
|
|
9
9
|
import ReactTableHeader from './Elements/ReactTableHeader';
|
|
10
10
|
import ReactTableRow from './Elements/ReactTableRow';
|
|
@@ -18,11 +18,24 @@ const styles = {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
+
const counterStyle = {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
bottom: 0,
|
|
24
|
+
width: '100%',
|
|
25
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
textAlign: 'center',
|
|
28
|
+
fontWeight: 'bolder',
|
|
29
|
+
color: 'white',
|
|
30
|
+
fontSize: '1.4em',
|
|
31
|
+
};
|
|
21
32
|
const ReactTableInner = forwardRef(function ReactTableInner(props, ref) {
|
|
22
|
-
const { data, columns, highlightedSource, context = null, onScroll, approxItemHeight = 40, enableVirtualScroll = false, groupKey, onClick, highlightActiveRow = false, } = props;
|
|
33
|
+
const { data, columns, highlightedSource, context = null, onScroll, approxItemHeight = 40, enableVirtualScroll = false, groupKey, onClick, highlightActiveRow = false, totalCount, indexKey = 'index', } = props;
|
|
23
34
|
const contextRef = useRef(null);
|
|
24
35
|
const { index: indexBoundary } = useReactTableContext();
|
|
25
36
|
const [rowIndex, setRowIndex] = useState();
|
|
37
|
+
const timeoutIdRef = useRef();
|
|
38
|
+
const [isCounterVisible, setCounterVisibility] = useState(false);
|
|
26
39
|
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, rowSpanHeaders, } = useTable({
|
|
27
40
|
columns,
|
|
28
41
|
data,
|
|
@@ -40,46 +53,64 @@ const ReactTableInner = forwardRef(function ReactTableInner(props, ref) {
|
|
|
40
53
|
setRowIndex(row.index);
|
|
41
54
|
onClick?.(event, row);
|
|
42
55
|
}, [onClick]);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
function scrollHandler(e) {
|
|
57
|
+
if (enableVirtualScroll) {
|
|
58
|
+
onScroll(e);
|
|
59
|
+
}
|
|
60
|
+
if (timeoutIdRef.current) {
|
|
61
|
+
clearTimeout(timeoutIdRef.current);
|
|
62
|
+
setCounterVisibility(true);
|
|
63
|
+
}
|
|
64
|
+
timeoutIdRef.current = setTimeout(() => {
|
|
65
|
+
setCounterVisibility(false);
|
|
66
|
+
}, 1000);
|
|
67
|
+
}
|
|
68
|
+
const index = rowsData[rowsData.length - 1]?.original[indexKey] ||
|
|
69
|
+
rowsData[rowsData.length - 1]?.index;
|
|
70
|
+
const total = totalCount ? totalCount : data.length;
|
|
71
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { ref: ref, className: "table-container", style: {
|
|
72
|
+
overflowY: 'auto',
|
|
73
|
+
position: 'relative',
|
|
74
|
+
height: '100%',
|
|
75
|
+
}, onScroll: scrollHandler, children: [enableVirtualScroll && (_jsx("div", { style: {
|
|
76
|
+
height: approxItemHeight * data.length,
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
width: '100%',
|
|
79
|
+
pointerEvents: 'none',
|
|
80
|
+
} })), _jsxs("table", { ...getTableProps(), css: ReactTableStyle, style: styles.table(enableVirtualScroll), children: [_jsx(ReactTableHeader, { headerGroups: headerGroups }), _jsx("tbody", { ...getTableBodyProps(), children: rowsData.map((row, index) => {
|
|
81
|
+
prepareRow(row);
|
|
82
|
+
prepareRowSpan(rows, enableVirtualScroll ? index + indexBoundary.start : index, rowSpanHeaders, groupKey);
|
|
83
|
+
return (_jsx(ReactTableRow, { row: row, ...row.getRowProps(), onContextMenu: (e) => contextMenuHandler(e, row), onClick: highlightActiveRow ? clickHandler : onClick, highlightedSource: highlightedSource, isRowActive: rowIndex === index }, row.key));
|
|
84
|
+
}) })] }), _jsx(ContextMenu, { ref: contextRef, context: context })] }), enableVirtualScroll && (_jsxs("p", { style: {
|
|
85
|
+
...counterStyle,
|
|
86
|
+
opacity: !isCounterVisible ? '0' : '1',
|
|
87
|
+
transition: 'all 0.5s',
|
|
88
|
+
visibility: !isCounterVisible ? 'hidden' : 'visible',
|
|
89
|
+
}, children: [index + 1, " / ", total] }))] }));
|
|
57
90
|
});
|
|
58
91
|
function ReactTable(props) {
|
|
59
92
|
const { data, approxItemHeight = 40, groupKey } = props;
|
|
60
|
-
const
|
|
93
|
+
const containerRef = useRef(null);
|
|
61
94
|
const [mRef, { height }] = useMeasure();
|
|
62
|
-
const combineRef = useCombinedRefs([mRef, ref]);
|
|
63
95
|
const [tableVirtualConfig, setTableVirtualConfig] = useState({
|
|
64
|
-
offsetHeight: 0,
|
|
65
96
|
scrollHeight: 0,
|
|
66
97
|
numberOfVisibleRows: 0,
|
|
67
98
|
index: { start: 0, end: 0 },
|
|
68
99
|
});
|
|
69
100
|
useEffect(() => {
|
|
70
|
-
if (
|
|
71
|
-
const { scrollHeight } =
|
|
72
|
-
const
|
|
101
|
+
if (containerRef.current) {
|
|
102
|
+
const { scrollHeight } = containerRef.current;
|
|
103
|
+
const header = containerRef.current.querySelectorAll('thead');
|
|
104
|
+
const numberOfVisibleRows = Math.ceil((height - header[0].clientHeight) / approxItemHeight);
|
|
73
105
|
setTableVirtualConfig((prev) => ({
|
|
74
106
|
...prev,
|
|
75
|
-
offsetHeight: height,
|
|
76
107
|
scrollHeight,
|
|
77
|
-
numberOfVisibleRows,
|
|
78
|
-
index: { start: 0, end: numberOfVisibleRows
|
|
108
|
+
numberOfVisibleRows: numberOfVisibleRows - 1,
|
|
109
|
+
index: { start: 0, end: numberOfVisibleRows },
|
|
79
110
|
}));
|
|
80
111
|
}
|
|
81
|
-
}, [approxItemHeight,
|
|
82
|
-
|
|
112
|
+
}, [approxItemHeight, height]);
|
|
113
|
+
function lookForGroupIndex(currentIndex, side) {
|
|
83
114
|
const currentItem = data[currentIndex];
|
|
84
115
|
if (currentItem.index && groupKey) {
|
|
85
116
|
switch (side) {
|
|
@@ -108,24 +139,24 @@ function ReactTable(props) {
|
|
|
108
139
|
}
|
|
109
140
|
}
|
|
110
141
|
return currentIndex;
|
|
111
|
-
}
|
|
112
|
-
|
|
142
|
+
}
|
|
143
|
+
function findStartIndex(index, numberOfVisibleRows) {
|
|
113
144
|
const newIndex = index - numberOfVisibleRows;
|
|
114
145
|
const currentIndx = newIndex >= data.length ? newIndex : index;
|
|
115
146
|
// return currentIndx;
|
|
116
147
|
// Look for the first index of the group
|
|
117
148
|
return lookForGroupIndex(currentIndx, -1);
|
|
118
|
-
}
|
|
119
|
-
|
|
149
|
+
}
|
|
150
|
+
function findEndIndex(index, numberOfVisibleRows) {
|
|
120
151
|
const newIndex = index + numberOfVisibleRows;
|
|
121
152
|
const currentIndx = newIndex >= data.length ? data.length - 1 : newIndex;
|
|
122
153
|
// return currentIndx;
|
|
123
154
|
// Look for the last index of the group
|
|
124
155
|
return lookForGroupIndex(currentIndx, 1);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
const { scrollTop } =
|
|
156
|
+
}
|
|
157
|
+
function scrollHandler() {
|
|
158
|
+
if (containerRef.current && tableVirtualConfig) {
|
|
159
|
+
const { scrollTop } = containerRef.current;
|
|
129
160
|
const { numberOfVisibleRows, index } = tableVirtualConfig;
|
|
130
161
|
const currentIndx = Math.ceil(scrollTop / approxItemHeight);
|
|
131
162
|
const start = findStartIndex(currentIndx, numberOfVisibleRows);
|
|
@@ -137,7 +168,10 @@ function ReactTable(props) {
|
|
|
137
168
|
});
|
|
138
169
|
}
|
|
139
170
|
}
|
|
140
|
-
}
|
|
141
|
-
return (_jsx(ReactTableProvider, { value: tableVirtualConfig, children: _jsx(
|
|
171
|
+
}
|
|
172
|
+
return (_jsx(ReactTableProvider, { value: tableVirtualConfig, children: _jsx("div", { ref: mRef, style: {
|
|
173
|
+
position: 'relative',
|
|
174
|
+
height: '100%',
|
|
175
|
+
}, children: _jsx(ReactTableInner, { onScroll: scrollHandler, ref: containerRef, ...{ ...props } }) }) }));
|
|
142
176
|
}
|
|
143
177
|
export default memo(ReactTable);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
-
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
3
|
interface ReactTableFlexLayoutProps {
|
|
4
4
|
data: any;
|
|
5
5
|
columns: any;
|
|
6
6
|
onMouseDown?: () => void;
|
|
7
|
+
style?: CSSProperties;
|
|
7
8
|
}
|
|
8
|
-
declare function ReactTableFlexLayout({ data, columns, onMouseDown, }: ReactTableFlexLayoutProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function ReactTableFlexLayout({ data, columns, onMouseDown, style, }: ReactTableFlexLayoutProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
10
|
declare const _default: import("react").MemoExoticComponent<typeof ReactTableFlexLayout>;
|
|
10
11
|
export default _default;
|
|
@@ -3,12 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { useTable, useSortBy, useFlexLayout } from 'react-table';
|
|
5
5
|
import { ReactTableStyle } from './Style';
|
|
6
|
-
function ReactTableFlexLayout({ data, columns, onMouseDown = () => null, }) {
|
|
6
|
+
function ReactTableFlexLayout({ data, columns, onMouseDown = () => null, style = {}, }) {
|
|
7
7
|
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({
|
|
8
8
|
columns,
|
|
9
9
|
data,
|
|
10
10
|
}, useSortBy, useFlexLayout);
|
|
11
|
-
return (_jsxs("table", { ...getTableProps(), css: ReactTableStyle, style: { height: '100%' }, children: [_jsx("thead", { children: headerGroups.map((headerGroup) => (_jsx("tr", { ...headerGroup.getHeaderGroupProps(), children: headerGroup.headers.map((column) => (_jsxs("th", { ...column.getHeaderProps(column.getSortByToggleProps()), children: [column.render('Header'), _jsx("span", { children: column.isSorted ? (column.isSortedDesc ? ' ▼' : ' ▲') : '' })] }, column.getHeaderProps().key))) }, headerGroup.getHeaderGroupProps().key))) }), _jsx("tbody", { ...getTableBodyProps(), style: { display: 'block', height: '100%', overflowY: 'auto' }, children: rows.map((row) => {
|
|
11
|
+
return (_jsxs("table", { ...getTableProps(), css: ReactTableStyle, style: { height: '100%', ...style }, children: [_jsx("thead", { children: headerGroups.map((headerGroup) => (_jsx("tr", { ...headerGroup.getHeaderGroupProps(), children: headerGroup.headers.map((column) => (_jsxs("th", { ...column.getHeaderProps(column.getSortByToggleProps()), children: [column.render('Header'), _jsx("span", { children: column.isSorted ? (column.isSortedDesc ? ' ▼' : ' ▲') : '' })] }, column.getHeaderProps().key))) }, headerGroup.getHeaderGroupProps().key))) }), _jsx("tbody", { ...getTableBodyProps(), style: { display: 'block', height: '100%', overflowY: 'auto' }, children: rows.map((row) => {
|
|
12
12
|
prepareRow(row);
|
|
13
13
|
return (_jsx("tr", { ...row.getRowProps(), onMouseDown: onMouseDown, children: row.cells.map((cell) => {
|
|
14
14
|
return (_jsx("td", { ...cell.getCellProps(), style: { ...cell.getCellProps().style, padding: '0px' }, children: cell.render('Cell') }, cell.getCellProps().key));
|
|
@@ -2,9 +2,9 @@ export default function addCustomColumn(array, options) {
|
|
|
2
2
|
const { index, Header = () => null, extraParams, accessor = null, Cell = null, sortType = 'basic', enableRowSpan = false, style = {}, id, } = options || {};
|
|
3
3
|
array.push({
|
|
4
4
|
index,
|
|
5
|
-
...
|
|
6
|
-
...
|
|
7
|
-
...
|
|
5
|
+
...(id && { id }),
|
|
6
|
+
...(accessor && { accessor }),
|
|
7
|
+
...(Cell && { Cell }),
|
|
8
8
|
Header,
|
|
9
9
|
sortType,
|
|
10
10
|
enableRowSpan,
|
|
@@ -3,13 +3,9 @@ export default function useRowSpan(hooks) {
|
|
|
3
3
|
}
|
|
4
4
|
function reducer(instance) {
|
|
5
5
|
const { allColumns } = instance;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (enableRowSpan !== undefined && enableRowSpan !== false) {
|
|
10
|
-
rowSpanHeaders.push({ id, cellValue: null, cellIndex: 0 });
|
|
11
|
-
}
|
|
12
|
-
});
|
|
6
|
+
const rowSpanHeaders = allColumns
|
|
7
|
+
.filter(({ enableRowSpan }) => enableRowSpan !== undefined && enableRowSpan !== false)
|
|
8
|
+
.map(({ id }) => ({ id, cellValue: null, cellIndex: 0 }));
|
|
13
9
|
Object.assign(instance, {
|
|
14
10
|
rowSpanHeaders,
|
|
15
11
|
});
|
|
@@ -52,10 +52,10 @@ function Accordion({ children, defaultOpenIndex = 0 }) {
|
|
|
52
52
|
if (prevState.length > 0) {
|
|
53
53
|
return prevState.map((e, i) => !forcedOpenedElementsRef.current[i] ? i === defaultOpenIndex : e);
|
|
54
54
|
}
|
|
55
|
-
forcedOpenedElementsRef.current = Array(children.length)
|
|
55
|
+
forcedOpenedElementsRef.current = new Array(children.length)
|
|
56
56
|
.fill(false)
|
|
57
57
|
.map((e) => e);
|
|
58
|
-
return Array(children.length)
|
|
58
|
+
return new Array(children.length)
|
|
59
59
|
.fill(false)
|
|
60
60
|
.map((e, i) => (i === defaultOpenIndex ? true : e));
|
|
61
61
|
});
|
|
@@ -14,9 +14,7 @@ export default function useDraggable(props) {
|
|
|
14
14
|
const classes = e.target.getAttribute('class')?.split(' ') || [];
|
|
15
15
|
if ((dragHandleClassName && classes.includes(dragHandleClassName)) ||
|
|
16
16
|
!dragHandleClassName) {
|
|
17
|
-
const _parentElement = parentElement
|
|
18
|
-
? parentElement
|
|
19
|
-
: eventTarget?.parentElement;
|
|
17
|
+
const _parentElement = parentElement || eventTarget?.parentElement;
|
|
20
18
|
if (_parentElement) {
|
|
21
19
|
const parentBounding = _parentElement.getBoundingClientRect();
|
|
22
20
|
const currentBounding = eventTarget?.getBoundingClientRect();
|
|
@@ -14,6 +14,6 @@ function FormikCheckBox(props) {
|
|
|
14
14
|
onChange(e);
|
|
15
15
|
setFieldValue(name, reverse ? value : !value);
|
|
16
16
|
}, [name, onChange, reverse, setFieldValue, value]);
|
|
17
|
-
return (_jsxs("div", { className: `${className} check-${value}`, style: style.container
|
|
17
|
+
return (_jsxs("div", { className: `${className} check-${value}`, style: style.container || {}, children: [label && (_jsx("label", { htmlFor: name, className: "checkbox-label", style: style.label || {}, children: label })), _jsx(CheckBox, { ...resProps, name: name, checked: value, onChange: changeHandler, style: style.checkbox || {} })] }));
|
|
18
18
|
}
|
|
19
19
|
export default FormikCheckBox;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
interface FormikColorPickerProps {
|
|
3
3
|
name: string;
|
|
4
4
|
onColorChange?: (element: any) => void;
|
|
5
|
-
triggerSubmit?: boolean;
|
|
6
5
|
}
|
|
7
6
|
declare function FormikColorPicker(props: FormikColorPickerProps): JSX.Element;
|
|
8
7
|
declare const _default: import("react").MemoExoticComponent<typeof FormikColorPicker>;
|
|
@@ -2,18 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ColorPicker } from 'analysis-ui-components';
|
|
3
3
|
import { useFormikContext } from 'formik';
|
|
4
4
|
import lodashGet from 'lodash/get';
|
|
5
|
-
import {
|
|
5
|
+
import { memo } from 'react';
|
|
6
6
|
import { COLORS } from '../../../data/utilities/getColor';
|
|
7
7
|
function FormikColorPicker(props) {
|
|
8
|
-
const { onColorChange = () => null, name
|
|
9
|
-
const { values, setFieldValue
|
|
10
|
-
|
|
8
|
+
const { onColorChange = () => null, name } = props;
|
|
9
|
+
const { values, setFieldValue } = useFormikContext();
|
|
10
|
+
function colorChangeHandler(color) {
|
|
11
11
|
setFieldValue(name, `${color.hex}${Math.round(color.rgb.a * 255).toString(16)}`, false);
|
|
12
12
|
onColorChange(color);
|
|
13
|
-
|
|
14
|
-
setTimeout(submitForm, 1);
|
|
15
|
-
}
|
|
16
|
-
}, [name, onColorChange, setFieldValue, submitForm, triggerSubmit]);
|
|
13
|
+
}
|
|
17
14
|
return (_jsx(ColorPicker, { color: { hex: lodashGet(values, name, '#000') }, presetColors: COLORS, onChangeComplete: colorChangeHandler, style: { boxShadow: 'none' } }));
|
|
18
15
|
}
|
|
19
16
|
export default memo(FormikColorPicker);
|
|
@@ -17,14 +17,14 @@ const styles = {
|
|
|
17
17
|
const getErrors = (errorObj) => {
|
|
18
18
|
const result = [];
|
|
19
19
|
function errorsIterators(obj) {
|
|
20
|
-
|
|
20
|
+
for (const key in obj) {
|
|
21
21
|
if (typeof obj[key] === 'object') {
|
|
22
22
|
errorsIterators(obj[key]);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
result.push(obj[key]);
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
errorsIterators(errorObj);
|
|
30
30
|
return result;
|
|
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Formik } from 'formik';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
const FormikForm = forwardRef((props, ref) => {
|
|
5
|
-
const { onSubmit = () => null, initialValues = {}, validationSchema = null, } = props;
|
|
6
|
-
return (_jsx(Formik, { innerRef: ref, initialValues: initialValues, onSubmit: onSubmit, validationSchema: validationSchema, children: _jsx(_Fragment, { children:
|
|
5
|
+
const { onSubmit = () => null, initialValues = {}, validationSchema = null, children, } = props;
|
|
6
|
+
return (_jsx(Formik, { innerRef: ref, initialValues: initialValues, onSubmit: onSubmit, validationSchema: validationSchema, children: _jsx(_Fragment, { children: children }) }));
|
|
7
7
|
});
|
|
8
8
|
export default FormikForm;
|
|
@@ -3,7 +3,6 @@ import { InputProps } from '../Input';
|
|
|
3
3
|
interface FormikInputProps extends InputProps {
|
|
4
4
|
name: string;
|
|
5
5
|
checkErrorAfterInputTouched?: boolean;
|
|
6
|
-
triggerSubmit?: boolean;
|
|
7
6
|
}
|
|
8
7
|
declare function FormikInput(props: FormikInputProps): JSX.Element;
|
|
9
8
|
export default FormikInput;
|
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useFormikContext } from 'formik';
|
|
3
3
|
import lodashGet from 'lodash/get';
|
|
4
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
5
4
|
import Input from '../Input';
|
|
5
|
+
function identity(value) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
6
8
|
function FormikInput(props) {
|
|
7
|
-
const { name, style = { label: {}, input: {} }, onChange = () => null, checkValue = () => true, type = 'text', className = '', value = null, format = () =>
|
|
8
|
-
const { values, handleChange,
|
|
9
|
-
|
|
9
|
+
const { name, style = { label: {}, input: {} }, onChange = () => null, checkValue = () => true, type = 'text', className = '', value = null, format = () => identity, checkErrorAfterInputTouched = true, ...resProps } = props;
|
|
10
|
+
const { values, handleChange, errors, touched } = useFormikContext();
|
|
11
|
+
function changeHandler(e) {
|
|
10
12
|
onChange(e);
|
|
11
13
|
handleChange(e);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}, [name, setFieldValue, submitForm, triggerSubmit, value]);
|
|
21
|
-
const isInvalid = useMemo(() => {
|
|
22
|
-
if (checkErrorAfterInputTouched) {
|
|
23
|
-
return lodashGet(errors, name) && lodashGet(touched, name);
|
|
24
|
-
}
|
|
25
|
-
return lodashGet(errors, name);
|
|
26
|
-
}, [checkErrorAfterInputTouched, errors, name, touched]);
|
|
27
|
-
return (_jsx(Input, { name: name, value: value ? value : lodashGet(values, name), onChange: changeHandler, type: type, style: {
|
|
14
|
+
}
|
|
15
|
+
let isInvalid = lodashGet(errors, name);
|
|
16
|
+
if (checkErrorAfterInputTouched) {
|
|
17
|
+
isInvalid = lodashGet(errors, name) && lodashGet(touched, name);
|
|
18
|
+
}
|
|
19
|
+
return (_jsx(Input, { name: name, value: value || lodashGet(values, name), onChange: changeHandler, type: type, style: {
|
|
28
20
|
...style,
|
|
29
21
|
inputWrapper: {
|
|
30
22
|
...style.input,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
interface FormikOnChangeProps {
|
|
3
|
-
onChange?: (
|
|
3
|
+
onChange?: (value: any) => void;
|
|
4
4
|
enableValidation?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const _default: import("react").MemoExoticComponent<(props: FormikOnChangeProps) => null>;
|