Skip to content

Commit be65063

Browse files
committed
Fixed shape component can not call PropertyView
1 parent feefeb0 commit be65063

File tree

3 files changed

+9
-48
lines changed

3 files changed

+9
-48
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { trans } from "@lowcoder-ee/i18n";
33
import React, { useContext } from "react";
44
import { disabledPropertyView, EditorContext, hiddenPropertyView } from "lowcoder-sdk";
55

6-
console.log("shape");
7-
86
const PropertyView = ((children: any) => {
97
const editorModeStatus = useContext(EditorContext).editorModeStatus;
108
return (

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

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
withExposingConfigs,
66
} from "comps/generators/withExposing";
77
import { NameGenerator } from "comps/utils/nameGenerator";
8-
import { Section, sectionNames } from "lowcoder-design";
98
import { oldContainerParamsToNew } from "../containerBase";
109
import { toSimpleContainerData } from "../containerBase/simpleContainerComp";
1110
import { ShapeTriContainer } from "./shapeTriContainer";
@@ -15,22 +14,18 @@ import {
1514
ContainerChildren,
1615
ContainerCompBuilder,
1716
} from "../triContainerComp/triContainerCompBuilder";
18-
import {
19-
disabledPropertyView,
20-
hiddenPropertyView,
21-
} from "comps/utils/propertyUtils";
2217
import { trans } from "i18n";
2318
import { BoolCodeControl } from "comps/controls/codeControl";
2419
import { DisabledContext } from "comps/generators/uiCompBuilder";
25-
import React, { useContext, useEffect, useState } from "react";
26-
import { EditorContext } from "comps/editorState";
27-
20+
import React from "react";
21+
import {viewMode} from "@lowcoder-ee/util/editor";
22+
const PropertyView = React.lazy( async () => await import("./propertyView"));
2823
export const ContainerBaseComp = (function () {
2924
const childrenMap = {
3025
disabled: BoolCodeControl,
3126
icon: withDefault(ShapeControl, ""),
3227
};
33-
return new ContainerCompBuilder(childrenMap, (props, dispatch) => {
28+
let builder = new ContainerCompBuilder(childrenMap, (props, dispatch) => {
3429

3530

3631
return (
@@ -39,42 +34,10 @@ export const ContainerBaseComp = (function () {
3934
</DisabledContext.Provider>
4035
);
4136
})
42-
.setPropertyViewFn((children) => {
43-
return (
44-
<>
45-
<Section name={sectionNames.basic}>
46-
{children.icon.propertyView({
47-
label: trans("iconComp.icon"),
48-
IconType: "All",
49-
})}
50-
</Section>
51-
{(useContext(EditorContext).editorModeStatus === "logic" ||
52-
useContext(EditorContext).editorModeStatus === "both") && (
53-
<Section name={sectionNames.interaction}>
54-
{disabledPropertyView(children)}
55-
{hiddenPropertyView(children)}
56-
</Section>
57-
)}
58-
59-
{(useContext(EditorContext).editorModeStatus === "layout" ||
60-
useContext(EditorContext).editorModeStatus === "both") && (
61-
<>
62-
<Section name={sectionNames.layout}>
63-
{children.container.getPropertyView()}
64-
</Section>
65-
<Section name={sectionNames.style}>
66-
{children.container.stylePropertyView()}
67-
</Section>
68-
{children.container.children.showBody.getView() && (
69-
<Section name={"Body Style"}>
70-
{children.container.bodyStylePropertyView()}
71-
</Section>
72-
)}
73-
</>
74-
)}
75-
</>
76-
);
77-
})
37+
if (viewMode() !== "admin") {
38+
builder.setPropertyViewFn((children) => <PropertyView {...children}></PropertyView>);
39+
}
40+
return builder
7841
.build();
7942
})();
8043

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class ShapeControl extends AbstractComp<
213213

214214
propertyView(params: ControlParams) {
215215
const jsContent = (
216-
<MultiIconDisplay identifier={SwitchJsIcon}
216+
<SwitchJsIcon
217217
checked={this.useCodeEditor}
218218
onChange={() => this.dispatch(this.changeModeAction())}
219219
/>

0 commit comments

Comments
 (0)