nmrium 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/IntegralResizable.js +13 -13
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +30 -31
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +5 -5
- package/lib/component/1d/ranges/Range.js +24 -33
- package/lib/component/2d/zones/Signal.js +8 -8
- package/lib/component/2d/zones/Zone.js +3 -3
- package/lib/component/EventsTrackers/KeysListenerTracker.js +1 -1
- package/lib/component/NMRium.js +22 -29
- package/lib/component/assignment/AssignmentsContext.d.ts +35 -0
- package/lib/component/assignment/AssignmentsContext.js +83 -0
- package/lib/component/assignment/AssignmentsReducer.d.ts +32 -0
- package/lib/component/assignment/AssignmentsReducer.js +39 -0
- package/lib/component/assignment/actions/initAssignment.d.ts +5 -0
- package/lib/component/assignment/actions/initAssignment.js +62 -0
- package/lib/component/assignment/actions/removeAssignment.d.ts +16 -0
- package/lib/component/assignment/actions/removeAssignment.js +24 -0
- package/lib/component/assignment/actions/setActiveAssignment.d.ts +10 -0
- package/lib/component/assignment/actions/setActiveAssignment.js +8 -0
- package/lib/component/assignment/actions/toggleAssignment.d.ts +7 -0
- package/lib/component/assignment/actions/toggleAssignment.js +44 -0
- package/lib/component/assignment/index.d.ts +0 -18
- package/lib/component/assignment/index.js +12 -266
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.d.ts +2 -0
- package/lib/component/assignment/utilities/filterForIDsWithAssignment.js +3 -0
- package/lib/component/context/GlobalContext.d.ts +12 -3
- package/lib/component/context/GlobalContext.js +1 -1
- package/lib/component/elements/ActionButtons.d.ts +10 -0
- package/lib/component/elements/ActionButtons.js +14 -0
- package/lib/component/elements/Button.d.ts +30 -5
- package/lib/component/elements/Button.js +151 -4
- package/lib/component/elements/ContextMenu.js +6 -6
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +5 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +38 -10
- package/lib/component/elements/ReactTable/ReactTable.d.ts +3 -1
- package/lib/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib/component/elements/ReactTable/Style.d.ts +1 -3
- package/lib/component/elements/ReactTable/Style.js +1 -7
- package/lib/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib/component/elements/resizer/DivResizer.d.ts +2 -0
- package/lib/component/elements/resizer/DivResizer.js +107 -0
- package/lib/component/elements/resizer/Resizer.d.ts +18 -0
- package/lib/component/elements/resizer/Resizer.js +12 -0
- package/lib/component/elements/resizer/SVGResizer.d.ts +2 -0
- package/lib/component/elements/resizer/SVGResizer.js +71 -0
- package/lib/component/elements/resizer/useDraggable.d.ts +19 -0
- package/lib/component/elements/resizer/useDraggable.js +52 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.js +4 -15
- package/lib/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib/component/header/RangesPickingOptionPanel.js +3 -16
- package/lib/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib/component/header/Zones2DOptionPanel.js +3 -14
- package/lib/component/hooks/useExport.js +11 -9
- package/lib/component/loader/DropZone.js +1 -0
- package/lib/component/modal/AlignSpectraModal.js +2 -1
- package/lib/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib/component/modal/LoadJCAMPModal.js +7 -6
- package/lib/component/modal/ModalStyle.js +4 -26
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -1
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib/component/modal/PredictSpectraModal.js +2 -7
- package/lib/component/modal/SaveAsModal.d.ts +1 -1
- package/lib/component/modal/SaveAsModal.js +2 -1
- package/lib/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib/component/modal/setting/GeneralSettings.js +3 -1
- package/lib/component/modal/setting/settingsValidation.d.ts +8 -0
- package/lib/component/modal/setting/settingsValidation.js +40 -0
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +4 -3
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.d.ts +10 -0
- package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +60 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +11 -5
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +20 -11
- package/lib/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +2 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +12 -11
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +16 -9
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +2 -3
- package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +5 -18
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.d.ts +5 -7
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.d.ts +5 -9
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumns.d.ts +4 -8
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -1
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +20 -20
- package/lib/component/panels/header/SpectraAutomaticPickingButton.d.ts +2 -0
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +30 -0
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib/component/reducer/Reducer.d.ts +2 -0
- package/lib/component/reducer/Reducer.js +4 -1
- package/lib/component/reducer/actions/AssignmentsActions.d.ts +9 -0
- package/lib/component/reducer/actions/AssignmentsActions.js +18 -0
- package/lib/component/reducer/actions/LoadActions.d.ts +1 -1
- package/lib/component/reducer/actions/LoadActions.js +10 -5
- package/lib/component/reducer/preferencesReducer.d.ts +1 -8
- package/lib/component/reducer/preferencesReducer.js +16 -16
- package/lib/component/reducer/types/Types.d.ts +1 -0
- package/lib/component/reducer/types/Types.js +1 -0
- package/lib/component/utility/Export.d.ts +3 -3
- package/lib/component/utility/Export.js +10 -9
- package/lib/component/utility/FormatNumber.js +1 -1
- package/lib/component/workspaces/Workspace.d.ts +2 -4
- package/lib/component/workspaces/basic.js +8 -9
- package/lib/data/SpectraManager.js +23 -15
- package/lib/data/data1d/Data1DManager.d.ts +1 -1
- package/lib/data/data1d/Data1DManager.js +2 -1
- package/lib/data/data1d/Spectrum1D/toJSON.d.ts +2 -0
- package/lib/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib/data/data1d/database.d.ts +1 -2
- package/lib/data/data1d/database.js +1 -1
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +1 -4
- package/lib/data/data2d/Data2DManager.d.ts +1 -1
- package/lib/data/data2d/Data2DManager.js +2 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/data2d/Spectrum2D/toJSON.d.ts +2 -0
- package/lib/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Signal2DAxisData.d.ts +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/IntegralResizable.js +12 -12
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +29 -30
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +6 -6
- package/lib-cjs/component/1d/ranges/Range.js +26 -35
- package/lib-cjs/component/2d/zones/Signal.js +9 -9
- package/lib-cjs/component/2d/zones/Zone.js +4 -4
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +2 -2
- package/lib-cjs/component/NMRium.js +22 -29
- package/lib-cjs/component/assignment/AssignmentsContext.js +88 -0
- package/lib-cjs/component/assignment/AssignmentsReducer.js +45 -0
- package/lib-cjs/component/assignment/actions/initAssignment.js +65 -0
- package/lib-cjs/component/assignment/actions/removeAssignment.js +29 -0
- package/lib-cjs/component/assignment/actions/setActiveAssignment.js +11 -0
- package/lib-cjs/component/assignment/actions/toggleAssignment.js +47 -0
- package/lib-cjs/component/assignment/index.js +15 -269
- package/lib-cjs/component/assignment/utilities/filterForIDsWithAssignment.js +7 -0
- package/lib-cjs/component/context/GlobalContext.js +1 -1
- package/lib-cjs/component/elements/ActionButtons.js +20 -0
- package/lib-cjs/component/elements/Button.js +150 -4
- package/lib-cjs/component/elements/ContextMenu.js +6 -6
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +42 -14
- package/lib-cjs/component/elements/ReactTable/ReactTable.js +7 -2
- package/lib-cjs/component/elements/ReactTable/Style.js +1 -9
- package/lib-cjs/component/elements/ToolTip/ToolTip.js +3 -2
- package/lib-cjs/component/elements/resizer/DivResizer.js +113 -0
- package/lib-cjs/component/elements/resizer/Resizer.js +18 -0
- package/lib-cjs/component/elements/resizer/SVGResizer.js +77 -0
- package/lib-cjs/component/elements/resizer/useDraggable.js +55 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +3 -14
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +2 -9
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +2 -15
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -9
- package/lib-cjs/component/header/Zones2DOptionPanel.js +2 -13
- package/lib-cjs/component/hooks/useExport.js +11 -9
- package/lib-cjs/component/loader/DropZone.js +1 -0
- package/lib-cjs/component/modal/AlignSpectraModal.js +2 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -1
- package/lib-cjs/component/modal/ImportPublicationStringModal.js +2 -1
- package/lib-cjs/component/modal/LoadJCAMPModal.js +7 -6
- package/lib-cjs/component/modal/ModalStyle.js +4 -26
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +5 -1
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +2 -1
- package/lib-cjs/component/modal/PredictSpectraModal.js +2 -7
- package/lib-cjs/component/modal/SaveAsModal.js +2 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +17 -11
- package/lib-cjs/component/modal/setting/GeneralSettings.js +3 -1
- package/lib-cjs/component/modal/setting/settingsValidation.js +66 -0
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignment.js +6 -4
- package/lib-cjs/component/panels/AutomaticAssignment/AutomaticAssignmentTable.js +13 -6
- package/lib-cjs/component/panels/AutomaticAssignment/useAutoAssignments.js +67 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +12 -6
- package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +50 -68
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +55 -60
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +15 -14
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -16
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumn.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/SignalAssignmentsColumns.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ZoneAssignmentsColumn.js +4 -4
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +2 -2
- package/lib-cjs/component/panels/ZonesPanel/ZonesTableRow.js +21 -21
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +37 -0
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -18
- package/lib-cjs/component/reducer/Reducer.js +4 -1
- package/lib-cjs/component/reducer/actions/AssignmentsActions.js +21 -0
- package/lib-cjs/component/reducer/actions/LoadActions.js +9 -4
- package/lib-cjs/component/reducer/preferencesReducer.js +16 -16
- package/lib-cjs/component/reducer/types/Types.js +2 -1
- package/lib-cjs/component/utility/Export.js +10 -9
- package/lib-cjs/component/utility/FormatNumber.js +1 -1
- package/lib-cjs/component/workspaces/basic.js +8 -9
- package/lib-cjs/data/SpectraManager.js +23 -15
- package/lib-cjs/data/data1d/Data1DManager.js +2 -1
- package/lib-cjs/data/data1d/Spectrum1D/toJSON.js +1 -0
- package/lib-cjs/data/data2d/Data2DManager.js +2 -1
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib-cjs/data/data2d/Spectrum2D/toJSON.js +1 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +25 -26
- package/lib/component/1d/Resizable.d.ts +0 -12
- package/lib/component/1d/Resizable.js +0 -105
- package/lib-cjs/component/1d/Resizable.js +0 -110
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib-cjs/component/NMRium.js",
|
|
7
7
|
"module": "lib/component/NMRium.js",
|
|
@@ -38,25 +38,25 @@
|
|
|
38
38
|
"url": "git+https://github.com/cheminfo/nmrium.git"
|
|
39
39
|
},
|
|
40
40
|
"volta": {
|
|
41
|
-
"node": "16.14.
|
|
41
|
+
"node": "16.14.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=16.0.0",
|
|
45
45
|
"react-dom": ">=16.0.0"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@emotion/react": "^11.
|
|
49
|
-
"analysis-ui-components": "^0.
|
|
48
|
+
"@emotion/react": "^11.9.0",
|
|
49
|
+
"analysis-ui-components": "^0.11.1",
|
|
50
50
|
"cheminfo-font": "^1.8.1",
|
|
51
51
|
"cheminfo-types": "^1.1.0",
|
|
52
|
-
"d3": "^7.
|
|
52
|
+
"d3": "^7.4.4",
|
|
53
53
|
"eventemitter3": "^4.0.7",
|
|
54
54
|
"file-saver": "^2.0.5",
|
|
55
55
|
"formik": "^2.2.9",
|
|
56
56
|
"immer": "^9.0.12",
|
|
57
|
-
"jszip": "^3.
|
|
57
|
+
"jszip": "^3.9.1",
|
|
58
58
|
"lodash": "^4.17.21",
|
|
59
|
-
"mf-parser": "^1.4.
|
|
59
|
+
"mf-parser": "^1.4.6",
|
|
60
60
|
"ml-airpls": "^1.0.0",
|
|
61
61
|
"ml-array-max": "^1.2.4",
|
|
62
62
|
"ml-array-mean": "^1.1.6",
|
|
@@ -65,30 +65,29 @@
|
|
|
65
65
|
"ml-baseline-correction-regression": "^1.0.0",
|
|
66
66
|
"ml-conrec": "^3.2.1",
|
|
67
67
|
"ml-gsd": "^10.2.0",
|
|
68
|
-
"ml-spectra-processing": "^11.
|
|
68
|
+
"ml-spectra-processing": "^11.4.0",
|
|
69
69
|
"ml-stat": "^1.3.3",
|
|
70
70
|
"multiplet-analysis": "^2.0.0",
|
|
71
71
|
"nmr-correlation": "^2.2.5",
|
|
72
72
|
"nmr-parser": "^1.7.3",
|
|
73
|
-
"nmr-processing": "^7.4.
|
|
73
|
+
"nmr-processing": "^7.4.3",
|
|
74
74
|
"nmredata": "^0.6.1",
|
|
75
75
|
"numeral": "^2.0.6",
|
|
76
76
|
"openchemlib": "^7.4.3",
|
|
77
|
-
"openchemlib-utils": "^1.
|
|
78
|
-
"re-resizable": "^6.9.
|
|
77
|
+
"openchemlib-utils": "^1.11.0",
|
|
78
|
+
"re-resizable": "^6.9.6",
|
|
79
79
|
"react-color": "2.17.2",
|
|
80
80
|
"react-d3-utils": "^0.5.0",
|
|
81
|
-
"react-
|
|
82
|
-
"react-dropzone": "^12.0.4",
|
|
81
|
+
"react-dropzone": "^12.0.5",
|
|
83
82
|
"react-error-boundary": "^3.1.4",
|
|
84
83
|
"react-icons": "^4.3.1",
|
|
85
84
|
"react-inspector": "^5.1.1",
|
|
86
85
|
"react-mf": "^2.0.1",
|
|
87
86
|
"react-ocl": "^4.3.5",
|
|
88
|
-
"react-ocl-nmr": "^1.1.
|
|
89
|
-
"react-plot": "^0.
|
|
90
|
-
"react-rnd": "^10.3.
|
|
91
|
-
"react-slider": "^
|
|
87
|
+
"react-ocl-nmr": "^1.1.1",
|
|
88
|
+
"react-plot": "^0.17.1",
|
|
89
|
+
"react-rnd": "^10.3.7",
|
|
90
|
+
"react-slider": "^2.0.0",
|
|
92
91
|
"react-table": "^7.7.0",
|
|
93
92
|
"react-transition-group": "^4.4.2",
|
|
94
93
|
"react-use": "^17.3.2",
|
|
@@ -96,25 +95,25 @@
|
|
|
96
95
|
"yup": "^0.32.11"
|
|
97
96
|
},
|
|
98
97
|
"devDependencies": {
|
|
99
|
-
"@babel/plugin-transform-modules-commonjs": "^7.17.
|
|
98
|
+
"@babel/plugin-transform-modules-commonjs": "^7.17.9",
|
|
100
99
|
"@babel/preset-react": "^7.16.7",
|
|
101
100
|
"@babel/preset-typescript": "^7.16.7",
|
|
102
|
-
"@playwright/test": "^1.
|
|
101
|
+
"@playwright/test": "^1.21.1",
|
|
103
102
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
104
103
|
"@types/d3": "^7.1.0",
|
|
105
104
|
"@types/jest": "^27.4.1",
|
|
106
|
-
"@types/node": "^17.0.
|
|
105
|
+
"@types/node": "^17.0.25",
|
|
107
106
|
"@types/react": "^17.0.43",
|
|
108
107
|
"@types/react-dom": "^17.0.14",
|
|
109
108
|
"@types/react-router-dom": "^5.3.3",
|
|
110
|
-
"@vitejs/plugin-react": "^1.
|
|
109
|
+
"@vitejs/plugin-react": "^1.3.1",
|
|
111
110
|
"@zakodium/eslint-config": "^5.1.1",
|
|
112
111
|
"cross-env": "^7.0.3",
|
|
113
|
-
"eslint": "^8.
|
|
112
|
+
"eslint": "^8.13.0",
|
|
114
113
|
"jest": "^27.5.1",
|
|
115
114
|
"modern-normalize": "^1.1.0",
|
|
116
|
-
"prettier": "^2.6.
|
|
117
|
-
"rc-menu": "^9.5.
|
|
115
|
+
"prettier": "^2.6.2",
|
|
116
|
+
"rc-menu": "^9.5.5",
|
|
118
117
|
"react": "^17.0.2",
|
|
119
118
|
"react-dom": "^17.0.2",
|
|
120
119
|
"react-router-dom": "^5.3.0",
|
|
@@ -122,6 +121,6 @@
|
|
|
122
121
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
123
122
|
"serve": "^13.0.2",
|
|
124
123
|
"typescript": "~4.6.3",
|
|
125
|
-
"vite": "^2.
|
|
124
|
+
"vite": "^2.9.5"
|
|
126
125
|
}
|
|
127
|
-
}
|
|
126
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface ResizedDrop {
|
|
2
|
-
from?: number;
|
|
3
|
-
to?: number;
|
|
4
|
-
}
|
|
5
|
-
interface ResizableProps {
|
|
6
|
-
from: number;
|
|
7
|
-
to: number;
|
|
8
|
-
onDrag?: (element: ResizedDrop) => void;
|
|
9
|
-
onDrop: (element: ResizedDrop) => void;
|
|
10
|
-
}
|
|
11
|
-
declare function Resizable({ from, to, onDrag, onDrop }: ResizableProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
-
export default Resizable;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { Fragment, useCallback, useRef, useState } from 'react';
|
|
4
|
-
import Draggable from 'react-draggable';
|
|
5
|
-
import { useChartData } from '../context/ChartContext';
|
|
6
|
-
import { useScaleChecked } from '../context/ScaleContext';
|
|
7
|
-
function Resizable({ from, to, onDrag = () => null, onDrop }) {
|
|
8
|
-
const { height, margin, mode } = useChartData();
|
|
9
|
-
const [rightDragVisibility, setRightDragVisibility] = useState(false);
|
|
10
|
-
const [leftDragVisibility, setLeftDragVisibility] = useState(false);
|
|
11
|
-
const [enable, setEnable] = useState(true);
|
|
12
|
-
const draggableRightRef = useRef(null);
|
|
13
|
-
const draggableLeftRef = useRef(null);
|
|
14
|
-
const { scaleX } = useScaleChecked();
|
|
15
|
-
const handleRightStart = useCallback((e) => {
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
e.stopPropagation();
|
|
18
|
-
setRightDragVisibility(true);
|
|
19
|
-
}, []);
|
|
20
|
-
const handleRightDrag = useCallback((e) => {
|
|
21
|
-
onDrag({ from: scaleX().invert(e.layerX) });
|
|
22
|
-
}, [onDrag, scaleX]);
|
|
23
|
-
const handleRightStop = useCallback((e) => {
|
|
24
|
-
e.preventDefault();
|
|
25
|
-
e.stopPropagation();
|
|
26
|
-
setRightDragVisibility(false);
|
|
27
|
-
const _range = mode === 'RTL'
|
|
28
|
-
? [scaleX().invert(e.layerX), to]
|
|
29
|
-
: [to, scaleX().invert(e.layerX)];
|
|
30
|
-
let resized;
|
|
31
|
-
if (_range[1] > _range[0]) {
|
|
32
|
-
resized = {
|
|
33
|
-
from: _range[0],
|
|
34
|
-
to: _range[1],
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
resized = {
|
|
39
|
-
from,
|
|
40
|
-
to,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
onDrop(resized);
|
|
44
|
-
}, [from, mode, onDrop, scaleX, to]);
|
|
45
|
-
const handleLeftStart = useCallback((e) => {
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
e.stopPropagation();
|
|
48
|
-
setLeftDragVisibility(true);
|
|
49
|
-
}, []);
|
|
50
|
-
const handleLeftDrag = useCallback((e) => {
|
|
51
|
-
onDrag({ to: scaleX().invert(e.layerX) });
|
|
52
|
-
}, [onDrag, scaleX]);
|
|
53
|
-
const handleLeftStop = useCallback((e) => {
|
|
54
|
-
e.preventDefault();
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
setLeftDragVisibility(false);
|
|
57
|
-
const _range = mode === 'RTL'
|
|
58
|
-
? [from, scaleX().invert(e.layerX)]
|
|
59
|
-
: [scaleX().invert(e.layerX), from];
|
|
60
|
-
let resized;
|
|
61
|
-
if (_range[1] > _range[0]) {
|
|
62
|
-
resized = {
|
|
63
|
-
from: _range[0],
|
|
64
|
-
to: _range[1],
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
resized = {
|
|
69
|
-
from,
|
|
70
|
-
to,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
onDrop(resized);
|
|
74
|
-
}, [from, mode, onDrop, scaleX, to]);
|
|
75
|
-
const mouseDownCaptureHandler = useCallback(({ shiftKey }) => {
|
|
76
|
-
if (shiftKey) {
|
|
77
|
-
setEnable(false);
|
|
78
|
-
}
|
|
79
|
-
}, []);
|
|
80
|
-
const mouseUpCaptureHandler = useCallback(() => {
|
|
81
|
-
setEnable(true);
|
|
82
|
-
}, []);
|
|
83
|
-
const mouseOverHandler = useCallback(({ target, shiftKey }) => {
|
|
84
|
-
if (shiftKey) {
|
|
85
|
-
target.style.cursor = 'crosshair';
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
target.style.cursor = 'ew-resize';
|
|
89
|
-
}
|
|
90
|
-
}, []);
|
|
91
|
-
return (_jsxs(Fragment, { children: [_jsx(Draggable, { axis: "x", defaultPosition: {
|
|
92
|
-
x: scaleX()(from),
|
|
93
|
-
y: 0,
|
|
94
|
-
}, position: {
|
|
95
|
-
x: scaleX()(from),
|
|
96
|
-
y: 0,
|
|
97
|
-
}, scale: 1, handle: ".handle", onStart: handleRightStart, onDrag: handleRightDrag, onStop: handleRightStop, nodeRef: draggableRightRef, children: _jsx("rect", { ref: draggableRightRef, className: enable ? 'handle' : '', width: rightDragVisibility ? 1 : 6, fill: "red", height: height + margin.top, style: { fillOpacity: rightDragVisibility ? 1 : 0 }, onMouseDownCapture: mouseDownCaptureHandler, onMouseUpCapture: mouseUpCaptureHandler, onMouseEnter: mouseOverHandler }) }), _jsx(Draggable, { axis: "x", defaultPosition: {
|
|
98
|
-
x: scaleX()(to),
|
|
99
|
-
y: 0,
|
|
100
|
-
}, position: {
|
|
101
|
-
x: scaleX()(to),
|
|
102
|
-
y: 0,
|
|
103
|
-
}, handle: ".handle", scale: 1, onStart: handleLeftStart, onDrag: handleLeftDrag, onStop: handleLeftStop, nodeRef: draggableLeftRef, children: _jsx("rect", { ref: draggableLeftRef, className: enable ? 'handle' : '', width: leftDragVisibility ? 1 : 6, fill: "red", height: height + margin.top, style: { fillOpacity: leftDragVisibility ? 1 : 0 }, onMouseDownCapture: mouseDownCaptureHandler, onMouseUpCapture: mouseUpCaptureHandler, onMouseEnter: mouseOverHandler }) })] }));
|
|
104
|
-
}
|
|
105
|
-
export default Resizable;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
7
|
-
/** @jsxImportSource @emotion/react */
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const react_draggable_1 = __importDefault(require("react-draggable"));
|
|
10
|
-
const ChartContext_1 = require("../context/ChartContext");
|
|
11
|
-
const ScaleContext_1 = require("../context/ScaleContext");
|
|
12
|
-
function Resizable({ from, to, onDrag = () => null, onDrop }) {
|
|
13
|
-
const { height, margin, mode } = (0, ChartContext_1.useChartData)();
|
|
14
|
-
const [rightDragVisibility, setRightDragVisibility] = (0, react_1.useState)(false);
|
|
15
|
-
const [leftDragVisibility, setLeftDragVisibility] = (0, react_1.useState)(false);
|
|
16
|
-
const [enable, setEnable] = (0, react_1.useState)(true);
|
|
17
|
-
const draggableRightRef = (0, react_1.useRef)(null);
|
|
18
|
-
const draggableLeftRef = (0, react_1.useRef)(null);
|
|
19
|
-
const { scaleX } = (0, ScaleContext_1.useScaleChecked)();
|
|
20
|
-
const handleRightStart = (0, react_1.useCallback)((e) => {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
setRightDragVisibility(true);
|
|
24
|
-
}, []);
|
|
25
|
-
const handleRightDrag = (0, react_1.useCallback)((e) => {
|
|
26
|
-
onDrag({ from: scaleX().invert(e.layerX) });
|
|
27
|
-
}, [onDrag, scaleX]);
|
|
28
|
-
const handleRightStop = (0, react_1.useCallback)((e) => {
|
|
29
|
-
e.preventDefault();
|
|
30
|
-
e.stopPropagation();
|
|
31
|
-
setRightDragVisibility(false);
|
|
32
|
-
const _range = mode === 'RTL'
|
|
33
|
-
? [scaleX().invert(e.layerX), to]
|
|
34
|
-
: [to, scaleX().invert(e.layerX)];
|
|
35
|
-
let resized;
|
|
36
|
-
if (_range[1] > _range[0]) {
|
|
37
|
-
resized = {
|
|
38
|
-
from: _range[0],
|
|
39
|
-
to: _range[1],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
resized = {
|
|
44
|
-
from,
|
|
45
|
-
to,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
onDrop(resized);
|
|
49
|
-
}, [from, mode, onDrop, scaleX, to]);
|
|
50
|
-
const handleLeftStart = (0, react_1.useCallback)((e) => {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
e.stopPropagation();
|
|
53
|
-
setLeftDragVisibility(true);
|
|
54
|
-
}, []);
|
|
55
|
-
const handleLeftDrag = (0, react_1.useCallback)((e) => {
|
|
56
|
-
onDrag({ to: scaleX().invert(e.layerX) });
|
|
57
|
-
}, [onDrag, scaleX]);
|
|
58
|
-
const handleLeftStop = (0, react_1.useCallback)((e) => {
|
|
59
|
-
e.preventDefault();
|
|
60
|
-
e.stopPropagation();
|
|
61
|
-
setLeftDragVisibility(false);
|
|
62
|
-
const _range = mode === 'RTL'
|
|
63
|
-
? [from, scaleX().invert(e.layerX)]
|
|
64
|
-
: [scaleX().invert(e.layerX), from];
|
|
65
|
-
let resized;
|
|
66
|
-
if (_range[1] > _range[0]) {
|
|
67
|
-
resized = {
|
|
68
|
-
from: _range[0],
|
|
69
|
-
to: _range[1],
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
resized = {
|
|
74
|
-
from,
|
|
75
|
-
to,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
onDrop(resized);
|
|
79
|
-
}, [from, mode, onDrop, scaleX, to]);
|
|
80
|
-
const mouseDownCaptureHandler = (0, react_1.useCallback)(({ shiftKey }) => {
|
|
81
|
-
if (shiftKey) {
|
|
82
|
-
setEnable(false);
|
|
83
|
-
}
|
|
84
|
-
}, []);
|
|
85
|
-
const mouseUpCaptureHandler = (0, react_1.useCallback)(() => {
|
|
86
|
-
setEnable(true);
|
|
87
|
-
}, []);
|
|
88
|
-
const mouseOverHandler = (0, react_1.useCallback)(({ target, shiftKey }) => {
|
|
89
|
-
if (shiftKey) {
|
|
90
|
-
target.style.cursor = 'crosshair';
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
target.style.cursor = 'ew-resize';
|
|
94
|
-
}
|
|
95
|
-
}, []);
|
|
96
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_draggable_1.default, { axis: "x", defaultPosition: {
|
|
97
|
-
x: scaleX()(from),
|
|
98
|
-
y: 0,
|
|
99
|
-
}, position: {
|
|
100
|
-
x: scaleX()(from),
|
|
101
|
-
y: 0,
|
|
102
|
-
}, scale: 1, handle: ".handle", onStart: handleRightStart, onDrag: handleRightDrag, onStop: handleRightStop, nodeRef: draggableRightRef, children: (0, jsx_runtime_1.jsx)("rect", { ref: draggableRightRef, className: enable ? 'handle' : '', width: rightDragVisibility ? 1 : 6, fill: "red", height: height + margin.top, style: { fillOpacity: rightDragVisibility ? 1 : 0 }, onMouseDownCapture: mouseDownCaptureHandler, onMouseUpCapture: mouseUpCaptureHandler, onMouseEnter: mouseOverHandler }) }), (0, jsx_runtime_1.jsx)(react_draggable_1.default, { axis: "x", defaultPosition: {
|
|
103
|
-
x: scaleX()(to),
|
|
104
|
-
y: 0,
|
|
105
|
-
}, position: {
|
|
106
|
-
x: scaleX()(to),
|
|
107
|
-
y: 0,
|
|
108
|
-
}, handle: ".handle", scale: 1, onStart: handleLeftStart, onDrag: handleLeftDrag, onStop: handleLeftStop, nodeRef: draggableLeftRef, children: (0, jsx_runtime_1.jsx)("rect", { ref: draggableLeftRef, className: enable ? 'handle' : '', width: leftDragVisibility ? 1 : 6, fill: "red", height: height + margin.top, style: { fillOpacity: leftDragVisibility ? 1 : 0 }, onMouseDownCapture: mouseDownCaptureHandler, onMouseUpCapture: mouseUpCaptureHandler, onMouseEnter: mouseOverHandler }) })] }));
|
|
109
|
-
}
|
|
110
|
-
exports.default = Resizable;
|