Skip to content

Commit b07fee5

Browse files
freddysundownerraheeliftikhar5
authored andcommitted
aa
1 parent ebc66fe commit b07fee5

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

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

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,16 @@ const IconView = (props: RecordConstructorToView<typeof childrenMap>) => {
8181
setWidth(container?.clientWidth ?? 0);
8282
setHeight(container?.clientHeight ?? 0);
8383
};
84-
const getIconDetails = () => {
85-
if (props?.icon) {
86-
let { props: pp } = props?.icon;
87-
console.log(pp);
84+
let [shape, setShape] = useState({ value: "star", index: 0 });
85+
useEffect(() => {
86+
if (props.icon) {
87+
let shapeDetails = Object.values(props?.icon)[4]?.value;
88+
setShape({
89+
index: parseInt(shapeDetails?.split("_")[0]),
90+
value: shapeDetails?.split("_")[1],
91+
});
8892
}
89-
90-
// let shapeDetails: any = props.icon["props"];
91-
// console.log(shapeDetails);
92-
93-
// if (props.icon && props.icon?.props?.value) {
94-
// return {
95-
// index: parseInt(props.icon?.props?.value.split("_")[1]),
96-
// value: props.icon?.props?.value.split("_")[0],
97-
// };
98-
// } else {
99-
// return {
100-
// index: 0,
101-
// value: "star",
102-
// };
103-
// }
104-
};
93+
}, [props.icon]);
10594

10695
return (
10796
<ReactResizeDetector onResize={onResize}>
@@ -114,12 +103,13 @@ const IconView = (props: RecordConstructorToView<typeof childrenMap>) => {
114103
: props.iconSize,
115104
background: props.style.background,
116105
}}
117-
onClick={() => props.onEvent("click")}
106+
onClick={() => {
107+
console.log("click");
108+
}}
118109
>
119-
{/* {props.icon} */}
120110
<Coolshape
121-
type={getIconDetails()["value"]}
122-
index={getIconDetails()["index"]}
111+
type={shape.value as any}
112+
index={shape.index}
123113
size={48}
124114
noise={true}
125115
/>

client/packages/lowcoder/src/comps/controls/shapeControl.tsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
iconWidgetClass,
55
} from "base/codeEditor/extensions/iconExtension";
66
import { i18nObjs, trans } from "i18n";
7+
import { Coolshape } from "coolshapes-react";
78
import {
89
AbstractComp,
910
CompAction,
@@ -34,7 +35,6 @@ import styled from "styled-components";
3435
import { setFieldsNoTypeCheck } from "util/objectUtils";
3536
import { StringControl } from "./codeControl";
3637
import { ControlParams } from "./controlParams";
37-
import { log } from "console";
3838

3939
const ButtonWrapper = styled.div`
4040
width: 100%;
@@ -81,6 +81,11 @@ const IconPicker = (props: {
8181
IconType?: "OnlyAntd" | "All" | "default" | undefined;
8282
}) => {
8383
const icon = useShape(props.value);
84+
console.log(props);
85+
let shapeDetails = props.value;
86+
console.log("shapeDetails ", shapeDetails);
87+
88+
8489
return (
8590
<ShapeSelect
8691
onChange={props.onChange}
@@ -89,13 +94,22 @@ const IconPicker = (props: {
8994
IconType={props.IconType}
9095
>
9196
<TacoButton style={{ width: "100%" }}>
92-
{icon ? (
97+
{props.value ? (
9398
<ButtonWrapper>
94-
<ButtonIconWrapper>{icon.getView()}</ButtonIconWrapper>
95-
<ButtonText title={icon.title}>{icon.title}</ButtonText>
99+
<ButtonIconWrapper>
100+
<Coolshape
101+
type={"star"}
102+
index={0}
103+
size={48}
104+
noise={true}
105+
/>
106+
</ButtonIconWrapper>
107+
{/* <ButtonIconWrapper>{icon.getView()}</ButtonIconWrapper>
108+
<ButtonText title={icon.title}>{icon.title}</ButtonText> */}
109+
96110
<StyledDeleteInputIcon
97111
onClick={(e) => {
98-
props.onChange("");
112+
props.onChange("");
99113
e.stopPropagation();
100114
}}
101115
/>
@@ -246,7 +260,8 @@ export class ShapeControl extends AbstractComp<
246260
}
247261

248262
override getPropertyView(): ReactNode {
249-
throw new Error("Method not implemented.");
263+
const value = this.codeControl.getView();
264+
return <ShapeControlView value={value} />;
250265
}
251266

252267
changeModeAction() {

client/packages/lowcoder/src/constants/apiConstants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const DEFAULT_TEST_DATA_SOURCE_TIMEOUT_MS = 30000;
99
export const SHARE_TITLE = trans("share.title");
1010

1111
export enum API_STATUS_CODES {
12-
SUCCESS = 200,
12+
SUCCESS = 200,
1313
REQUEST_NOT_AUTHORISED = 401,
1414
SERVER_FORBIDDEN = 403,
1515
RESOURCE_NOT_FOUND = 404,

0 commit comments

Comments
 (0)