Skip to content

Commit 9fe2bbd

Browse files
Macraheeliftikhar5
Mac
authored andcommitted
Meeting & Colaboration
1 parent 4751e88 commit 9fe2bbd

File tree

5 files changed

+126
-20
lines changed

5 files changed

+126
-20
lines changed

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ import { stringExposingStateControl } from "../controls/codeStateControl";
3232
import { BoolControl } from "../controls/boolControl";
3333
import { BadgeBasicSection, badgeChildren } from "./badgeComp/badgeConstants";
3434
import { DropdownOptionControl } from "../controls/optionsControl";
35-
import { ReactElement, useContext } from "react";
35+
import { ReactElement, useContext, useEffect } from "react";
3636
import { CompNameContext, EditorContext } from "../editorState";
37+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
38+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
39+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
3740

3841
const AvatarWrapper = styled(Avatar) <AvatarProps & { $cursorPointer?: boolean, $style: AvatarStyleType }>`
3942
background: ${(props) => props.$style.background};
@@ -118,10 +121,10 @@ const sideOptions = [
118121
] as const;
119122

120123
const childrenMap = {
121-
style: styleControl(avatarContainerStyle),
122-
avatarStyle: styleControl(AvatarStyle),
123-
labelStyle: styleControl(avatarLabelStyle),
124-
captionStyle: styleControl(avatarLabelStyle),
124+
style: styleControl(avatarContainerStyle , 'style'),
125+
avatarStyle: styleControl(AvatarStyle , 'avatarStyle'),
126+
labelStyle: styleControl(avatarLabelStyle , 'labelStyle'),
127+
captionStyle: styleControl(avatarLabelStyle , 'captionStyle'),
125128
icon: withDefault(IconControl, "/icon:solid/user"),
126129
iconSize: withDefault(NumberControl, 40),
127130
onEvent: eventHandlerControl(EventOptions),
@@ -197,7 +200,24 @@ const AvatarView = (props: RecordConstructorToView<typeof childrenMap>) => {
197200
};
198201

199202
let AvatarBasicComp = (function () {
200-
return new UICompBuilder(childrenMap, (props) => <AvatarView {...props} />)
203+
return new UICompBuilder(childrenMap, (props , dispatch) => {
204+
205+
const theme = useContext(ThemeContext);
206+
const compType = useContext(CompTypeContext);
207+
const compTheme = theme?.theme?.components?.[compType];
208+
const styleProps: Record<string, any> = {};
209+
['style', 'labelStyle', 'inputFieldStyle', 'animationStyle'].forEach((key: string) => {
210+
styleProps[key] = (props as any)[key];
211+
});
212+
213+
useEffect(() => {
214+
setInitialCompStyles({
215+
dispatch,
216+
compTheme,
217+
styleProps,
218+
});
219+
}, []);
220+
return(<AvatarView {...props} />)})
201221
.setPropertyViewFn((children) => (
202222
<>
203223
<Section name={sectionNames.basic}>

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { NumberControl, StringControl } from "comps/controls/codeControl";
1010
import { Avatar, Tooltip } from "antd";
1111
import { clickEvent, eventHandlerControl, refreshEvent } from "../controls/eventHandlerControl";
1212
import styled from "styled-components";
13-
import { useContext, ReactElement } from "react";
13+
import { useContext, ReactElement, useEffect } from "react";
1414
import { MultiCompBuilder, stateComp, withDefault } from "../generators";
1515
import { EditorContext } from "comps/editorState";
1616
import { IconControl } from "../controls/iconControl";
@@ -19,6 +19,9 @@ import { optionsControl } from "../controls/optionsControl";
1919
import { BoolControl } from "../controls/boolControl";
2020
import { dropdownControl } from "../controls/dropdownControl";
2121
import { JSONObject } from "util/jsonTypes";
22+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
23+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
24+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
2225

2326
const MacaroneList = [
2427
'#fde68a',
@@ -86,8 +89,8 @@ export const alignOptions = [
8689
] as const;
8790

8891
const childrenMap = {
89-
avatar: styleControl(avatarGroupStyle),
90-
style: styleControl(avatarContainerStyle),
92+
avatar: styleControl(avatarGroupStyle , 'avatar'),
93+
style: styleControl(avatarContainerStyle , 'style'),
9194
maxCount: withDefault(NumberControl, 3),
9295
avatarSize: withDefault(NumberControl, 40),
9396
alignment: dropdownControl(alignOptions, "center"),
@@ -142,7 +145,24 @@ const AvatarGroupView = (props: RecordConstructorToView<typeof childrenMap> & {
142145
};
143146

144147
let AvatarGroupBasicComp = (function () {
145-
return new UICompBuilder(childrenMap, (props, dispatch) => <AvatarGroupView {...props} dispatch={dispatch} />)
148+
return new UICompBuilder(childrenMap, (props, dispatch) =>{
149+
const theme = useContext(ThemeContext);
150+
const compType = useContext(CompTypeContext);
151+
const compTheme = theme?.theme?.components?.[compType];
152+
const styleProps: Record<string, any> = {};
153+
['style', 'avatar'].forEach((key: string) => {
154+
styleProps[key] = (props as any)[key];
155+
});
156+
157+
useEffect(() => {
158+
setInitialCompStyles({
159+
dispatch,
160+
compTheme,
161+
styleProps,
162+
});
163+
}, []);
164+
return( <AvatarGroupView {...props} dispatch={dispatch} />
165+
)})
146166
.setPropertyViewFn((children) => (
147167
<>
148168
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ import dayjs from "dayjs";
6666
// import "dayjs/locale/zh-cn";
6767
import { getInitialsAndColorCode } from "util/stringUtils";
6868
import { default as CloseOutlined } from "@ant-design/icons/CloseOutlined";
69+
70+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
71+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
72+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
73+
74+
6975
dayjs.extend(relativeTime);
7076
// dayjs.locale("zh-cn");
7177

@@ -100,8 +106,8 @@ const childrenMap = {
100106
"#": ["123", "456", "789"],
101107
}),
102108
onEvent: eventHandlerControl(EventOptions),
103-
style: styleControl(CommentStyle),
104-
animationStyle: styleControl(AnimationStyle),
109+
style: styleControl(CommentStyle , 'style'),
110+
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
105111
commentList: jsonValueExposingStateControl("commentList", []),
106112
deletedItem: jsonValueExposingStateControl("deletedItem", []),
107113
submitedItem: jsonValueExposingStateControl("submitedItem", []),
@@ -370,9 +376,27 @@ const CommentCompBase = (
370376
};
371377

372378
let CommentBasicComp = (function () {
373-
return new UICompBuilder(childrenMap, (props, dispatch) => (
379+
return new UICompBuilder(childrenMap, (props, dispatch) =>{
380+
381+
const theme = useContext(ThemeContext);
382+
const compType = useContext(CompTypeContext);
383+
const compTheme = theme?.theme?.components?.[compType];
384+
const styleProps: Record<string, any> = {};
385+
['style', 'animationStyle'].forEach((key: string) => {
386+
styleProps[key] = (props as any)[key];
387+
});
388+
389+
useEffect(() => {
390+
setInitialCompStyles({
391+
dispatch,
392+
compTheme,
393+
styleProps,
394+
});
395+
}, []);
396+
397+
return (
374398
<CommentCompBase {...props} dispatch={dispatch} />
375-
))
399+
)})
376400
.setPropertyViewFn((children) => (
377401
<>
378402
<Section name={sectionNames.basic}>

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ import { AlignCenter, AlignLeft, AlignRight } from "lowcoder-design";
1010
import { NumberControl } from "comps/controls/codeControl";
1111
import { Avatar, Tooltip } from "antd";
1212
import { clickEvent, eventHandlerControl, refreshEvent } from "comps/controls/eventHandlerControl";
13-
import { ReactElement } from "react";
13+
import { ReactElement, useContext, useEffect } from "react";
1414
import { IconControl } from "comps/controls/iconControl";
1515
import { ColorControl } from "comps/controls/colorControl";
1616
import { optionsControl } from "comps/controls/optionsControl";
1717
import { BoolControl } from "comps/controls/boolControl";
1818
import { dropdownControl } from "comps/controls/dropdownControl";
1919
import { JSONObject } from "util/jsonTypes";
20+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
21+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
22+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
2023

2124
const MenuLinkWrapper = styled.div`
2225
> a {
@@ -88,7 +91,7 @@ export const alignOptions = [
8891

8992
export const ColumnAvatarsComp = (function () {
9093
const childrenMap = {
91-
style: styleControl(avatarGroupStyle),
94+
style: styleControl(avatarGroupStyle , 'style'),
9295
maxCount: withDefault(NumberControl, 3),
9396
avatarSize: withDefault(NumberControl, 40),
9497
alignment: dropdownControl(alignOptions, "center"),
@@ -107,7 +110,24 @@ export const ColumnAvatarsComp = (function () {
107110

108111
return new ColumnTypeCompBuilder(
109112
childrenMap,
110-
(props) => {
113+
(props , dispatch) => {
114+
115+
const theme = useContext(ThemeContext);
116+
const compType = useContext(CompTypeContext);
117+
const compTheme = theme?.theme?.components?.[compType];
118+
const styleProps: Record<string, any> = {};
119+
['style'].forEach((key: string) => {
120+
styleProps[key] = (props as any)[key];
121+
});
122+
123+
useEffect(() => {
124+
setInitialCompStyles({
125+
dispatch,
126+
compTheme,
127+
styleProps,
128+
});
129+
}, []);
130+
111131
return (
112132
<Container
113133
$style={props.style}

client/packages/lowcoder/src/comps/comps/textInputComp/mentionComp.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ import React, { useContext } from "react";
5858
import { EditorContext } from "comps/editorState";
5959
import { migrateOldData } from "comps/generators/simpleGenerators";
6060

61+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
62+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
63+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
64+
6165
const Wrapper = styled.div<{
6266
$style: InputLikeStyleType;
6367
}>`
@@ -96,8 +100,8 @@ let MentionTmpComp = (function () {
96100
viewRef: RefControl<TextAreaRef>,
97101
allowClear: BoolControl,
98102
autoHeight: AutoHeightControl,
99-
style: styleControl(InputLikeStyle),
100-
animationStyle: styleControl(AnimationStyle),
103+
style: styleControl(InputLikeStyle , 'style'),
104+
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
101105
mentionList: jsonControl(checkMentionListData, {
102106
"@": ["Li Lei", "Han Meimei"],
103107
"#": ["123", "456", "789"],
@@ -106,7 +110,25 @@ let MentionTmpComp = (function () {
106110
invalid: booleanExposingStateControl("invalid"),
107111
};
108112

109-
return new UICompBuilder(childrenMap, (props) => {
113+
return new UICompBuilder(childrenMap, (props , dispatch) => {
114+
115+
const theme = useContext(ThemeContext);
116+
const compType = useContext(CompTypeContext);
117+
const compTheme = theme?.theme?.components?.[compType];
118+
const styleProps: Record<string, any> = {};
119+
['style', 'animationStyle'].forEach((key: string) => {
120+
styleProps[key] = (props as any)[key];
121+
});
122+
123+
useEffect(() => {
124+
setInitialCompStyles({
125+
dispatch,
126+
compTheme,
127+
styleProps,
128+
});
129+
}, []);
130+
131+
110132
const { mentionList } = props;
111133
const [validateState, setvalidateState] = useState({});
112134
const [activationFlag, setActivationFlag] = useState(false);

0 commit comments

Comments
 (0)