Skip to content

Dev -> Main for Release 2.4.3 #1031

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.2
2.4.3
2 changes: 1 addition & 1 deletion client/packages/lowcoder-comps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-comps",
"version": "2.4.7",
"version": "2.4.8",
"type": "module",
"license": "MIT",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-sdk",
"version": "2.4.5",
"version": "2.4.6",
"type": "module",
"files": [
"src",
Expand Down
5 changes: 5 additions & 0 deletions client/packages/lowcoder/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class AppIndex extends React.Component<AppIndexProps, any> {
// make sure all users in this app have checked login info
if (!this.props.isFetchUserFinished || (this.props.currentUserId && !this.props.fetchHomeDataFinished)) {
const hideLoadingHeader = isTemplate || isAuthUnRequired(pathname);
// if the user just logged in, we send the event to posthog
if (sessionStorage.getItem('_just_logged_in_')) {
posthog.identify(this.props.currentUserId);
sessionStorage.removeItem('_just_logged_in_');
}
return <ProductLoading hideHeader={hideLoadingHeader} />;
}

Expand Down
48 changes: 28 additions & 20 deletions client/packages/lowcoder/src/comps/comps/dividerComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ import { AutoHeightControl } from "comps/controls/autoHeightControl";

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

type IProps = DividerProps & {
$style: DividerStyleType;
dashed: boolean;
$animationStyle:AnimationStyleType;
type?: 'vertical' | 'horizontal';
};

// TODO: enable type "vertical" https://ant.design/components/divider

const StyledDivider = styled(Divider)<IProps>`

margin-top: 3.5px;
rotate: ${(props) => props.$style.rotation};

rotate: ${(props) => props.type === 'vertical' ? '0deg' : props.$style.rotation};
.ant-divider-inner-text {
height: 32px;
display: flex;
Expand All @@ -56,7 +55,6 @@ const StyledDivider = styled(Divider)<IProps>`
.ant-divider-inner-text::before,
.ant-divider-inner-text::after {
border-block-start: ${(props) => props.$style.borderWidth && props.$style.borderWidth !== "0px" ? props.$style.borderWidth : "1px"}
${(props) => props.dashed ? "dashed" : "solid"}
${(props) => props.$style.border} !important;
border-block-start-color: inherit;
border-block-end: 0;
Expand All @@ -77,15 +75,22 @@ const StyledDivider = styled(Divider)<IProps>`
${(props) => props.$style.borderStyle}
${(props) => props.$style.border};
}
&.ant-divider-vertical {
height: ${(props) => props.type === 'vertical' && '200px'};
border-left: ${(props) => props.$style.borderWidth && props.$style.borderWidth !== "0px" ? props.$style.borderWidth : "1px"}
${(props) => props.$style.borderStyle}
${(props) => props.$style.border};
border-top: none;
}
`;

const childrenMap = {
title: StringControl,
dashed: BoolControl,
align: alignControl(),
autoHeight: withDefault(AutoHeightControl, "fixed"),
style: styleControl(DividerStyle),
animationStyle: styleControl(AnimationStyle),
type: BoolControl,
autoHeight: withDefault(AutoHeightControl, "auto"),
style: styleControl(DividerStyle , 'style'),
animationStyle: styleControl(AnimationStyle ,'animationStyle'),
};

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

// Compatible with historical style data 2022-8-26
const DividerTempComp = migrateOldData(
new UICompBuilder(childrenMap, (props) => {
new UICompBuilder(childrenMap, (props , dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);
const dividerType = props.type ? 'vertical' : 'horizontal';

return (
<StyledDivider
orientation={props.align}
dashed={props.dashed}
type={dividerType}
$style={props.style}
$animationStyle={props.animationStyle}
>
{props.title}
{dividerType === 'horizontal' && props.title}
</StyledDivider>
);
})
.setPropertyViewFn((children) => {
return (
<>
<Section name={sectionNames.basic}>
{children.title.propertyView({ label: trans("divider.title") })}
</Section>

{!children?.type?.getView() &&
<Section name={sectionNames.basic}>
{children.title.propertyView({ label: trans("divider.title") })}
</Section>}

{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
<Section name={sectionNames.interaction}>
{hiddenPropertyView(children)}
Expand All @@ -141,7 +150,7 @@ const DividerTempComp = migrateOldData(
{children.autoHeight.getPropertyView()}
</Section>
<Section name={sectionNames.style}>
{children.dashed.propertyView({ label: trans("divider.dashed") })}
{children.type.propertyView({ label: trans("divider.type")})}
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}hasTooltip={true}>
Expand All @@ -153,7 +162,6 @@ const DividerTempComp = migrateOldData(
);
})
.setExposeStateConfigs([
new NameConfig("dashed", trans("divider.dashedDesc")),
new NameConfig("title", trans("divider.titleDesc")),
new NameConfig("align", trans("divider.alignDesc")),
NameConfigHidden,
Expand All @@ -166,4 +174,4 @@ export const DividerComp = class extends DividerTempComp {
override autoHeight(): boolean {
return this.children.autoHeight.getView();
}
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import { AlignRight } from "lowcoder-design";
import { LayoutActionComp } from "./layoutActionComp";
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
import { clickEvent, eventHandlerControl } from "@lowcoder-ee/comps/controls/eventHandlerControl";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi";

const TabBar = React.lazy(() => import("antd-mobile/es/components/tab-bar"));
const TabBarItem = React.lazy(() =>
Expand Down Expand Up @@ -228,9 +230,10 @@ function TabBarView(props: TabBarProps & {
>
<StyledTabBar
onChange={(key: string) => {
console.log(key)
if (key) {
props.onEvent('click')
props.onChange(key);
props.onEvent('click')
}
}}
activeKey={props.selectedKey}
Expand Down Expand Up @@ -289,7 +292,7 @@ let MobileTabLayoutTmp = (function () {
const childrenMap = {
onEvent: eventHandlerControl(EventOptions),
dataOptionType: dropdownControl(DataOptionType, DataOption.Manual),
jsonItems: jsonControl<JsonItemNode[]>(convertTreeData, mobileNavJsonMenuItems),
jsonItems: jsonControl<JsonItemNode[]>(convertTreeData, mobileNavJsonMenuItems),
tabs: manualOptionsControl(TabOptionComp, {
initOptions: [
{
Expand All @@ -315,12 +318,12 @@ let MobileTabLayoutTmp = (function () {
maxWidth: withDefault(NumberControl, 450),
verticalAlignment: dropdownControl(VerticalAlignmentOptions, "stretch"),
showSeparator: withDefault(BoolCodeControl, true),
navStyle: withDefault(styleControl(NavLayoutStyle), defaultStyle),
navItemStyle: withDefault(styleControl(NavLayoutItemStyle), defaultStyle),
navItemHoverStyle: withDefault(styleControl(NavLayoutItemHoverStyle), {}),
navItemActiveStyle: withDefault(styleControl(NavLayoutItemActiveStyle), {}),
navStyle: styleControl(NavLayoutStyle, 'navStyle'),
navItemStyle: styleControl(NavLayoutItemStyle, 'navItemStyle'),
navItemHoverStyle: styleControl(NavLayoutItemHoverStyle, 'navItemHoverStyle'),
navItemActiveStyle: styleControl(NavLayoutItemActiveStyle, 'navItemActiveStyle'),
};
return new MultiCompBuilder(childrenMap, (props) => {
return new MultiCompBuilder(childrenMap, (props, dispatch) => {
return null;
})
.setPropertyViewFn((children) => {
Expand Down Expand Up @@ -402,6 +405,8 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
const bgColor = (useContext(ThemeContext)?.theme || defaultTheme).canvas;
const onEvent = comp.children.onEvent.getView();

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

useEffect(() => {
comp.children.jsonTabs.dispatchChangeValueAction({
manual: jsonItems as unknown as Array<ConstructorToDataType<typeof TabOptionComp>>
Expand All @@ -427,9 +432,20 @@ MobileTabLayoutTmp = withViewFn(MobileTabLayoutTmp, (comp) => {
const appView = useMemo(() => {
const currentTab = tabViews[tabIndex];

if (dataOptionType === DataOption.Json) {
return (currentTab &&
currentTab.children.app.getAppId() &&
currentTab.children.app.getView()) || (
<EmptyContent
text={readOnly ? "" : trans("aggregation.emptyTabTooltip")}
style={{ height: "100%", backgroundColor: "white" }}
/>
);
}

return (currentTab &&
currentTab.children.app.getAppId() &&
currentTab.children.app.getView()) || (
// currentTab.children.app.getAppId() &&
currentTab.children.action.getView()) || (
<EmptyContent
text={readOnly ? "" : trans("aggregation.emptyTabTooltip")}
style={{ height: "100%", backgroundColor: "white" }}
Expand Down
13 changes: 8 additions & 5 deletions client/packages/lowcoder/src/comps/comps/layout/navLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { trans } from "i18n";
import { EditorContainer, EmptyContent } from "pages/common/styledComponent";
import { useCallback, useEffect, useMemo, useState } from "react";
import styled from "styled-components";
import { isUserViewMode, useAppPathParam } from "util/hooks";
import { isUserViewMode, useAppPathParam, useMergeCompStyles } from "util/hooks";
import { BoolCodeControl, StringControl, jsonControl } from "comps/controls/codeControl";
import { styleControl } from "comps/controls/styleControl";
import {
Expand All @@ -41,6 +41,7 @@ import {
menuItemStyleOptions
} from "./navLayoutConstants";
import { clickEvent, eventHandlerControl } from "@lowcoder-ee/comps/controls/eventHandlerControl";
import { childrenToProps } from "@lowcoder-ee/comps/generators/multi";

const { Header } = Layout;

Expand Down Expand Up @@ -198,10 +199,10 @@ let NavTmpLayout = (function () {
backgroundImage: withDefault(StringControl, ""),
mode: dropdownControl(ModeOptions, "inline"),
collapse: BoolCodeControl,
navStyle: withDefault(styleControl(NavLayoutStyle), {...defaultStyle, padding: '1px'}),
navItemStyle: withDefault(styleControl(NavLayoutItemStyle), defaultStyle),
navItemHoverStyle: withDefault(styleControl(NavLayoutItemHoverStyle), {}),
navItemActiveStyle: withDefault(styleControl(NavLayoutItemActiveStyle), {}),
navStyle: styleControl(NavLayoutStyle, 'navStyle'),
navItemStyle: styleControl(NavLayoutItemStyle, 'navItemStyle'),
navItemHoverStyle: styleControl(NavLayoutItemHoverStyle, 'navItemHoverStyle'),
navItemActiveStyle: styleControl(NavLayoutItemActiveStyle, 'navItemActiveStyle'),
};
return new MultiCompBuilder(childrenMap, (props) => {
return null;
Expand Down Expand Up @@ -290,6 +291,8 @@ NavTmpLayout = withViewFn(NavTmpLayout, (comp) => {
const dataOptionType = comp.children.dataOptionType.getView();
const onEvent = comp.children.onEvent.getView();

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

// filter out hidden. unauthorised items filtered by server
const filterItem = useCallback((item: LayoutMenuItemComp): boolean => {
return !item.children.hidden.getView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
...(theme?.theme?.components?.[compType]?.[styleKey] || {}) as unknown as Record<string, string>
}
: undefined;
const styleProps = preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId
const styleProps = (!comp && !compType) || preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId
? props as ColorMap
: {} as ColorMap;

Expand Down
6 changes: 6 additions & 0 deletions client/packages/lowcoder/src/constants/themeConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ const qrCode = {
}
};

const divider = {
style: {
radius: "0px"
}
};

export const defaultTheme: ThemeDetail = {
primary: "#3377FF",
Expand Down Expand Up @@ -130,6 +135,7 @@ export const defaultTheme: ThemeDetail = {
qrCode,
treeSelect,
pageLayout,
divider,
password: input,
numberInput: input,
textArea: input,
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,7 @@ export const en = {
"title": "Title",
"align": "Alignment",
"dashed": "Dashed",
"type": "Vertical type",
"dashedDesc": "Whether to Use Dashed Line",
"titleDesc": "Divider Title",
"alignDesc": "Divider Title Alignment"
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/pages/userAuth/authUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function authRespValidate(

if (doValidResponse(resp)) {
onAuthSuccess?.();
sessionStorage.setItem("_just_logged_in_", "true");
history.replace(replaceUrl.replace(baseUrl, ''));
} else if (
resp.data.code === SERVER_ERROR_CODES.EXCEED_MAX_USER_ORG_COUNT ||
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/util/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function useMergeCompStyles(
const compTheme = theme?.theme?.components?.[compType];
const themeId = theme?.themeId;

const styleKeys = Object.keys(props).filter(key => key.toLowerCase().endsWith('style'));
const styleKeys = Object.keys(props).filter(key => key.toLowerCase().endsWith('style' || 'styles'));
const styleProps: Record<string, any> = {};
styleKeys.forEach((key: string) => {
styleProps[key] = (props as any)[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Mono<Organization> createDefault(User user, boolean isSuperAdmin) {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class AuthUser {

private String uid;
private String username;
private String email;
private String avatar;
private Map<String, Object> rawUserInfo;
private Map<String, Object> extra;
Expand All @@ -41,6 +42,7 @@ public Connection toAuthConnection() {
.authId(getAuthContext().getAuthConfig().getId())
.source(getSource())
.name(getUsername())
.email(getEmail())
.rawId(getUid())
.avatar(getAvatar())
.orgIds(StringUtils.isBlank(getOrgId()) ? Set.of() : Set.of(getOrgId()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class Connection implements Serializable {

private final String name;

private final String email;

private final String avatar;

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

@JsonCreator
private Connection(String authId, String source, String rawId, String name, String avatar, Set<String> orgIds, @Nullable
private Connection(String authId, String source, String rawId, String name, String email, String avatar, Set<String> orgIds, @Nullable
ConnectionAuthToken authConnectionAuthToken, Map<String, Object> rawUserInfo, Set<String> tokens) {
this.authId = authId;
this.source = source;
this.rawId = rawId;
this.name = name;
this.email = email;
this.avatar = avatar;
this.orgIds = CollectionUtils.isEmpty(orgIds) ? new HashSet<>() : orgIds;
this.authConnectionAuthToken = authConnectionAuthToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class User extends HasIdAndAuditing implements BeforeMongodbWrite, AfterM

private String name;

private String email;

private String uiLanguage;

private String avatar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ public interface UserRepository extends ReactiveMongoRepository<User, String> {
Flux<User> findByConnections_SourceAndConnections_RawIdIn(String source, Collection<String> rawIds);

Mono<User> findByName(String rawUuid);

//email1 and email2 should be equal
Mono<User> findByEmailOrConnections_Email(String email1, String email2);
}
Loading
Loading