Skip to content

Commit dce2707

Browse files
committed
Fixed an issue that some components are not displayed in view mode.
1 parent 84d8026 commit dce2707

File tree

11 files changed

+8
-17
lines changed

11 files changed

+8
-17
lines changed

client/packages/lowcoder/src/comps/comps/containerBase/containerCompBuilder.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ export class ContainerCompBuilder<
4949
return this;
5050
}
5151
build() {
52-
if (!this.propertyViewFn) {
53-
throw new Error("no propertyViewFn provided");
54-
}
5552
if (this.childrenMap.hasOwnProperty("container")) {
5653
throw new Error("already has container");
5754
}

client/packages/lowcoder/src/comps/comps/containerComp/cardComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export const ContainerBaseComp = (function () {
263263
</ReactResizeDetector>
264264
);
265265
})
266-
if ((viewModeTriple() !== "admin")) {
266+
if ((viewModeTriple() === "edit")) {
267267
builder.setPropertyViewFn((children) => <PropertyViewCardComp {...children}></PropertyViewCardComp>);
268268
}
269269
return builder

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const ContainerBaseComp = (function () {
3131
);
3232
})
3333

34-
if ((viewModeTriple() !== "admin")) {
34+
if ((viewModeTriple() === "edit")) {
3535
builder.setPropertyViewFn((children) => <PropertyViewContainerComp {...children}></PropertyViewContainerComp>);
3636
}
3737
return builder

client/packages/lowcoder/src/comps/comps/containerComp/pageLayoutComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const ContainerBaseComp = (function () {
3636
</DisabledContext.Provider>
3737
);
3838
})
39-
if ((viewModeTriple() !== "admin")) {
39+
if ((viewModeTriple() === "edit")) {
4040
builder.setPropertyViewFn((children) => <PropertyViewPageLayout {...children}></PropertyViewPageLayout>);
4141
}
4242
return builder

client/packages/lowcoder/src/comps/comps/containerComp/textContainerComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const ContainerBaseComp = (function () {
6767
let builder = new ContainerCompBuilder(childrenMap, (props, dispatch) => {
6868
return <TriContainer {...props} />;
6969
})
70-
if ((viewModeTriple() !== "admin")) {
70+
if ((viewModeTriple() === "edit")) {
7171
builder.setPropertyViewFn((children) => <PropertyViewTextContainer {...children}></PropertyViewTextContainer>);
7272
}
7373
return builder

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const FormBaseComp = (function () {
197197
</DisabledContext.Provider>
198198
);
199199
})
200-
if ((viewModeTriple() !== "admin")) {
200+
if ((viewModeTriple() === "edit")) {
201201
builder.setPropertyViewFn((children) => <PropertyView {...children}></PropertyView>);
202202
}
203203
return builder

client/packages/lowcoder/src/comps/comps/pageLayoutComp/pageLayoutCompBuilder.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ export class ContainerCompBuilder<
4949
return this;
5050
}
5151
build() {
52-
if (!this.propertyViewFn) {
53-
throw new Error("no propertyViewFn provided");
54-
}
5552
if (this.childrenMap.hasOwnProperty("container")) {
5653
throw new Error("already has container");
5754
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ContainerBaseComp = (function () {
3434
</DisabledContext.Provider>
3535
);
3636
})
37-
if (viewModeTriple() !== "admin") {
37+
if (viewModeTriple() === "edit") {
3838
builder.setPropertyViewFn((children) => <PropertyView {...children}></PropertyView>);
3939
}
4040
return builder

client/packages/lowcoder/src/comps/comps/tabs/tabbedContainerComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export const TabbedContainerBaseComp = (function () {
304304
</DisabledContext.Provider>
305305
);
306306
})
307-
if ((viewModeTriple() !== "admin")) {
307+
if ((viewModeTriple() === "edit")) {
308308
builder.setPropertyViewFn((children) => <PropertyView {...children}></PropertyView>);
309309
}
310310
return builder

client/packages/lowcoder/src/comps/comps/triContainerComp/triContainerCompBuilder.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ export class ContainerCompBuilder<
4949
return this;
5050
}
5151
build() {
52-
if (!this.propertyViewFn) {
53-
throw new Error("no propertyViewFn provided");
54-
}
5552
if (this.childrenMap.hasOwnProperty("container")) {
5653
throw new Error("already has container");
5754
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const viewMode = () => REACT_APP_VIEW_MODE;
2-
export const viewModeTriple = () => viewMode() === "view" ? "view" : window.location.href.includes("edit") ? "edit" : "admin";
2+
export const viewModeTriple = () => window.location.href.includes("view") ? "view" : window.location.href.includes("edit") ? "edit" : "admin";
33
export const getLanguage = (): string => {
44
return localStorage.getItem('lowcoder_uiLanguage') || 'en';
55
}

0 commit comments

Comments
 (0)