Skip to content

Commit adacf37

Browse files
fix events trigger on switch column type in table
1 parent 37eaba9 commit adacf37

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnSwitchComp.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,13 @@ const childrenMap = {
6969

7070
const getBaseValue: ColumnTypeViewFn<typeof childrenMap, boolean, boolean> = (props) => props.switchState;
7171

72+
let onEvent: (eventName: string) => Promise<unknown[]>;
73+
7274
export 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>

client/packages/lowcoder/src/pages/userAuth/register.tsx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy