Skip to content

Commit 06d6458

Browse files
selecting active shape
1 parent cd3d37f commit 06d6458

File tree

9 files changed

+4801
-2915
lines changed

9 files changed

+4801
-2915
lines changed

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

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Section, sectionNames } from "lowcoder-design";
1919
import { hiddenPropertyView } from "comps/utils/propertyUtils";
2020
import { trans } from "i18n";
2121
import { NumberControl } from "comps/controls/codeControl";
22-
import { IconControl } from "comps/controls/iconControl";
22+
import { ShapeControl } from "comps/controls/shapeControl";
2323
import ReactResizeDetector from "react-resize-detector";
2424
import { AutoHeightControl } from "../../controls/autoHeightControl";
2525
import {
@@ -28,6 +28,7 @@ import {
2828
} from "../../controls/eventHandlerControl";
2929
import { useContext } from "react";
3030
import { EditorContext } from "comps/editorState";
31+
import { Coolshape } from "coolshapes-react";
3132

3233
const Container = styled.div<{ $style: IconStyleType | undefined }>`
3334
display: flex;
@@ -58,7 +59,7 @@ const EventOptions = [clickEvent] as const;
5859

5960
const childrenMap = {
6061
style: styleControl(IconStyle),
61-
icon: withDefault(IconControl, "/icon:antd/homefilled"),
62+
icon: withDefault(ShapeControl, ""),
6263
autoHeight: withDefault(AutoHeightControl, "auto"),
6364
iconSize: withDefault(NumberControl, 20),
6465
onEvent: eventHandlerControl(EventOptions),
@@ -80,6 +81,27 @@ const IconView = (props: RecordConstructorToView<typeof childrenMap>) => {
8081
setWidth(container?.clientWidth ?? 0);
8182
setHeight(container?.clientHeight ?? 0);
8283
};
84+
const getIconDetails = () => {
85+
if (props?.icon) {
86+
let { props: pp } = props?.icon;
87+
console.log(pp);
88+
}
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+
};
83105

84106
return (
85107
<ReactResizeDetector onResize={onResize}>
@@ -94,7 +116,13 @@ const IconView = (props: RecordConstructorToView<typeof childrenMap>) => {
94116
}}
95117
onClick={() => props.onEvent("click")}
96118
>
97-
{props.icon}
119+
{/* {props.icon} */}
120+
<Coolshape
121+
type={getIconDetails()["value"]}
122+
index={getIconDetails()["index"]}
123+
size={48}
124+
noise={true}
125+
/>
98126
</Container>
99127
</ReactResizeDetector>
100128
);
@@ -149,4 +177,6 @@ ShapeBasicComp = class extends ShapeBasicComp {
149177
}
150178
};
151179

152-
export const ShapeComp = withExposingConfigs(ShapeBasicComp, [NameConfigHidden]);
180+
export const ShapeComp = withExposingConfigs(ShapeBasicComp, [
181+
NameConfigHidden,
182+
]);

0 commit comments

Comments
 (0)