Skip to content
Open
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
3 changes: 2 additions & 1 deletion client/packages/lowcoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@
"y-protocols": "^1.0.6",
"y-websocket": "^3.0.0",
"yjs": "^13.6.27",
"zod": "^3.25.76"
"zod": "^3.25.76",
"zustand": "^5.0.14"
},
"scripts": {
"supportedBrowsers": "yarn dlx browserslist-useragent-regexp --allowHigherVersions '>0.2%,not dead,not op_mini all,chrome >=69'",
Expand Down
7 changes: 6 additions & 1 deletion client/packages/lowcoder/src/components/CompName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { trans } from "i18n";
import { getComponentDocUrl } from "comps/utils/compDocUtil";
import { getComponentPlaygroundUrl } from "comps/utils/compDocUtil";
import { parseCompType } from "comps/utils/remote";
import { useEditorStore } from "comps/editorStore";

const CompDiv = styled.div<{ $width?: number; $hasSearch?: boolean; $showSearch?: boolean }>`
width: ${(props) => (props.$width ? props.$width : 312)}px;
Expand Down Expand Up @@ -79,7 +80,11 @@ export const CompName = React.memo((props: Iprops) => {
const [showSearch, setShowSearch] = useState<boolean>(false);

const editorState = useContext(EditorContext);
const selectedComp = useMemo(() => values(editorState.selectedComps())[0], [editorState]);
const selectedCompNames = useEditorStore((state) => state.selectedCompNames);
const selectedComp = useMemo(
() => values(editorState.selectedComps(selectedCompNames))[0],
[editorState, selectedCompNames]
);
const compType = useMemo(() => selectedComp.children.compType.getView() as UICompType, [selectedComp]);
const compInfo = useMemo(() => parseCompType(compType), [compType]);
const docUrl = useMemo(() => getComponentDocUrl(compType), [compType]);
Expand Down
5 changes: 3 additions & 2 deletions client/packages/lowcoder/src/comps/comps/avatarGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import styled from "styled-components";
import { useContext, ReactElement, useEffect } from "react";
import { MultiCompBuilder, stateComp, withDefault } from "../generators";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import { IconControl } from "../controls/iconControl";
import { ColorControl } from "../controls/colorControl";
import { optionsControl } from "../controls/optionsControl";
Expand Down Expand Up @@ -150,7 +151,7 @@ let AvatarGroupBasicComp = (function () {
)})
.setPropertyViewFn((children) => (
<>
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
{["logic", "both"].includes(useEditorStore((state) => state.editorModeStatus)) && (
<>
<Section name={sectionNames.basic}>
{children.avatars.propertyView({})}
Expand All @@ -175,7 +176,7 @@ let AvatarGroupBasicComp = (function () {
</>
)}

{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
{["layout", "both"].includes(useEditorStore((state) => state.editorModeStatus)) && (
<>
<Section name={sectionNames.avatarStyle}>
{children.avatar.getPropertyView()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { dropdownControl } from "comps/controls/dropdownControl";
import { ButtonEventHandlerControl } from "comps/controls/eventHandlerControl";
import { IconControl } from "comps/controls/iconControl";
import { CompNameContext, EditorContext, EditorState } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import { withDefault } from "comps/generators";
import { NewChildren, UICompBuilder } from "comps/generators/uiCompBuilder";
import {
Expand Down Expand Up @@ -146,7 +147,7 @@ type ChildrenType = NewChildren<RecordConstructorToComp<typeof childrenMap>>;
const ButtonPropertyView = React.memo((props: {
children: ChildrenType
}) => {
const { editorModeStatus } = useContext(EditorContext);
const editorModeStatus = useEditorStore((state) => state.editorModeStatus);
return (
<>
<Section name={sectionNames.basic}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Section, sectionNames } from "lowcoder-design";
import { trans } from "i18n";
import React, { ReactElement, useContext } from "react";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import styled from "styled-components";
import EllipsisOutlined from "@ant-design/icons/EllipsisOutlined";
import { IconControl } from "comps/controls/iconControl";
Expand Down Expand Up @@ -256,7 +257,7 @@ const DropdownTmpComp = (function () {
{children.options.propertyView({})}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<><Section name={sectionNames.interaction}>
{!children.onlyMenu.getView() && !children.onlyIcon.getView()
? children.onEvent.getPropertyView()
Expand All @@ -267,7 +268,7 @@ const DropdownTmpComp = (function () {
</>
)}

{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.layout}>
{children.text.propertyView({ label: trans("label") })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { hasIcon } from "comps/utils";
import { RefControl } from "comps/controls/refControl";

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

const Link = styled(Button)<{
Expand Down Expand Up @@ -126,7 +127,7 @@ const LinkTmpComp = (function () {
{children.text.propertyView({ label: trans("text") })}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<><Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
Expand All @@ -141,7 +142,7 @@ const LinkTmpComp = (function () {
</Section></>
)}

{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle} hasTooltip={true}>{children.animationStyle.getPropertyView()}</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { arrayStringExposingStateControl, stringExposingStateControl } from "com
import { BoolControl } from "comps/controls/boolControl";
import { RefControl } from "comps/controls/refControl";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";

const Error = styled.div`
color: #f5222d;
Expand Down Expand Up @@ -290,8 +291,8 @@ const ScannerTmpComp = (function () {
{children.text.propertyView({ label: trans("text") })}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" ||
useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" ||
useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
Expand All @@ -315,8 +316,8 @@ const ScannerTmpComp = (function () {
</>
)}

{(useContext(EditorContext).editorModeStatus === "layout" ||
useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" ||
useEditorStore((state) => state.editorModeStatus) === "both") && (
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { BoolControl } from "comps/controls/boolControl";
import { RefControl } from "comps/controls/refControl";
import React, { useContext, useEffect } from "react";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import { Tooltip } from "antd";

const IconWrapper = styled.div`
Expand Down Expand Up @@ -112,7 +113,7 @@ const ToggleTmpComp = (function () {
})}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<><Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{disabledPropertyView(children)}
Expand Down Expand Up @@ -143,8 +144,8 @@ const ToggleTmpComp = (function () {
</>
)}

{(useContext(EditorContext).editorModeStatus === "layout" ||
useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" ||
useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.style}>
{children.showBorder.propertyView({
Expand Down
5 changes: 3 additions & 2 deletions client/packages/lowcoder/src/comps/comps/carouselComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { AnimationStyle, AnimationStyleType, CarouselStyle } from "comps/control

import { useContext } from "react";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";

// TODO: dots at top position needs proper margin (should be the same as bottom position)

Expand Down Expand Up @@ -90,15 +91,15 @@ let CarouselBasicComp = (function () {
{children.data.propertyView({ label: trans("data") })}
</Section>

{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
{["logic", "both"].includes(useEditorStore((state) => state.editorModeStatus)) && (
<><FormDataPropertyView {...children} />
<Section name={sectionNames.interaction}>
{children.onEvent.getPropertyView()}
{hiddenPropertyView(children)}
{children.autoPlay.propertyView({ label: trans("carousel.autoPlay") })}
</Section></>
)}
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
{["layout", "both"].includes(useEditorStore((state) => state.editorModeStatus)) && (
<><Section name={sectionNames.layout}>
{children.showDots.propertyView({ label: trans("carousel.showDots") })}
{children.dotPosition.propertyView({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
import { RefControl } from "comps/controls/refControl";
import { hiddenPropertyView } from "comps/utils/propertyUtils";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import { trans } from "i18n";

import { ChatBoxView } from "./components/ChatBoxView";
Expand Down Expand Up @@ -187,7 +188,7 @@ const avatarStyleOptions = [

const ChatBoxPropertyView = React.memo((props: { children: any }) => {
const { children } = props;
const editorMode = useContext(EditorContext).editorModeStatus;
const editorMode = useEditorStore((state) => state.editorModeStatus);
const [messageStyleSegment, setMessageStyleSegment] = useState<MessageStyleSegment>("own");
const [avatarStyleSegment, setAvatarStyleSegment] = useState<MessageStyleSegment>("own");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { BoolCodeControl, NumberControl, StringControl } from "comps/controls/co

import { useContext, useEffect } from "react";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";

import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
import { DisabledContext } from "comps/generators/uiCompBuilder";
Expand Down Expand Up @@ -259,14 +260,14 @@ export const ResponsiveLayoutBaseComp = (function () {
})}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<Section name={sectionNames.interaction}>
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
</Section>
)}

{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
{["layout", "both"].includes(useEditorStore((state) => state.editorModeStatus)) && (
<>
<Section name={sectionNames.layout}>
{children.autoHeight.getPropertyView()}
Expand All @@ -291,7 +292,7 @@ export const ResponsiveLayoutBaseComp = (function () {
</>
)}

{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
doubleClickEvent,
} from "comps/controls/eventHandlerControl";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";


// Introducing styles
Expand Down Expand Up @@ -387,7 +388,7 @@ let CommentBasicComp = (function () {
})}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.data}>
{children.value.propertyView({
Expand Down Expand Up @@ -418,7 +419,7 @@ let CommentBasicComp = (function () {
</>
)}

{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<><Section name={sectionNames.layout}>
{children.sendCommentAble.getView() &&
children.buttonText.propertyView({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { BoolCodeControl, StringControl } from "comps/controls/codeControl";
import { BoolControl } from "comps/controls/boolControl";
import { useContext, useEffect, useRef, useState } from "react";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import { Card } from "antd";
import styled from "styled-components";
import { AnimationStyle, AnimationStyleType, CardHeaderStyle, CardHeaderStyleType, CardStyle, CardStyleType } from "comps/controls/styleControlConstants";
Expand Down Expand Up @@ -278,7 +279,7 @@ export const ContainerBaseComp = (function () {
.setPropertyViewFn((children) => {
return (
<>
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.basic}>
{children.size.propertyView({
Expand Down Expand Up @@ -337,7 +338,7 @@ export const ContainerBaseComp = (function () {
</>
)}

{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<>
<Section name={sectionNames.layout}>
{children.cardType.propertyView({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BoolCodeControl } from "comps/controls/codeControl";
import { DisabledContext } from "comps/generators/uiCompBuilder";
import React, { useContext } from "react";
import { EditorContext } from "comps/editorState";
import { useEditorStore } from "comps/editorStore";
import { AnimationStyle } from "@lowcoder-ee/comps/controls/styleControlConstants";
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";

Expand All @@ -34,14 +35,14 @@ export const ContainerBaseComp = (function () {
.setPropertyViewFn((children) => {
return (
<>
{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "logic" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<Section name={sectionNames.interaction}>
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
</Section>
)}

{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
{(useEditorStore((state) => state.editorModeStatus) === "layout" || useEditorStore((state) => state.editorModeStatus) === "both") && (
<><Section name={sectionNames.layout}>
{children.container.getPropertyView()}
</Section>
Expand Down
Loading
Loading