Skip to content

Doc/existing components #1435

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 5 commits into from
Jan 10, 2025
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
6 changes: 3 additions & 3 deletions client/packages/lowcoder/src/comps/comps/iconComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const Container = styled.div<{
${(props) =>
props.$style &&
css`
height: calc(100% - ${props.$style.margin});
width: calc(100% - ${props.$style.margin});
padding: ${props.$style.padding};
height: calc(100% - ${props.$style.margin ?? '0px'});
width: calc(100% - ${props.$style.margin ?? '0px'});
padding: ${props.$style.padding ?? '0px'};
margin: ${props.$style.margin};
border: ${props.$style.borderWidth} solid ${props.$style.border};
border-radius: ${props.$style.radius};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
import { ButtonStyle } from "@lowcoder-ee/comps/controls/styleControlConstants";
import { migrateOldData } from "@lowcoder-ee/comps/generators/simpleGenerators";
import { refMethods } from "@lowcoder-ee/comps/generators/withMethodExposing";
import { blurMethod, clickMethod, focusWithOptions } from "@lowcoder-ee/comps/utils/methodUtils";
import { default as Button } from "antd/es/button";
import {
styleControl,
ButtonStyleType,
ButtonStyle,
migrateOldData,
refMethods,
blurMethod,
clickMethod,
focusWithOptions,
genActiveColor,
genHoverColor,
} from "lowcoder-sdk";
import { genActiveColor, genHoverColor } from "components/colorSelect/colorUtils";
import styled, { css } from "styled-components";
// import { genActiveColor, genHoverColor } from "lowcoder-design";

export function getButtonStyle(buttonStyle: any) {
const hoverColor = genHoverColor(buttonStyle.background);
const activeColor = genActiveColor(buttonStyle.background);
const hoverColor = buttonStyle.background && genHoverColor(buttonStyle.background);
const activeColor = buttonStyle.background && genActiveColor(buttonStyle.background);
return css`
&&& {
border-radius: ${buttonStyle.radius};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,72 @@ import { trans } from "i18n";
import Example from "../../common/Example";
import ExampleGroup from "../../common/ExampleGroup";

const buttons = {
"manual": [
{
"id": 0,
"label": "Option 1",
"badge": "1",
"description": "",
"icon": "/icon:antd/filetextoutlined"
},
{
"id": 1,
"label": "Option 2",
"badge": "0",
"description": "",
"icon": "/icon:antd/filetextoutlined"
}
]
};

export default function FloatButtonExample() {
return (
<>
<ExampleGroup
title={trans("componentDoc.basicUsage")}
description={trans("componentDoc.basicDemoDescription")}
description="The Following Examples Show the Basic Usage of the Float Button Component."
>
<Example
title={trans("componentDoc.default")}
title="A Simple Float Button"
config={{
icon: "/icon:antd/questioncircleoutlined",
value: "",
shape: "circle",
manual: [
{
badge: "1",
description: "",
icon: "/icon:antd/filetextoutlined",
id: 0,
label: "Option 1"
},
{
badge: "1",
description: "",
icon: "/icon:antd/filetextoutlined",
id: 1,
label: "Option 2"
}
]

buttons: buttons,
}}
compFactory={FloatButtonComp}
/>
<Example
title="Hiding the Float Button"
config={{
buttons: buttons,
hidden: true,
}}
compFactory={FloatButtonComp}
/>
<Example
title={trans("componentDoc.loading")}
width={120}
title="Different Icon on Float Button"
config={{
text: trans("componentDoc.submit"),
loading: true
buttons: buttons,
icon: "/icon:solid/align-justify",
}}
compFactory={FloatButtonComp}
/>
<Example
title={trans("componentDoc.disabled")}
width={120}
config={{
text: trans("componentDoc.submit"),
disabled: true
title="Button Theme - Default"
config={{
buttons: buttons,
buttonTheme: "default",
icon: "/icon:solid/align-justify",
includeMargin: true,
preventStyleOverwriting: false,
value: "",
}}
compFactory={FloatButtonComp}
/>
<Example
title="Button Shape - Square"
config={{
buttons: buttons,
shape: "square",
}}
compFactory={FloatButtonComp}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconComp } from "comps/comps/iconComp";
import { ControlButton } from "comps/comps/meetingComp/controlButton";
import { trans } from "i18n";
import Example from "../../common/Example";
import ExampleGroup from "../../common/ExampleGroup";
Expand All @@ -8,59 +8,110 @@ export default function IconButtonExample() {
<>
<ExampleGroup
title={trans("componentDoc.basicUsage")}
description={trans("componentDoc.basicDemoDescription")}
description="The Following Examples Show the Basic Usage of the Icon Button Component."
>
<Example
title={trans("componentDoc.default")}
width={20}
title="A Simple Icon button"
width={120}
config={{
form: "",
type: "",
prefixIcon: "/icon:solid/align-justify",
iconSize: "30px",
aspectRatio: "1 / 1",
autoHeight: "fixed",
}}
compFactory={IconComp}
compFactory={ControlButton}
/>
<Example
title={trans("componentDoc.loading")}
width={120}
config={{ type: "default", text: trans("componentDoc.submit"), loading: true }}
compFactory={IconComp}
config={{
prefixIcon: "/icon:solid/align-justify",
loading: true,
}}
compFactory={ControlButton}
/>
<Example
title={trans("componentDoc.disabled")}
width={120}
config={{ type: "default", text: trans("componentDoc.submit"), disabled: true }}
compFactory={IconComp}
config={{
disabled: true,
prefixIcon: "/icon:solid/align-justify",
}}
compFactory={ControlButton}
/>
<Example
title="Hiding the Icon Button"
width={120}
config={{
hidden: true,
prefixIcon: "/icon:solid/align-justify",
}}
compFactory={ControlButton}
/>
</ExampleGroup>

<ExampleGroup title={trans("componentDoc.style")}>
<ExampleGroup
title="Layout & Style"
description="The Following Examples Show the Layout & Style options on Float Button Component."
>
<Example
title={trans("componentDoc.danger")}
width={120}
config={{
style: { backgroundColor: "#CD574C", borderColor: "#AC3A32", color: "#E0ECF6" },
prefixIcon: "/icon:solid/ellipsis-vertical",
style: {
backgroundColor: "#CD574C",
borderColor: "#AC3A32",
color: "#E0ECF6" },
}}
compFactory={IconComp}
compFactory={ControlButton}
/>
<Example
title={trans("componentDoc.warning")}
width={120}
config={{
style: { backgroundColor: "#F4A125", borderColor: "#DA7D16", color: "#000000" },
prefixIcon: "/icon:solid/square-caret-right",
style: {
backgroundColor: "#F4A125",
borderColor: "#DA7D16",
color: "#000000" },
}}
compFactory={IconComp}
compFactory={ControlButton}
/>
<Example
title={trans("componentDoc.success")}
width={120}
config={{
style: { backgroundColor: "#5E8D6E", borderColor: "#40694E", color: "#E0ECF6" },
prefixIcon: "/icon:antd/audiofilled",
style: {
backgroundColor: "#5E8D6E",
borderColor: "#40694E",
color: "#E0ECF6" },
}}
compFactory={ControlButton}
/>
<Example
title="Icon Size - 30px"
width={120}
config={{
prefixIcon: "/icon:antd/audiofilled",
iconSize: "30px",
style: {
backgroundColor: "#5E8D6E",
borderColor: "#40694E",
color: "#E0ECF6" },
}}
compFactory={ControlButton}
/>
<Example
title="Icon Size - 40px"
width={120}
config={{
prefixIcon: "/icon:antd/audiofilled",
iconSize: "40px",
style: {
backgroundColor: "#5E8D6E",
borderColor: "#40694E",
color: "#E0ECF6" },
}}
compFactory={IconComp}
compFactory={ControlButton}
/>
</ExampleGroup>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { uiCompRegistry } from "comps/uiCompRegistry";
import { trans } from "i18n";
import { chartColorPalette } from "lowcoder-design";
import Example from "../../common/Example";
import ExampleGroup from "../../common/ExampleGroup";

const ChartCompWithDefault = uiCompRegistry["calendar"].comp;

export default function CalendarExample() {
return (
<>
<ExampleGroup
title={trans("componentDoc.basicUsage")}
description={trans("componentDoc.basicDemoDescription")}
>
<Example
title={trans("componentDoc.default")}
config={{
}}
compFactory={ChartCompWithDefault}
/>
</ExampleGroup>
</>
);
}
Loading
Loading