@@ -17,7 +17,10 @@ var _ui = require("../../actions/ui");
17
17
var _cfg = _interopRequireDefault ( require ( "../../helpers/cfg" ) ) ;
18
18
var _common = require ( "./common" ) ;
19
19
var _list_ui = require ( "../../constants/list_ui" ) ;
20
- /* eslint-disable prefer-object-spread, function-paren-newline,
20
+ var _tri_btn = _interopRequireDefault ( require ( "./tri_btn" ) ) ;
21
+ var _edit_peak = require ( "../../actions/edit_peak" ) ;
22
+ var _extractPeaksEdit = require ( "../../helpers/extractPeaksEdit" ) ;
23
+ /* eslint-disable prefer-object-spread, function-paren-newline, no-unused-vars,
21
24
react/function-component-definition, react/require-default-props, max-len,
22
25
react/no-unused-prop-types */
23
26
@@ -34,15 +37,28 @@ const Peak = _ref => {
34
37
disableSetRefSt,
35
38
isHandleMaxAndMinPeaksSt,
36
39
cyclicVotaSt,
37
- curveSt
40
+ curveSt,
41
+ clearAllPeaksAct,
42
+ feature,
43
+ editPeakSt,
44
+ thresSt,
45
+ shiftSt,
46
+ layoutSt
38
47
} = _ref ;
39
48
let onSweepPeakAdd = ( ) => setUiSweepTypeAct ( _list_ui . LIST_UI_SWEEP_TYPE . PEAK_ADD ) ;
40
49
let onSweepPeakDELETE = ( ) => setUiSweepTypeAct ( _list_ui . LIST_UI_SWEEP_TYPE . PEAK_DELETE ) ;
41
50
let onSweepAnchorShift = ( ) => setUiSweepTypeAct ( _list_ui . LIST_UI_SWEEP_TYPE . ANCHOR_SHIFT ) ;
51
+ const {
52
+ curveIdx
53
+ } = curveSt ;
54
+ const onClearAll = ( ) => {
55
+ const dataPeaks = ( 0 , _extractPeaksEdit . extractAutoPeaks ) ( feature , thresSt , shiftSt , layoutSt ) ;
56
+ clearAllPeaksAct ( {
57
+ curveIdx,
58
+ dataPeaks
59
+ } ) ;
60
+ } ;
42
61
if ( isHandleMaxAndMinPeaksSt ) {
43
- const {
44
- curveIdx
45
- } = curveSt ;
46
62
const {
47
63
spectraList
48
64
} = cyclicVotaSt ;
@@ -84,7 +100,16 @@ const Peak = _ref => {
84
100
onClick : onSweepPeakDELETE
85
101
} , /*#__PURE__*/ _react . default . createElement ( "span" , {
86
102
className : ( 0 , _classnames . default ) ( classes . txt , 'txt-sv-bar-rmpeak' )
87
- } , "P-" ) ) ) ) , ! disableSetRefSt ? /*#__PURE__*/ _react . default . createElement ( _Tooltip . default , {
103
+ } , "P-" ) ) ) ) , /*#__PURE__*/ _react . default . createElement ( _tri_btn . default , {
104
+ content : {
105
+ tp : 'Clear All Peaks'
106
+ } ,
107
+ cb : onClearAll
108
+ } , /*#__PURE__*/ _react . default . createElement ( "span" , {
109
+ className : ( 0 , _classnames . default ) ( classes . txt , 'txt-sv-bar-rmallpeaks' )
110
+ } , "P" ) , /*#__PURE__*/ _react . default . createElement ( "span" , {
111
+ className : ( 0 , _classnames . default ) ( classes . txt , classes . txtIcon , 'txt-sv-bar-rmallpeaks' )
112
+ } , "x" ) ) , ! disableSetRefSt ? /*#__PURE__*/ _react . default . createElement ( _Tooltip . default , {
88
113
title : /*#__PURE__*/ _react . default . createElement ( "span" , {
89
114
className : "txt-sv-tp"
90
115
} , "Set Reference" )
@@ -96,7 +121,7 @@ const Peak = _ref => {
96
121
className : classes . icon
97
122
} ) ) ) ) : null ) ;
98
123
} ;
99
- const mapStateToProps = ( state , _ ) => (
124
+ const mapStateToProps = ( state , props ) => (
100
125
// eslint-disable-line
101
126
{
102
127
isFocusAddPeakSt : state . ui . sweepType === _list_ui . LIST_UI_SWEEP_TYPE . PEAK_ADD || state . ui . sweepType === _list_ui . LIST_UI_SWEEP_TYPE . CYCLIC_VOLTA_ADD_MAX_PEAK || state . ui . sweepType === _list_ui . LIST_UI_SWEEP_TYPE . CYCLIC_VOLTA_ADD_MIN_PEAK ,
@@ -107,10 +132,15 @@ const mapStateToProps = (state, _) => (
107
132
disableSetRefSt : _cfg . default . btnCmdSetRef ( state . layout ) ,
108
133
isHandleMaxAndMinPeaksSt : ! _cfg . default . hidePanelCyclicVolta ( state . layout ) ,
109
134
cyclicVotaSt : state . cyclicvolta ,
110
- curveSt : state . curve
135
+ curveSt : state . curve ,
136
+ editPeakSt : state . editPeak . present ,
137
+ thresSt : state . threshold ,
138
+ layoutSt : state . layout ,
139
+ shiftSt : state . shift
111
140
} ) ;
112
141
const mapDispatchToProps = dispatch => ( 0 , _redux . bindActionCreators ) ( {
113
- setUiSweepTypeAct : _ui . setUiSweepType
142
+ setUiSweepTypeAct : _ui . setUiSweepType ,
143
+ clearAllPeaksAct : _edit_peak . clearAllPeaks
114
144
} , dispatch ) ;
115
145
Peak . propTypes = {
116
146
classes : _propTypes . default . object . isRequired ,
@@ -123,6 +153,12 @@ Peak.propTypes = {
123
153
setUiSweepTypeAct : _propTypes . default . func . isRequired ,
124
154
isHandleMaxAndMinPeaksSt : _propTypes . default . bool . isRequired ,
125
155
cyclicVotaSt : _propTypes . default . object . isRequired ,
126
- curveSt : _propTypes . default . object . isRequired
156
+ curveSt : _propTypes . default . object . isRequired ,
157
+ clearAllPeaksAct : _propTypes . default . func . isRequired ,
158
+ feature : _propTypes . default . object . isRequired ,
159
+ editPeakSt : _propTypes . default . object . isRequired ,
160
+ thresSt : _propTypes . default . object . isRequired ,
161
+ layoutSt : _propTypes . default . string . isRequired ,
162
+ shiftSt : _propTypes . default . object . isRequired
127
163
} ;
128
164
var _default = exports . default = ( 0 , _redux . compose ) ( ( 0 , _reactRedux . connect ) ( mapStateToProps , mapDispatchToProps ) , ( 0 , _withStyles . default ) ( styles ) ) ( Peak ) ;
0 commit comments