Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { BoolCodeControl, StringControl } from "comps/controls/codeControl";
import { dropdownControl } from "comps/controls/dropdownControl";
import { disabledPropertyView, loadingPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import { useStyle } from "comps/controls/styleControl";
import { ButtonStyle } from "comps/controls/styleControlConstants";
import { styleControl, useStyle } from "comps/controls/styleControl";
import { ButtonStyle, TableColumnButtonStyle } from "comps/controls/styleControlConstants";
import { Button100 } from "comps/comps/buttonComp/buttonCompConstants";
import { IconControl } from "comps/controls/iconControl";
import { hasIcon } from "comps/utils";
Expand Down Expand Up @@ -58,10 +58,11 @@ const childrenMap = {
disabled: BoolCodeControl,
prefixIcon: IconControl,
suffixIcon: IconControl,
style: styleControl(TableColumnButtonStyle, 'style', { boldTitle: true }),
};

const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstructorToComp<typeof childrenMap>>}) => {
const style = useStyle(ButtonStyle);
const themeButtonStyle = useStyle(ButtonStyle);
const hasText = !!props.text;
const hasPrefixIcon = hasIcon(props.prefixIcon);
const hasSuffixIcon = hasIcon(props.suffixIcon);
Expand All @@ -85,7 +86,10 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
onClick={handleClick}
loading={props.loading}
disabled={props.disabled}
$buttonStyle={props.buttonType === "primary" ? style : undefined}
$buttonStyle={props.buttonType === "primary" ? ({
...themeButtonStyle,
...(props.style as any),
} as any) : undefined}
style={buttonStyle}
icon={hasPrefixIcon ? props.prefixIcon : undefined}
>
Expand Down Expand Up @@ -120,6 +124,7 @@ const ButtonCompTmp = (function () {
})}
{loadingPropertyView(children)}
{disabledPropertyView(children)}
{children.style.getPropertyView()}
{children.onClick.propertyView()}
</>
))
Expand Down
6 changes: 4 additions & 2 deletions client/packages/lowcoder/src/comps/controls/styleControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -937,11 +937,12 @@ function calcColors<ColorMap extends Record<string, string>>(
return res as ColorMap;
}

const TitleDiv = styled.div`
const TitleDiv = styled.div<{ $boldTitle?: boolean }>`
display: flex;
justify-content: space-between;
font-size: 13px;
line-height: 1;
font-weight: ${(props) => (props.$boldTitle ? 600 : 400)};

span:nth-of-type(2) {
cursor: pointer;
Expand Down Expand Up @@ -1149,6 +1150,7 @@ const useThemeStyles = (
export function styleControl<T extends readonly SingleColorConfig[]>(
colorConfigs: T,
styleKey: string = '',
options?: { boldTitle?: boolean },
) {
type ColorMap = { [K in Names<T>]: string };
const childrenMap: any = {};
Expand Down Expand Up @@ -1268,7 +1270,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(

return (
<>
<TitleDiv>
<TitleDiv $boldTitle={options?.boldTitle}>
<span>{label}</span>
{showReset && (
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2371,6 +2371,18 @@ export const RichTextEditorStyle = [
BORDER_WIDTH,
] as const;

export const TableColumnButtonStyle = [
getBackground('primary'),
{
name: "text",
label: trans("style.text"),
color: "#000000",
},
PADDING,
BORDER,
] as const;


export type QRCodeStyleType = StyleConfigType<typeof QRCodeStyle>;
export type TimeLineStyleType = StyleConfigType<typeof TimeLineStyle>;
export type AvatarStyleType = StyleConfigType<typeof AvatarStyle>;
Expand Down Expand Up @@ -2437,6 +2449,7 @@ export type TableColumnStyleType = StyleConfigType<typeof TableColumnStyle>;
export type TableColumnLinkStyleType = StyleConfigType<
typeof TableColumnLinkStyle
>;
export type TableColumnButtonStyleType = StyleConfigType<typeof TableColumnButtonStyle>;
export type TableSummaryRowStyleType = StyleConfigType<typeof TableSummaryRowStyle>;
export type FileStyleType = StyleConfigType<typeof FileStyle>;
export type FileViewerStyleType = StyleConfigType<typeof FileViewerStyle>;
Expand Down
Loading