@@ -61,6 +61,11 @@ const SwitchWrapper = styled.div<{ disabled: boolean }>`
61
61
` } ;
62
62
` ;
63
63
64
+ const Wrapper = styled . div `
65
+ background: transparent !important;
66
+ padding: 0 8px;
67
+ `
68
+
64
69
const childrenMap = {
65
70
value : booleanExposingStateControl ( "value" ) ,
66
71
switchState : BoolCodeControl ,
@@ -80,18 +85,16 @@ export const SwitchComp = (function () {
80
85
const value = props . changeValue ?? getBaseValue ( props , dispatch ) ;
81
86
const CheckBoxComp = ( ) => {
82
87
return (
83
- < SwitchWrapper disabled = { props . disabled } >
84
- < Switch
85
- checked = { props . value . value || true }
86
- disabled = { props . disabled }
87
- ref = { props . viewRef }
88
- onChange = { ( checked ) => {
89
- props . value . onChange ( checked ) ;
90
- props . onEvent ( "change" ) ;
91
- props . onEvent ( checked ? "true" : "false" ) ;
92
- } }
93
- />
94
- </ SwitchWrapper >
88
+ < Switch
89
+ checked = { value }
90
+ disabled = { props . disabled || true }
91
+ ref = { props . viewRef }
92
+ onChange = { ( checked ) => {
93
+ props . value . onChange ( checked ) ;
94
+ props . onEvent ( "change" ) ;
95
+ props . onEvent ( checked ? "true" : "false" ) ;
96
+ } }
97
+ />
95
98
) ;
96
99
} ;
97
100
return < CheckBoxComp /> ;
@@ -101,15 +104,22 @@ export const SwitchComp = (function () {
101
104
)
102
105
. setEditViewFn ( ( props ) => {
103
106
return (
104
- < Switch
105
- checked = { props . value }
106
- disabled = { false }
107
- onChange = { ( checked ) => {
108
- props . onChange ( checked ) ;
109
- // props.onEvent("change");
110
- // props.onEvent(checked ? "true" : "false");
107
+ < Wrapper
108
+ onBlur = { ( e ) => {
109
+ if ( ! e . currentTarget ?. contains ( e . relatedTarget ) ) {
110
+ props . onChangeEnd ( ) ;
111
+ }
111
112
} }
112
- />
113
+ >
114
+ < Switch
115
+ defaultChecked = { props . value }
116
+ disabled = { false }
117
+ onChange = { ( checked ) => {
118
+ props . onChange ( checked ) ;
119
+ } }
120
+ />
121
+
122
+ </ Wrapper >
113
123
) ;
114
124
} )
115
125
. setPropertyViewFn ( ( children ) => {
0 commit comments