Skip to content

Commit f27dbc4

Browse files
authored
Merge pull request #1031 from lowcoder-org/dev
Dev -> Main for Release 2.4.3
2 parents aa8ec31 + 0df085d commit f27dbc4

File tree

21 files changed

+124
-43
lines changed

21 files changed

+124
-43
lines changed

client/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.2
1+
2.4.3

client/packages/lowcoder-comps/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-comps",
3-
"version": "2.4.7",
3+
"version": "2.4.8",
44
"type": "module",
55
"license": "MIT",
66
"dependencies": {

client/packages/lowcoder-sdk/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-sdk",
3-
"version": "2.4.5",
3+
"version": "2.4.6",
44
"type": "module",
55
"files": [
66
"src",

client/packages/lowcoder/src/app.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ class AppIndex extends React.Component<AppIndexProps, any> {
130130
// make sure all users in this app have checked login info
131131
if (!this.props.isFetchUserFinished || (this.props.currentUserId && !this.props.fetchHomeDataFinished)) {
132132
const hideLoadingHeader = isTemplate || isAuthUnRequired(pathname);
133+
// if the user just logged in, we send the event to posthog
134+
if (sessionStorage.getItem('_just_logged_in_')) {
135+
posthog.identify(this.props.currentUserId);
136+
sessionStorage.removeItem('_just_logged_in_');
137+
}
133138
return <ProductLoading hideHeader={hideLoadingHeader} />;
134139
}
135140

client/packages/lowcoder/src/comps/comps/dividerComp.tsx

+28-20
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@ import { AutoHeightControl } from "comps/controls/autoHeightControl";
1717

1818
import { useContext } from "react";
1919
import { EditorContext } from "comps/editorState";
20+
import { useMergeCompStyles } from "@lowcoder-ee/index.sdk";
2021

2122
type IProps = DividerProps & {
2223
$style: DividerStyleType;
23-
dashed: boolean;
2424
$animationStyle:AnimationStyleType;
25+
type?: 'vertical' | 'horizontal';
2526
};
2627

27-
// TODO: enable type "vertical" https://ant.design/components/divider
28-
2928
const StyledDivider = styled(Divider)<IProps>`
29+
3030
margin-top: 3.5px;
31-
rotate: ${(props) => props.$style.rotation};
32-
31+
rotate: ${(props) => props.type === 'vertical' ? '0deg' : props.$style.rotation};
3332
.ant-divider-inner-text {
3433
height: 32px;
3534
display: flex;
@@ -56,7 +55,6 @@ const StyledDivider = styled(Divider)<IProps>`
5655
.ant-divider-inner-text::before,
5756
.ant-divider-inner-text::after {
5857
border-block-start: ${(props) => props.$style.borderWidth && props.$style.borderWidth !== "0px" ? props.$style.borderWidth : "1px"}
59-
${(props) => props.dashed ? "dashed" : "solid"}
6058
${(props) => props.$style.border} !important;
6159
border-block-start-color: inherit;
6260
border-block-end: 0;
@@ -77,15 +75,22 @@ const StyledDivider = styled(Divider)<IProps>`
7775
${(props) => props.$style.borderStyle}
7876
${(props) => props.$style.border};
7977
}
78+
&.ant-divider-vertical {
79+
height: ${(props) => props.type === 'vertical' && '200px'};
80+
border-left: ${(props) => props.$style.borderWidth && props.$style.borderWidth !== "0px" ? props.$style.borderWidth : "1px"}
81+
${(props) => props.$style.borderStyle}
82+
${(props) => props.$style.border};
83+
border-top: none;
84+
}
8085
`;
8186

8287
const childrenMap = {
8388
title: StringControl,
84-
dashed: BoolControl,
8589
align: alignControl(),
86-
autoHeight: withDefault(AutoHeightControl, "fixed"),
87-
style: styleControl(DividerStyle),
88-
animationStyle: styleControl(AnimationStyle),
90+
type: BoolControl,
91+
autoHeight: withDefault(AutoHeightControl, "auto"),
92+
style: styleControl(DividerStyle , 'style'),
93+
animationStyle: styleControl(AnimationStyle ,'animationStyle'),
8994
};
9095

9196
function fixOldStyleData(oldData: any) {
@@ -105,25 +110,29 @@ function fixOldStyleData(oldData: any) {
105110

106111
// Compatible with historical style data 2022-8-26
107112
const DividerTempComp = migrateOldData(
108-
new UICompBuilder(childrenMap, (props) => {
113+
new UICompBuilder(childrenMap, (props , dispatch) => {
114+
useMergeCompStyles(props as Record<string, any>, dispatch);
115+
const dividerType = props.type ? 'vertical' : 'horizontal';
116+
109117
return (
110118
<StyledDivider
111119
orientation={props.align}
112-
dashed={props.dashed}
120+
type={dividerType}
113121
$style={props.style}
114122
$animationStyle={props.animationStyle}
115123
>
116-
{props.title}
124+
{dividerType === 'horizontal' && props.title}
117125
</StyledDivider>
118126
);
119127
})
120128
.setPropertyViewFn((children) => {
121129
return (
122130
<>
123-
<Section name={sectionNames.basic}>
124-
{children.title.propertyView({ label: trans("divider.title") })}
125-
</Section>
126-
131+
{!children?.type?.getView() &&
132+
<Section name={sectionNames.basic}>
133+
{children.title.propertyView({ label: trans("divider.title") })}
134+
</Section>}
135+
127136
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
128137
<Section name={sectionNames.interaction}>
129138
{hiddenPropertyView(children)}
@@ -141,7 +150,7 @@ const DividerTempComp = migrateOldData(
141150
{children.autoHeight.getPropertyView()}
142151
</Section>
143152
<Section name={sectionNames.style}>
144-
{children.dashed.propertyView({ label: trans("divider.dashed") })}
153+
{children.type.propertyView({ label: trans("divider.type")})}
145154
{children.style.getPropertyView()}
146155
</Section>
147156
<Section name={sectionNames.animationStyle}hasTooltip={true}>
@@ -153,7 +162,6 @@ const DividerTempComp = migrateOldData(
153162
);
154163
})
155164
.setExposeStateConfigs([
156-
new NameConfig("dashed", trans("divider.dashedDesc")),
157165
new NameConfig("title", trans("divider.titleDesc")),
158166
new NameConfig("align", trans("divider.alignDesc")),
159167
NameConfigHidden,
@@ -166,4 +174,4 @@ export const DividerComp = class extends DividerTempComp {
166174
override autoHeight(): boolean {
167175
return this.children.autoHeight.getView();
168176
}
169-
};
177+
};

client/packages/lowcoder/src/comps/comps/layout/mobileTabLayout.tsx

+25-9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ import { AlignRight } from "lowcoder-design";
3333
import { LayoutActionComp } from "./layoutActionComp";
3434
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
3535
import { clickEvent, eventHandlerControl } from "@lowcoder-ee/comps/controls/eventHandlerControl";
36+
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
37+
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi";
3638

3739
const TabBar = React.lazy(() => import("antd-mobile/es/components/tab-bar"));
3840
const TabBarItem = React.lazy(() =>
@@ -228,9 +230,10 @@ function TabBarView(props: TabBarProps & {
228230
>
229231
<StyledTabBar
230232
onChange={(key: string) => {
233+
console.log(key)
231234
if (key) {
232-
props.onEvent('click')
233235
props.onChange(key);
236+
props.onEvent('click')
234237
}
235238
}}
236239
activeKey={props.selectedKey}
@@ -289,7 +292,7 @@ let MobileTabLayoutTmp = (function () {
289292
const childrenMap = {
290293
onEvent: eventHandlerControl(EventOptions),
291294
dataOptionType: dropdownControl(DataOptionType, DataOption.Manual),
292-
jsonItems: jsonControl<JsonItemNode[]>(convertTreeData, mobileNavJsonMenuItems),
295+
jsonItems: jsonControl<JsonItemNode[]>(convertTreeData, mobileNavJsonMenuItems),
293296
tabs: manualOptionsControl(TabOptionComp, {
294297
initOptions: [
295298
{
@@ -315,12 +318,12 @@ let MobileTabLayoutTmp = (function () {
315318
maxWidth: withDefault(NumberControl, 450),
316319
verticalAlignment: dropdownControl(VerticalAlignmentOptions, "stretch"),
317320
showSeparator: withDefault(BoolCodeControl, true),
318-
navStyle: withDefault(styleControl(NavLayoutStyle), defaultStyle),
319-
navItemStyle: withDefault(styleControl(NavLayoutItemStyle), defaultStyle),
320-
navItemHoverStyle: withDefault(styleControl(NavLayoutItemHoverStyle), {}),
321-
navItemActiveStyle: withDefault(styleControl(NavLayoutItemActiveStyle), {}),
321+
navStyle: styleControl(NavLayoutStyle, 'navStyle'),
322+
navItemStyle: styleControl(NavLayoutItemStyle, 'navItemStyle'),
323+
navItemHoverStyle: styleControl(NavLayoutItemHoverStyle, 'navItemHoverStyle'),
324+
navItemActiveStyle: styleControl(NavLayoutItemActiveStyle, 'navItemActiveStyle'),
322325
};
323-
return new MultiCompBuilder(childrenMap, (props) => {
326+
return new MultiCompBuilder(childrenMap, (props, dispatch) => {
324327
return null;
325328
})
326329
.setPropertyViewFn((children) => {
@@ -402,6 +405,8 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
402405
const bgColor = (useContext(ThemeContext)?.theme || defaultTheme).canvas;
403406
const onEvent = comp.children.onEvent.getView();
404407

408+
useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);
409+
405410
useEffect(() => {
406411
comp.children.jsonTabs.dispatchChangeValueAction({
407412
manual: jsonItems as unknown as Array<ConstructorToDataType<typeof TabOptionComp>>
@@ -427,9 +432,20 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
427432
const appView = useMemo(() => {
428433
const currentTab = tabViews[tabIndex];
429434

435+
if (dataOptionType === DataOption.Json) {
436+
return (currentTab &&
437+
currentTab.children.app.getAppId() &&
438+
currentTab.children.app.getView()) || (
439+
<EmptyContent
440+
text={readOnly ? "" : trans("aggregation.emptyTabTooltip")}
441+
style={{ height: "100%", backgroundColor: "white" }}
442+
/>
443+
);
444+
}
445+
430446
return (currentTab &&
431-
currentTab.children.app.getAppId() &&
432-
currentTab.children.app.getView()) || (
447+
// currentTab.children.app.getAppId() &&
448+
currentTab.children.action.getView()) || (
433449
<EmptyContent
434450
text={readOnly ? "" : trans("aggregation.emptyTabTooltip")}
435451
style={{ height: "100%", backgroundColor: "white" }}

client/packages/lowcoder/src/comps/comps/layout/navLayout.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { trans } from "i18n";
1616
import { EditorContainer, EmptyContent } from "pages/common/styledComponent";
1717
import { useCallback, useEffect, useMemo, useState } from "react";
1818
import styled from "styled-components";
19-
import { isUserViewMode, useAppPathParam } from "util/hooks";
19+
import { isUserViewMode, useAppPathParam, useMergeCompStyles } from "util/hooks";
2020
import { BoolCodeControl, StringControl, jsonControl } from "comps/controls/codeControl";
2121
import { styleControl } from "comps/controls/styleControl";
2222
import {
@@ -41,6 +41,7 @@ import {
4141
menuItemStyleOptions
4242
} from "./navLayoutConstants";
4343
import { clickEvent, eventHandlerControl } from "@lowcoder-ee/comps/controls/eventHandlerControl";
44+
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi";
4445

4546
const { Header } = Layout;
4647

@@ -198,10 +199,10 @@ let NavTmpLayout = (function () {
198199
backgroundImage: withDefault(StringControl, ""),
199200
mode: dropdownControl(ModeOptions, "inline"),
200201
collapse: BoolCodeControl,
201-
navStyle: withDefault(styleControl(NavLayoutStyle), {...defaultStyle, padding: '1px'}),
202-
navItemStyle: withDefault(styleControl(NavLayoutItemStyle), defaultStyle),
203-
navItemHoverStyle: withDefault(styleControl(NavLayoutItemHoverStyle), {}),
204-
navItemActiveStyle: withDefault(styleControl(NavLayoutItemActiveStyle), {}),
202+
navStyle: styleControl(NavLayoutStyle, 'navStyle'),
203+
navItemStyle: styleControl(NavLayoutItemStyle, 'navItemStyle'),
204+
navItemHoverStyle: styleControl(NavLayoutItemHoverStyle, 'navItemHoverStyle'),
205+
navItemActiveStyle: styleControl(NavLayoutItemActiveStyle, 'navItemActiveStyle'),
205206
};
206207
return new MultiCompBuilder(childrenMap, (props) => {
207208
return null;
@@ -290,6 +291,8 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
290291
const dataOptionType = comp.children.dataOptionType.getView();
291292
const onEvent = comp.children.onEvent.getView();
292293

294+
useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);
295+
293296
// filter out hidden. unauthorised items filtered by server
294297
const filterItem = useCallback((item: LayoutMenuItemComp): boolean => {
295298
return !item.children.hidden.getView();

client/packages/lowcoder/src/comps/controls/styleControl.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
876876
...(theme?.theme?.components?.[compType]?.[styleKey] || {}) as unknown as Record<string, string>
877877
}
878878
: undefined;
879-
const styleProps = preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId
879+
const styleProps = (!comp && !compType) || preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId
880880
? props as ColorMap
881881
: {} as ColorMap;
882882

client/packages/lowcoder/src/constants/themeConstants.ts

+6
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ const qrCode = {
9595
}
9696
};
9797

98+
const divider = {
99+
style: {
100+
radius: "0px"
101+
}
102+
};
98103

99104
export const defaultTheme: ThemeDetail = {
100105
primary: "#3377FF",
@@ -130,6 +135,7 @@ export const defaultTheme: ThemeDetail = {
130135
qrCode,
131136
treeSelect,
132137
pageLayout,
138+
divider,
133139
password: input,
134140
numberInput: input,
135141
textArea: input,

client/packages/lowcoder/src/i18n/locales/en.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,7 @@ export const en = {
20062006
"title": "Title",
20072007
"align": "Alignment",
20082008
"dashed": "Dashed",
2009+
"type": "Vertical type",
20092010
"dashedDesc": "Whether to Use Dashed Line",
20102011
"titleDesc": "Divider Title",
20112012
"alignDesc": "Divider Title Alignment"

client/packages/lowcoder/src/pages/userAuth/authUtils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function authRespValidate(
8282

8383
if (doValidResponse(resp)) {
8484
onAuthSuccess?.();
85+
sessionStorage.setItem("_just_logged_in_", "true");
8586
history.replace(replaceUrl.replace(baseUrl, ''));
8687
} else if (
8788
resp.data.code === SERVER_ERROR_CODES.EXCEED_MAX_USER_ORG_COUNT ||

client/packages/lowcoder/src/util/hooks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export function useMergeCompStyles(
177177
const compTheme = theme?.theme?.components?.[compType];
178178
const themeId = theme?.themeId;
179179

180-
const styleKeys = Object.keys(props).filter(key => key.toLowerCase().endsWith('style'));
180+
const styleKeys = Object.keys(props).filter(key => key.toLowerCase().endsWith('style' || 'styles'));
181181
const styleProps: Record<string, any> = {};
182182
styleKeys.forEach((key: string) => {
183183
styleProps[key] = (props as any)[key];

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/organization/service/OrganizationServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public Mono<Organization> createDefault(User user, boolean isSuperAdmin) {
9898

9999
private Mono<Boolean> joinOrganizationInEnterpriseMode(String userId) {
100100
return getOrganizationInEnterpriseMode()
101-
.flatMap(organization -> orgMemberService.addMember(organization.getGid(), userId, MemberRole.MEMBER))
101+
.flatMap(organization -> orgMemberService.addMember(organization.getId(), userId, MemberRole.MEMBER))
102102
.defaultIfEmpty(false);
103103
}
104104

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/user/model/AuthUser.java

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class AuthUser {
1818

1919
private String uid;
2020
private String username;
21+
private String email;
2122
private String avatar;
2223
private Map<String, Object> rawUserInfo;
2324
private Map<String, Object> extra;
@@ -41,6 +42,7 @@ public Connection toAuthConnection() {
4142
.authId(getAuthContext().getAuthConfig().getId())
4243
.source(getSource())
4344
.name(getUsername())
45+
.email(getEmail())
4446
.rawId(getUid())
4547
.avatar(getAvatar())
4648
.orgIds(StringUtils.isBlank(getOrgId()) ? Set.of() : Set.of(getOrgId()))

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/user/model/Connection.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public class Connection implements Serializable {
4646

4747
private final String name;
4848

49+
private final String email;
50+
4951
private final String avatar;
5052

5153
private Set<String> orgIds;
@@ -59,12 +61,13 @@ public class Connection implements Serializable {
5961
private Set<String> tokens;
6062

6163
@JsonCreator
62-
private Connection(String authId, String source, String rawId, String name, String avatar, Set<String> orgIds, @Nullable
64+
private Connection(String authId, String source, String rawId, String name, String email, String avatar, Set<String> orgIds, @Nullable
6365
ConnectionAuthToken authConnectionAuthToken, Map<String, Object> rawUserInfo, Set<String> tokens) {
6466
this.authId = authId;
6567
this.source = source;
6668
this.rawId = rawId;
6769
this.name = name;
70+
this.email = email;
6871
this.avatar = avatar;
6972
this.orgIds = CollectionUtils.isEmpty(orgIds) ? new HashSet<>() : orgIds;
7073
this.authConnectionAuthToken = authConnectionAuthToken;

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/user/model/User.java

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public class User extends HasIdAndAuditing implements BeforeMongodbWrite, AfterM
4242

4343
private String name;
4444

45+
private String email;
46+
4547
private String uiLanguage;
4648

4749
private String avatar;

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/user/repository/UserRepository.java

+3
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ public interface UserRepository extends ReactiveMongoRepository<User, String> {
1919
Flux<User> findByConnections_SourceAndConnections_RawIdIn(String source, Collection<String> rawIds);
2020

2121
Mono<User> findByName(String rawUuid);
22+
23+
//email1 and email2 should be equal
24+
Mono<User> findByEmailOrConnections_Email(String email1, String email2);
2225
}

0 commit comments

Comments
 (0)