|
1 | 1 | import { CompAction, RecordConstructorToView, changeChildAction } from "lowcoder-core";
|
2 | 2 | import { styleControl } from "comps/controls/styleControl";
|
3 |
| -import { QRCodeStyle, QRCodeStyleType, avatarGroupStyle, AvatarGroupStyleType } from "comps/controls/styleControlConstants"; |
| 3 | +import { QRCodeStyle, QRCodeStyleType, avatarGroupStyle, AvatarGroupStyleType, avatarContainerStyle, AvatarContainerStyleType } from "comps/controls/styleControlConstants"; |
4 | 4 | import { UICompBuilder } from "comps/generators/uiCompBuilder";
|
5 | 5 | import { NameConfig, NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
|
6 | 6 | import { AlignCenter, AlignLeft, AlignRight, Section, sectionNames } from "lowcoder-design";
|
@@ -31,13 +31,20 @@ const MacaroneList = [
|
31 | 31 | '#fcd6bb',
|
32 | 32 | ]
|
33 | 33 |
|
34 |
| -const Container = styled.div<{ $style: AvatarGroupStyleType | undefined, alignment: string }>` |
| 34 | +const Container = styled.div<{ $style: AvatarContainerStyleType | undefined, alignment: string }>` |
35 | 35 | height: 100%;
|
36 | 36 | width: 100%;
|
37 | 37 | display: flex;
|
38 | 38 | align-items: center;
|
39 | 39 | justify-content: ${props => props.alignment};
|
40 | 40 | cursor: pointer;
|
| 41 | + background: ${props => props?.$style?.background}; |
| 42 | + margin: ${props => props?.$style?.margin}; |
| 43 | + padding: ${props => props?.$style?.padding}; |
| 44 | + border: ${props => props?.$style?.border}; |
| 45 | + border-style: ${props => props?.$style?.borderStyle}; |
| 46 | + border-radius: ${props => props?.$style?.radius}; |
| 47 | + border-width: ${props => props?.$style?.borderWidth}; |
41 | 48 | `;
|
42 | 49 |
|
43 | 50 | const DropdownOption = new MultiCompBuilder(
|
@@ -79,7 +86,8 @@ export const alignOptions = [
|
79 | 86 | ] as const;
|
80 | 87 |
|
81 | 88 | const childrenMap = {
|
82 |
| - style: styleControl(avatarGroupStyle), |
| 89 | + avatar: styleControl(avatarGroupStyle), |
| 90 | + style: styleControl(avatarContainerStyle), |
83 | 91 | maxCount: withDefault(NumberControl, 3),
|
84 | 92 | avatarSize: withDefault(NumberControl, 40),
|
85 | 93 | alignment: dropdownControl(alignOptions, "center"),
|
@@ -112,8 +120,8 @@ const AvatarGroupView = (props: RecordConstructorToView<typeof childrenMap> & {
|
112 | 120 | src={item.src ?? undefined}
|
113 | 121 | icon={(item.AvatarIcon as ReactElement)?.props.value === '' || item.label.trim() !== '' ? undefined : item.AvatarIcon}
|
114 | 122 | style={{
|
115 |
| - color: item.color ? item.color : (props.style.fill !== '#FFFFFF' ? props.style.fill : '#FFFFFF'), |
116 |
| - backgroundColor: item.backgroundColor ? item.backgroundColor : (props.autoColor ? MacaroneList[index % MacaroneList.length] : props.style.background), |
| 123 | + color: item.color ? item.color : (props.avatar.fill !== '#FFFFFF' ? props.avatar.fill : '#FFFFFF'), |
| 124 | + backgroundColor: item.backgroundColor ? item.backgroundColor : (props.autoColor ? MacaroneList[index % MacaroneList.length] : props.avatar.background), |
117 | 125 | }}
|
118 | 126 | size={props.avatarSize}
|
119 | 127 | onClick={() => {
|
@@ -163,9 +171,14 @@ let AvatarGroupBasicComp = (function () {
|
163 | 171 | )}
|
164 | 172 |
|
165 | 173 | {["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
|
| 174 | + <> |
| 175 | + <Section name={sectionNames.avatarStyle}> |
| 176 | + {children.avatar.getPropertyView()} |
| 177 | + </Section> |
166 | 178 | <Section name={sectionNames.style}>
|
167 | 179 | {children.style.getPropertyView()}
|
168 | 180 | </Section>
|
| 181 | + </> |
169 | 182 | )}
|
170 | 183 | </>
|
171 | 184 | ))
|
|
0 commit comments