File tree Expand file tree Collapse file tree 2 files changed +25
-17
lines changed
client/packages/lowcoder/src
comps/comps/tableComp/column/columnTypeComps Expand file tree Collapse file tree 2 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -69,10 +69,13 @@ const childrenMap = {
6969
7070const getBaseValue : ColumnTypeViewFn < typeof childrenMap , boolean , boolean > = ( props ) => props . switchState ;
7171
72+ let onEvent : ( eventName : string ) => Promise < unknown [ ] > ;
73+
7274export const SwitchComp = ( function ( ) {
7375 return new ColumnTypeCompBuilder (
7476 childrenMap ,
7577 ( props , dispatch ) => {
78+ onEvent = props . onEvent ;
7679 const value = props . changeValue ?? getBaseValue ( props , dispatch ) ;
7780 const CheckBoxComp = ( ) => {
7881 return (
@@ -106,6 +109,8 @@ export const SwitchComp = (function () {
106109 disabled = { false }
107110 onChange = { ( checked , e ) => {
108111 props . onChange ( checked ) ;
112+ onEvent ?.( "change" ) ;
113+ onEvent ?.( checked ? "true" : "false" ) ;
109114 } }
110115 />
111116 </ Wrapper >
Original file line number Diff line number Diff line change @@ -95,25 +95,28 @@ function UserRegister() {
9595 setSigninEnabled ( LOWCODER_EMAIL_AUTH_ENABLED === 'true' ) ;
9696 } , [ serverSettings ] ) ;
9797
98+ const fetchOrgsByEmail = ( ) => {
99+ fetchOrgPaginationByEmail ( {
100+ email : ' ' ,
101+ pageNum : 1 ,
102+ pageSize : 10 ,
103+ } )
104+ . then ( ( resp ) => {
105+ if ( resp . success ) {
106+ const orgList = resp . data || [ ] ;
107+ if ( orgList . length ) {
108+ // in Enterprise mode, we will get org data in different format
109+ const selectedOrgId = orgList [ 0 ] ?. id || orgList [ 0 ] ?. orgId ;
110+ setDefaultOrgId ( selectedOrgId ) ;
111+ dispatch ( fetchConfigAction ( selectedOrgId ) ) ;
112+ }
113+ }
114+ } )
115+ }
116+
98117 useEffect ( ( ) => {
99118 if ( isEnterpriseMode ) {
100- // dispatch(fetchConfigAction());
101- fetchOrgPaginationByEmail ( {
102- email : ' ' ,
103- pageNum : 1 ,
104- pageSize : 10 ,
105- } )
106- . then ( ( resp ) => {
107- if ( resp . success ) {
108- const orgList = resp . data || [ ] ;
109- if ( orgList . length ) {
110- // in Enterprise mode, we will get org data in different format
111- const selectedOrgId = orgList [ 0 ] ?. id || orgList [ 0 ] ?. orgId ;
112- setDefaultOrgId ( selectedOrgId ) ;
113- dispatch ( fetchConfigAction ( selectedOrgId ) ) ;
114- }
115- }
116- } )
119+ fetchOrgsByEmail ( ) ;
117120 }
118121 } , [ isEnterpriseMode ] ) ;
119122
You can’t perform that action at this time.
0 commit comments