Skip to content

Adding Shapes Component #854

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 27 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
10d27dc
initial shape component
freddysundowner Apr 18, 2024
840678f
Merge branch 'dev' of https://github.com/lowcoder-org/lowcoder into f…
freddysundowner Apr 18, 2024
6842c4f
merged from dev
freddysundowner Apr 18, 2024
cd3d37f
initial shape component
freddysundowner Apr 18, 2024
06d6458
selecting active shape
freddysundowner Apr 19, 2024
c0325fe
selecting active shape
freddysundowner Apr 19, 2024
7e190ed
aa
freddysundowner Apr 24, 2024
cd4f98b
fixed shape width and height, added default icon selection
freddysundowner Apr 27, 2024
a78fbe1
added icons lables
freddysundowner May 6, 2024
4ac855d
added grid too shapes comp and lables to shapes lists
freddysundowner May 6, 2024
acda8fe
referencing forked coolshapes package
freddysundowner May 6, 2024
e1a49c4
added grid too shapes comp and lables to shapes lists
freddysundowner May 6, 2024
578899e
initial shape component
freddysundowner Apr 18, 2024
e9d4aa4
initial shape component
freddysundowner Apr 18, 2024
be62b7d
selecting active shape
freddysundowner Apr 19, 2024
ebc66fe
selecting active shape
freddysundowner Apr 19, 2024
b07fee5
aa
freddysundowner Apr 24, 2024
b19c9bc
fixed shape width and height, added default icon selection
freddysundowner Apr 27, 2024
e5e1e2a
added icons lables
freddysundowner May 6, 2024
9e2f907
added grid too shapes comp and lables to shapes lists
freddysundowner May 6, 2024
bcd1211
referencing forked coolshapes package
freddysundowner May 6, 2024
5665218
added grid too shapes comp and lables to shapes lists
freddysundowner May 6, 2024
9143dd5
lazy load shapes comp
raheeliftikhar5 May 9, 2024
7dab708
removed console
raheeliftikhar5 May 9, 2024
307668c
Merge branch 'feat-ShapeComp' of https://github.com/lowcoder-org/lowc…
freddysundowner May 9, 2024
84ba449
fixed drag items to shape comp
freddysundowner May 10, 2024
b156fc0
Merge branch 'dev' into feat-ShapeComp
FalkWolsky May 11, 2024
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
Prev Previous commit
Next Next commit
aa
  • Loading branch information
freddysundowner authored and raheeliftikhar5 committed May 9, 2024
commit b07fee5858ec368e91c792260e8c8aa427ea51b2
38 changes: 14 additions & 24 deletions client/packages/lowcoder/src/comps/comps/shapeComp/shapeComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,16 @@ const IconView = (props: RecordConstructorToView<typeof childrenMap>) => {
setWidth(container?.clientWidth ?? 0);
setHeight(container?.clientHeight ?? 0);
};
const getIconDetails = () => {
if (props?.icon) {
let { props: pp } = props?.icon;
console.log(pp);
let [shape, setShape] = useState({ value: "star", index: 0 });
useEffect(() => {
if (props.icon) {
let shapeDetails = Object.values(props?.icon)[4]?.value;
setShape({
index: parseInt(shapeDetails?.split("_")[0]),
value: shapeDetails?.split("_")[1],
});
}

// let shapeDetails: any = props.icon["props"];
// console.log(shapeDetails);

// if (props.icon && props.icon?.props?.value) {
// return {
// index: parseInt(props.icon?.props?.value.split("_")[1]),
// value: props.icon?.props?.value.split("_")[0],
// };
// } else {
// return {
// index: 0,
// value: "star",
// };
// }
};
}, [props.icon]);

return (
<ReactResizeDetector onResize={onResize}>
Expand All @@ -114,12 +103,13 @@ const IconView = (props: RecordConstructorToView<typeof childrenMap>) => {
: props.iconSize,
background: props.style.background,
}}
onClick={() => props.onEvent("click")}
onClick={() => {
console.log("click");
}}
>
{/* {props.icon} */}
<Coolshape
type={getIconDetails()["value"]}
index={getIconDetails()["index"]}
type={shape.value as any}
index={shape.index}
size={48}
noise={true}
/>
Expand Down
27 changes: 21 additions & 6 deletions client/packages/lowcoder/src/comps/controls/shapeControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
iconWidgetClass,
} from "base/codeEditor/extensions/iconExtension";
import { i18nObjs, trans } from "i18n";
import { Coolshape } from "coolshapes-react";
import {
AbstractComp,
CompAction,
Expand Down Expand Up @@ -34,7 +35,6 @@ import styled from "styled-components";
import { setFieldsNoTypeCheck } from "util/objectUtils";
import { StringControl } from "./codeControl";
import { ControlParams } from "./controlParams";
import { log } from "console";

const ButtonWrapper = styled.div`
width: 100%;
Expand Down Expand Up @@ -81,6 +81,11 @@ const IconPicker = (props: {
IconType?: "OnlyAntd" | "All" | "default" | undefined;
}) => {
const icon = useShape(props.value);
console.log(props);
let shapeDetails = props.value;
console.log("shapeDetails ", shapeDetails);


return (
<ShapeSelect
onChange={props.onChange}
Expand All @@ -89,13 +94,22 @@ const IconPicker = (props: {
IconType={props.IconType}
>
<TacoButton style={{ width: "100%" }}>
{icon ? (
{props.value ? (
<ButtonWrapper>
<ButtonIconWrapper>{icon.getView()}</ButtonIconWrapper>
<ButtonText title={icon.title}>{icon.title}</ButtonText>
<ButtonIconWrapper>
<Coolshape
type={"star"}
index={0}
size={48}
noise={true}
/>
</ButtonIconWrapper>
{/* <ButtonIconWrapper>{icon.getView()}</ButtonIconWrapper>
<ButtonText title={icon.title}>{icon.title}</ButtonText> */}

<StyledDeleteInputIcon
onClick={(e) => {
props.onChange("");
props.onChange("");
e.stopPropagation();
}}
/>
Expand Down Expand Up @@ -246,7 +260,8 @@ export class ShapeControl extends AbstractComp<
}

override getPropertyView(): ReactNode {
throw new Error("Method not implemented.");
const value = this.codeControl.getView();
return <ShapeControlView value={value} />;
}

changeModeAction() {
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/constants/apiConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const DEFAULT_TEST_DATA_SOURCE_TIMEOUT_MS = 30000;
export const SHARE_TITLE = trans("share.title");

export enum API_STATUS_CODES {
SUCCESS = 200,
SUCCESS = 200,
REQUEST_NOT_AUTHORISED = 401,
SERVER_FORBIDDEN = 403,
RESOURCE_NOT_FOUND = 404,
Expand Down