Skip to content

Commit 36ccf9a

Browse files
authored
Merge branch 'lowcoder-org:main' into main
2 parents 8e9ab45 + eee2a41 commit 36ccf9a

File tree

13 files changed

+84
-79
lines changed

13 files changed

+84
-79
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ const childrenMap = {
138138
maxWidth: dropdownInputSimpleControl(OPTIONS, USER_DEFINE, "1920"),
139139
themeId: valueComp<string>(DEFAULT_THEMEID),
140140
customShortcuts: CustomShortcutsComp,
141+
disableCollision: valueComp<boolean>(false),
141142
};
142143
type ChildrenInstance = RecordConstructorToComp<typeof childrenMap> & {
143144
themeList: ThemeType[];

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ export function InnerGrid(props: ViewPropsWithSelect) {
478478
layout={props.layout}
479479
extraLayout={extraLayout}
480480
onDropDragOver={(e) => {
481-
482481
const compType = draggingUtils.getData<UICompType>("compType");
483482
const compLayout = draggingUtils.getData<UICompLayoutInfo>("compLayout");
484483
if (compType) {

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { NameAndExposingInfo } from "./utils/exposingTypes";
1717
import { checkName } from "./utils/rename";
1818
import { trans } from "i18n";
1919
import { UiLayoutType } from "./comps/uiComp";
20-
import { getCollisionStatus, getEditorModeStatus } from "util/localStorageUtil";
20+
import { getEditorModeStatus, saveCollisionStatus } from "util/localStorageUtil";
2121

2222
type RootComp = InstanceType<typeof RootCompTmp>;
2323

@@ -47,7 +47,7 @@ export class EditorState {
4747
readonly showPropertyPane: boolean = false;
4848
readonly selectedCompNames: Set<string> = new Set();
4949
readonly editorModeStatus: string = "";
50-
readonly collisionStatus: string = "";
50+
readonly collisionStatus: boolean = false;
5151
readonly isDragging: boolean = false;
5252
readonly draggingCompType: string = "button";
5353
readonly forceShowGrid: boolean = false; // show grid lines
@@ -65,12 +65,13 @@ export class EditorState {
6565
rootComp: RootComp,
6666
setEditorState: (fn: (editorState: EditorState) => EditorState) => void,
6767
initialEditorModeStatus: string = getEditorModeStatus(),
68-
initialCollisionStatus: string = getCollisionStatus()
6968
) {
7069
this.rootComp = rootComp;
7170
this.setEditorState = setEditorState;
7271
this.editorModeStatus = initialEditorModeStatus;
73-
this.collisionStatus = initialCollisionStatus;
72+
73+
// save collision status from app dsl to localstorage
74+
saveCollisionStatus(this.getCollisionStatus());
7475
}
7576

7677
/**
@@ -356,10 +357,6 @@ export class EditorState {
356357
this.changeState({ editorModeStatus: newEditorModeStatus });
357358
}
358359

359-
setCollisionStatus(newCollisionStatus: string) {
360-
this.changeState({ collisionStatus: newCollisionStatus });
361-
}
362-
363360
setDragging(dragging: boolean) {
364361
if (this.isDragging === dragging) {
365362
return;
@@ -513,8 +510,9 @@ export class EditorState {
513510
getAppType(): UiLayoutType {
514511
return this.getUIComp().children.compType.getView();
515512
}
516-
getCollisionStatus(): string {
517-
return this.collisionStatus;
513+
getCollisionStatus(): boolean {
514+
const { disableCollision } = this.getAppSettings();
515+
return disableCollision ?? false;
518516
}
519517

520518
}

client/packages/lowcoder/src/comps/generators/uiCompBuilder.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ export const DisabledContext = React.createContext<boolean>(false);
161161
*/
162162
function UIView(props: { comp: any; viewFn: any }) {
163163
const comp = props.comp;
164-
console.log(comp);
165-
166-
console.log(comp.children);
167164

168165
const childrenProps = childrenToProps(comp.children);
169166
const parentDisabled = useContext(DisabledContext);

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export enum AppTypeEnum {
1111
NavLayout = 3,
1212
// 4 folder, 5 mobile
1313
MobileTabLayout = 6,
14+
// WorkflowScreen = 7,
15+
// Slide = 8,
1416
}
1517

1618
export enum ApplicationCategoriesEnum {
@@ -52,6 +54,8 @@ export const AppUILayoutType: Record<AppTypeEnum, UiLayoutType> = {
5254
[AppTypeEnum.Module]: "module",
5355
[AppTypeEnum.NavLayout]: "nav",
5456
[AppTypeEnum.MobileTabLayout]: "mobileTabLayout",
57+
// [AppTypeEnum.WorkflowScreen]: "module",
58+
// [AppTypeEnum.Slide]: "normal",
5559
};
5660

5761
export type ApplicationDSLType = "editing" | "published" | "view_marketplace";
@@ -61,6 +65,7 @@ export type ApplicationPermissionType = "USER" | "GROUP" | "ORG_ADMIN";
6165
export interface ApplicationExtra {
6266
moduleHeight?: number;
6367
moduleWidth?: number;
68+
layers?: boolean;
6469
}
6570

6671
export interface ApplicationMeta {

client/packages/lowcoder/src/layout/utils.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { DraggableEvent } from "react-draggable";
55
import { PositionParams } from "./calculateUtils";
66
import { draggingUtils } from "./draggingUtils";
77
import { GridLayoutProps, ResizeHandleAxis } from "./gridLayoutPropTypes";
8-
98
import { getCollisionStatus } from "util/localStorageUtil";
109

1110
export type LayoutItem = {
@@ -172,12 +171,7 @@ export function collides(l1: LayoutItem, l2: LayoutItem): boolean {
172171
if (l1.y + l1.h <= l2.y) return false; // l1 is above l2
173172
if (l1.y >= l2.y + l2.h) return false; // l1 is below l2
174173

175-
if (getCollisionStatus() === "true") {
176-
return false;
177-
}
178-
else {
179-
return true; // boxes overlap
180-
}
174+
return !getCollisionStatus();
181175
}
182176

183177
/**

client/packages/lowcoder/src/pages/ApplicationV2/HomeLayout.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { useLocation } from "react-use";
2525
import { TrashTableView } from "./TrashTableView";
2626
import { HomepageTourV2 } from "../tutorials/HomeTutorialsV2";
2727
import { HomeCardView } from "./HomeCardView";
28-
import { getHomeLayout, HomeLayoutType, saveHomeLayout } from "../../util/localStorageUtil";
28+
import { getHomeLayout, HomeLayoutType, removeCollisionStatus, saveHomeLayout } from "../../util/localStorageUtil";
2929
import { HomeTableView } from "./HomeTableView";
3030
import { Layers } from "../../constants/Layers";
3131
import { CreateDropdown } from "./CreateDropdown";
@@ -288,6 +288,11 @@ export function HomeLayout(props: HomeLayoutProps) {
288288

289289
useEffect(() => saveHomeLayout(layout), [layout]);
290290

291+
useEffect(() => {
292+
// remove collision status from localstorage
293+
removeCollisionStatus();
294+
}, []);
295+
291296
const currentPath = useLocation().pathname;
292297

293298
if (!user.currentOrgId) {

client/packages/lowcoder/src/pages/editor/LeftLayersContent.tsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ import { Button, Divider, Dropdown, Flex, Input, Menu, MenuProps, Space } from "
2929
import { Switch } from "antd";
3030
import {
3131
saveCollisionStatus,
32-
getCollisionStatus,
3332
} from "util/localStorageUtil";
34-
import { check, withViewFn } from "@lowcoder-ee/index.sdk";
3533
import { DownOutlined } from "@ant-design/icons";
3634
import { ItemType } from "antd/es/menu/hooks/useItems";
3735
import ColorPicker, { configChangeParams } from "components/ColorPicker";
@@ -78,17 +76,18 @@ export const LeftLayersContent = (props: LeftLayersContentProps) => {
7876
const applicationId = useApplicationId();
7977

8078
// added by Falk Wolsky to support a Layers in Lowcoder
81-
const [collisionStatus, setCollisionStatus] = useState(() => {
82-
return getCollisionStatus();
83-
});
84-
85-
const toggleCollisionStatus: ToggleCollisionStatus = useCallback(
86-
(value) => {
87-
setCollisionStatus(value ? value : ("false" as DisabledCollisionStatus));
88-
saveCollisionStatus(value ? value : ("false" as DisabledCollisionStatus));
89-
},
90-
[collisionStatus]
91-
);
79+
const [collisionStatus, setCollisionStatus] = useState(editorState.getCollisionStatus());
80+
81+
useEffect(() => {
82+
saveCollisionStatus(collisionStatus);
83+
}, [collisionStatus])
84+
85+
const handleToggleLayer = (checked: boolean) => {
86+
editorState.rootComp.children.settings.children.disableCollision.dispatchChangeValueAction(
87+
checked
88+
)
89+
setCollisionStatus(checked);
90+
}
9291

9392
const getTree = (tree: CompTree, result: NodeItem[], key?: string) => {
9493
const { items, children } = tree;
@@ -429,7 +428,7 @@ export const LeftLayersContent = (props: LeftLayersContentProps) => {
429428
// TODO: sort by category
430429
// TODO: sort by Types etc.
431430
const uiCompInfos = _.sortBy(editorState.uiCompInfoList(), [(x) => x.name]);
432-
const isDraggable = editorState.collisionStatus === "true" ? true : false;
431+
const isDraggable = editorState.getCollisionStatus();
433432

434433
return (
435434
<>
@@ -439,11 +438,10 @@ export const LeftLayersContent = (props: LeftLayersContentProps) => {
439438
<Switch
440439
style={{margin : "0px 10px"}}
441440
size="small"
442-
checked={editorState.collisionStatus == "true"}
441+
defaultChecked={collisionStatus}
443442
disabled={false}
444-
onChange={(value: any) => {
445-
toggleCollisionStatus(value == true ? "true" : "false");
446-
editorState.setCollisionStatus(value == true ? "true" : "false");
443+
onChange={(value: boolean) => {
444+
handleToggleLayer(value);
447445
}}
448446
/>
449447
</div>

client/packages/lowcoder/src/pages/editor/editorSkeletonView.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
LeftPanel,
88
MiddlePanel,
99
} from "pages/common/styledComponent";
10-
import { getPanelStatus, getEditorModeStatus, getPanelStyle, getCollisionStatus } from "util/localStorageUtil";
10+
import { getPanelStatus, getEditorModeStatus, getPanelStyle } from "util/localStorageUtil";
1111
import { BottomSkeleton } from "pages/editor/bottom/BottomContent";
1212
import RightPanel from "pages/editor/right/RightPanel";
1313
import _ from "lodash";
@@ -48,7 +48,6 @@ export const EditorLoadingSpin = (props: { height?: string | number }) => {
4848
export default function EditorSkeletonView() {
4949
const panelStatus = getPanelStatus();
5050
const editorModeStatus = getEditorModeStatus();
51-
const collisionStatus = getCollisionStatus();
5251
const panelStyle = getPanelStyle();
5352
const isUserViewMode = useUserViewMode();
5453
const isTemplate = useTemplateViewMode();
@@ -70,7 +69,7 @@ export default function EditorSkeletonView() {
7069
<SiderStyled />
7170
{panelStatus.left && (
7271
<LeftPanel
73-
collisionStatus={collisionStatus}
72+
collisionStatus={false}
7473
toggleCollisionStatus={_.noop}
7574
>
7675
<StyledSkeleton active paragraph={{ rows: 10 }} />

client/packages/lowcoder/src/util/localStorageUtil.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,22 @@ export function saveEditorModeStatus(editorModeStatus: EditorModeStatus) {
4747
}
4848
//ADDED BY FRED TO SAVE enabledCollision
4949
export function saveCollisionStatus(
50-
collisionStatus: DisabledCollisionStatus
50+
collisionStatus: boolean
5151
) {
52-
localStorage.setItem("disable_collision", collisionStatus);
52+
localStorage.setItem("disableCollision", String(collisionStatus));
5353
}
5454

55-
export const DefaultCollisionStatus: DisabledCollisionStatus = "true";
56-
export function getCollisionStatus(): DisabledCollisionStatus {
57-
const str = localStorage.getItem("disable_collision");
58-
if (!str) {
59-
return DefaultCollisionStatus;
55+
// export const DefaultCollisionStatus: DisabledCollisionStatus = "true";
56+
export function getCollisionStatus(): boolean {
57+
const str = localStorage.getItem("disableCollision");
58+
if (str === 'true') {
59+
return true;
6060
}
61-
return str as DisabledCollisionStatus;
61+
return false;
62+
}
63+
64+
export function removeCollisionStatus() {
65+
localStorage.removeItem("disableCollision");
6266
}
6367

6468
export const DefaultEditorModeStatus: EditorModeStatus = "both";

deploy/docker/README.md

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,36 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod
2121

2222
Image can be configured by setting environment variables.
2323

24-
| Environment variable | Description | Value |
25-
| --------------------------------| --------------------------------------------------------------------| ----------------------------------------------------- |
26-
| `LOWCODER_REDIS_ENABLED` | If **true** redis server is started in the container | `true` |
27-
| `LOWCODER_MONGODB_ENABLED` | If **true** mongo database is started in the container | `true` |
28-
| `LOWCODER_API_SERVICE_ENABLED` | If **true** lowcoder api-service is started in the container | `true` |
29-
| `LOWCODER_NODE_SERVICE_ENABLED` | If **true** lowcoder node-service is started in the container | `true` |
30-
| `LOWCODER_FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` |
31-
| `LOWCODER_PUID` | ID of user running services. It will own all created logs and data. | `9001` |
32-
| `LOWCODER_PGID` | ID of group of the user running services. | `9001` |
33-
| `LOWCODER_MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
34-
| `LOWCODER_REDIS_URL` | Redis server URL | `redis://localhost:6379` |
35-
| `LOWCODER_DB_ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
36-
| `LOWCODER_DB_ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
37-
| `LOWCODER_CORS_DOMAINS` | CORS allowed domains | `*` |
38-
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
39-
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
40-
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
41-
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
42-
| `LOWCODER_MAX_ORGS_PER_USER` | Default maximum organizations per user | `100` |
43-
| `LOWCODER_MAX_MEMBERS_PER_ORG` | Default maximum members per organization | `1000` |
44-
| `LOWCODER_MAX_GROUPS_PER_ORG` | Default maximum groups per organization | `100` |
45-
| `LOWCODER_MAX_APPS_PER_ORG` | Default maximum applications per organization | `1000` |
46-
| `LOWCODER_MAX_DEVELOPERS` | Default maximum developers | `100` |
47-
| `LOWCODER_WORKSPACE_MODE` | SAAS to activate, ENTERPRISE to switch off - Workspaces | `SAAS` |
48-
| `LOWCODER_EMAIL_SIGNUP_ENABLED` | Control if users create their own Workspace automatic when Sign Up | `true` |
49-
| `LOWCODER_EMAIL_AUTH_ENABLED` | Control to show the eMail Login after Admin user is set | `true` |
24+
| Environment variable | Description | Value |
25+
|-------------------------------------| ----------------------------------------------------------------------- | ----------------------------------------------------- |
26+
| `LOWCODER_REDIS_ENABLED` | If **true** redis server is started in the container | `true` |
27+
| `LOWCODER_MONGODB_ENABLED` | If **true** mongo database is started in the container | `true` |
28+
| `LOWCODER_API_SERVICE_ENABLED` | If **true** lowcoder api-service is started in the container | `true` |
29+
| `LOWCODER_NODE_SERVICE_ENABLED` | If **true** lowcoder node-service is started in the container | `true` |
30+
| `LOWCODER_FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` |
31+
| `LOWCODER_PUID` | ID of user running services. It will own all created logs and data. | `9001` |
32+
| `LOWCODER_PGID` | ID of group of the user running services. | `9001` |
33+
| `LOWCODER_MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
34+
| `LOWCODER_REDIS_URL` | Redis server URL | `redis://localhost:6379` |
35+
| `LOWCODER_DB_ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
36+
| `LOWCODER_DB_ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
37+
| `LOWCODER_CORS_DOMAINS` | CORS allowed domains | `*` |
38+
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
39+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
40+
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
41+
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
42+
| `LOWCODER_MAX_ORGS_PER_USER` | Default maximum organizations per user | `100` |
43+
| `LOWCODER_MAX_MEMBERS_PER_ORG` | Default maximum members per organization | `1000` |
44+
| `LOWCODER_MAX_GROUPS_PER_ORG` | Default maximum groups per organization | `100` |
45+
| `LOWCODER_MAX_APPS_PER_ORG` | Default maximum applications per organization | `1000` |
46+
| `LOWCODER_MAX_DEVELOPERS` | Default maximum developers | `100` |
47+
| `LOWCODER_WORKSPACE_MODE` | SAAS to activate, ENTERPRISE to switch off - Workspaces | `SAAS` |
48+
| `LOWCODER_EMAIL_SIGNUP_ENABLED` | Control if users create their own Workspace automatic when Sign Up | `true` |
49+
| `LOWCODER_EMAIL_AUTH_ENABLED` | Control to show the eMail Login after Admin user is set | `true` |
50+
| `LOWCODER_CREATE_WORKSPACE_ON_SIGNUP` | IF LOWCODER_WORKSPACE_MODE = SAAS, controls if a own workspace is created for the user after sign up | `true` |
51+
| `LOWCODER_MARKETPLACE_PRIVATE_MODE` | Control if not to show Apps on the local Marketplace to anonymous users | `true` |
52+
53+
5054

5155

5256
## Building api-service image

0 commit comments

Comments
 (0)