Skip to content

[WIP] Introducing Layout Mode #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/packages/lowcoder-design/src/components/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,6 @@ export const sectionNames = {
validation: trans("prop.validation"),
layout: trans("prop.layout"),
style: trans("prop.style"),
data: trans("prop.data"),
meetings : trans("prop.meetings"), // added by Falk Wolsky
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const en = {
layout: "Layout",
style: "Style",
meetings : "Meeting Settings",
data: "Data",
},
passwordInput: {
label: "Password:",
Expand Down
20 changes: 20 additions & 0 deletions client/packages/lowcoder-design/src/icons/icon-ShowLayout.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions client/packages/lowcoder-design/src/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export { ReactComponent as WarningWhiteIcon } from "./icon-warning-white.svg";
export { ReactComponent as WarningIcon } from "./icon-warning.svg";
export { ReactComponent as WidthDragIcon } from "./icon-widthDrag.svg";
export { ReactComponent as ManyCheckboxIcon } from "./manyCheckbox.svg";
export { ReactComponent as Layout } from "./icon-ShowLayout.svg";
export { ReactComponent as Left } from "./icon-ShowLeft.svg";
export { ReactComponent as Middle } from "./icon-ShowMiddle.svg";
export { ReactComponent as Right } from "./icon-ShowRight.svg";
Expand Down
13 changes: 4 additions & 9 deletions client/packages/lowcoder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no viewport-fit=cover"
/>
<meta
lang="en"
name="description"
content="A developer-friendly open-source low code platform to build internal apps within minutes."
/>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no viewport-fit=cover"/>
<meta lang="en" name="description" content="Lowcoder | rapid App & VideoMeeting builder for everyone." />
<meta name="theme-color" content="#000000" />
<meta property="iframely:title" content="Lowcoder" />
<meta property="iframely:description" content="Lowcoder | rapid App & VideoMeeting builder for everyone." />
<style>
html,
body {
Expand Down
1 change: 0 additions & 1 deletion client/packages/lowcoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
"ua-parser-js": "^1.0.33",
"uuid": "^9.0.0",
"web-vitals": "^2.1.0",
"weixin-js-sdk": "^1.6.0",
"xlsx": "^0.18.5"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/app-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ declare var REACT_APP_BUNDLE_TYPE: "sdk" | "app";
declare var REACT_APP_DISABLE_JS_SANDBOX: string;
declare var REACT_APP_BUNDLE_BUILTIN_PLUGIN: string;

declare module "weixin-js-sdk";
// declare module "weixin-js-sdk";
34 changes: 21 additions & 13 deletions client/packages/lowcoder/src/comps/comps/buttonComp/buttonComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import {
} from "./buttonCompConstants";
import { RefControl } from "comps/controls/refControl";

import React, { useContext } from "react";

const FormLabel = styled(CommonBlueLabel)`
font-size: 13px;
margin-right: 4px;
Expand Down Expand Up @@ -161,24 +163,30 @@ const ButtonTmpComp = (function () {
{children.text.propertyView({ label: trans("text") })}
</Section>

<Section name={sectionNames.interaction}>
{children.type.propertyView({ label: trans("prop.type"), radioButton: true })}
{isDefault(children.type.getView())
? [
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.interaction}>
{children.type.propertyView({ label: trans("prop.type"), radioButton: true })}
{isDefault(children.type.getView())
? [
children.onEvent.getPropertyView(),
disabledPropertyView(children),
hiddenPropertyView(children),
loadingPropertyView(children),
]
: children.form.getPropertyView()}
</Section>

<Section name={sectionNames.layout}>
{children.prefixIcon.propertyView({ label: trans("button.prefixIcon") })}
{children.suffixIcon.propertyView({ label: trans("button.suffixIcon") })}
{hiddenPropertyView(children)}
</Section>
: children.form.getPropertyView()}
</Section>
</>
)}

<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
<Section name={sectionNames.layout}>
{children.prefixIcon.propertyView({ label: trans("button.prefixIcon") })}
{children.suffixIcon.propertyView({ label: trans("button.suffixIcon") })}
</Section>
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
</>
)}
</>
))
.setExposeMethodConfigs(buttonRefMethods)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { UICompBuilder } from "comps/generators/uiCompBuilder";
import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
import { Section, sectionNames } from "lowcoder-design";
import { trans } from "i18n";
import React, { ReactElement } from "react";
import React, { ReactElement, useContext } from "react";
import { EditorContext } from "comps/editorState";
import styled from "styled-components";
import { ButtonEventHandlerControl } from "../../controls/eventHandlerControl";
import { DropdownOptionControl } from "../../controls/optionsControl";
Expand All @@ -19,16 +20,16 @@ import {
getButtonStyle,
} from "./buttonCompConstants";


const DropdownButton = styled(Dropdown.Button)`
width: 100%;

.ant-btn-group {
width: 100%;
}
`;

const LeftButtonWrapper = styled.div<{ $buttonStyle: ButtonStyleType }>`
width: calc(100% - 32px);
width: calc(100%);
${(props) => `margin: ${props.$buttonStyle.margin};`}
margin-right: 0;
.ant-btn {
Expand Down Expand Up @@ -66,7 +67,7 @@ const DropdownTmpComp = (function () {
options: DropdownOptionControl,
disabled: BoolCodeControl,
onEvent: ButtonEventHandlerControl,
style: withDefault(ButtonStyleControl, { background: "#FFFFFF" }),
style: ButtonStyleControl,
};
return new UICompBuilder(childrenMap, (props) => {
const hasIcon =
Expand All @@ -92,7 +93,6 @@ const DropdownTmpComp = (function () {

return (
<ButtonCompWrapper disabled={props.disabled}>
{console.log("props,", props)}
{props.onlyMenu ? (
<Dropdown
disabled={props.disabled}
Expand Down Expand Up @@ -131,18 +131,26 @@ const DropdownTmpComp = (function () {
<>
<Section name={sectionNames.basic}>
{children.options.propertyView({})}
{children.text.propertyView({ label: trans("text") })}
{children.onlyMenu.propertyView({ label: trans("dropdown.onlyMenu") })}
</Section>

<Section name={sectionNames.interaction}>
{disabledPropertyView(children)}
{!children.onlyMenu.getView() && children.onEvent.getPropertyView()}
</Section>

<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.interaction}>
{!children.onlyMenu.getView() && children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
</Section>
</>
)}

<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
<Section name={sectionNames.layout}>
{children.text.propertyView({ label: trans("label") })}
{children.onlyMenu.propertyView({ label: trans("dropdown.onlyMenu") })}
</Section>
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
</>
)}
</>
))
.build();
Expand Down
32 changes: 19 additions & 13 deletions client/packages/lowcoder/src/comps/comps/buttonComp/linkComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ import { IconControl } from "comps/controls/iconControl";
import { hasIcon } from "comps/utils";
import { RefControl } from "comps/controls/refControl";

import { EditorContext } from "comps/editorState";
import React, { useContext } from "react";

const Link = styled(Button)<{ $style: LinkStyleType }>`
${(props) => `color: ${props.$style.text};margin: ${props.$style.margin}; padding: ${props.$style.padding};`}
${(props) => `color: ${props.$style.text}; margin: ${props.$style.margin}; padding: ${props.$style.padding};`}
&.ant-btn {
display: inline-flex;
align-items: center;
Expand Down Expand Up @@ -93,19 +96,22 @@ const LinkTmpComp = (function () {
{children.text.propertyView({ label: trans("text") })}
</Section>

<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{loadingPropertyView(children)}
</Section>

<Section name={sectionNames.layout}>
{children.prefixIcon.propertyView({ label: trans("button.prefixIcon") })}
{children.suffixIcon.propertyView({ label: trans("button.suffixIcon") })}
{hiddenPropertyView(children)}
</Section>
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{loadingPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.prefixIcon.propertyView({ label: trans("button.prefixIcon") })}
{children.suffixIcon.propertyView({ label: trans("button.suffixIcon") })}
</Section></>
)}

<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.style}>{children.style.getPropertyView()}</Section></>
)}
</>
);
})
Expand Down
31 changes: 19 additions & 12 deletions client/packages/lowcoder/src/comps/comps/buttonComp/scannerComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import styled from "styled-components";
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../../generators/withExposing";
import { hiddenPropertyView, disabledPropertyView } from "comps/utils/propertyUtils";
import { trans } from "i18n";
import React, { Suspense, useEffect, useRef, useState } from "react";
import React, { Suspense, useEffect, useRef, useState, useContext } from "react";
import { arrayStringExposingStateControl } from "comps/controls/codeStateControl";
import { BoolControl } from "comps/controls/boolControl";
import { ItemType } from "antd/lib/menu/hooks/useItems";
import { RefControl } from "comps/controls/refControl";
import { EditorContext } from "comps/editorState";

const Error = styled.div`
color: #f5222d;
Expand Down Expand Up @@ -212,20 +213,26 @@ const ScannerTmpComp = (function () {
<>
<Section name={sectionNames.basic}>
{children.text.propertyView({ label: trans("text") })}
{children.continuous.propertyView({ label: trans("scanner.continuous") })}
{children.continuous.getView() &&
children.uniqueData.propertyView({ label: trans("scanner.uniqueData") })}
{children.maskClosable.propertyView({ label: trans("scanner.maskClosable") })}
</Section>

<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
</Section>

<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.continuous.propertyView({ label: trans("scanner.continuous") })}
{children.continuous.getView() &&
children.uniqueData.propertyView({ label: trans("scanner.uniqueData") })}
{children.maskClosable.propertyView({ label: trans("scanner.maskClosable") })}
</Section>
</>
)}

<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.style}>{children.style.getPropertyView()}</Section></>
)}
</>
);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { ToggleButtonStyle } from "comps/controls/styleControlConstants";
import { styleControl } from "comps/controls/styleControl";
import { BoolControl } from "comps/controls/boolControl";
import { RefControl } from "comps/controls/refControl";
import React, { useContext } from "react";
import { EditorContext } from "comps/editorState";

const IconWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -90,38 +92,43 @@ const ToggleTmpComp = (function () {
label: trans("prop.defaultValue"),
tooltip: trans("toggleButton.valueDesc"),
})}
{children.showText.propertyView({ label: trans("toggleButton.showText") })}
{children.showText.getView() &&
children.trueText.propertyView({ label: trans("toggleButton.trueLabel") })}
{children.showText.getView() &&
children.falseText.propertyView({ label: trans("toggleButton.falseLabel") })}
</Section>

<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{loadingPropertyView(children)}
</Section>
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{loadingPropertyView(children)}
</Section>
<Section name={sectionNames.advanced}>
{children.showText.propertyView({ label: trans("toggleButton.showText") })}
{children.showText.getView() &&
children.trueText.propertyView({ label: trans("toggleButton.trueLabel") })}
{children.showText.getView() &&
children.falseText.propertyView({ label: trans("toggleButton.falseLabel") })}
{children.trueIcon.propertyView({ label: trans("toggleButton.trueIconLabel") })}
{children.falseIcon.propertyView({ label: trans("toggleButton.falseIconLabel") })}
{children.showText.getView() &&
children.iconPosition.propertyView({
label: trans("toggleButton.iconPosition"),
radioButton: true,
})}
{children.alignment.propertyView({
label: trans("toggleButton.alignment"),
radioButton: true,
})}
</Section>
</>
)}

<Section name={sectionNames.layout}>
{children.trueIcon.propertyView({ label: trans("toggleButton.trueIconLabel") })}
{children.falseIcon.propertyView({ label: trans("toggleButton.falseIconLabel") })}
{children.showText.getView() &&
children.iconPosition.propertyView({
label: trans("toggleButton.iconPosition"),
radioButton: true,
})}
{children.alignment.propertyView({
label: trans("toggleButton.alignment"),
radioButton: true,
})}
{hiddenPropertyView(children)}
</Section>
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<><Section name={sectionNames.style}>
{children.showBorder.propertyView({ label: trans("toggleButton.showBorder") })}
{children.style.getPropertyView()}
</Section></>
)}

<Section name={sectionNames.style}>
{children.showBorder.propertyView({ label: trans("toggleButton.showBorder") })}
{children.style.getPropertyView()}
</Section>
</>
))
.setExposeMethodConfigs(buttonRefMethods)
Expand Down
Loading