Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow dynamic/conditional styles + Refactor logic for applying theme on each comp#1105

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
FalkWolsky merged 4 commits intodevfromdynamic-style-fixes
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
}from"lowcoder-sdk";
import{getEchartsLocale,trans}from"i18n/comps";
import{ItemColorComp}from"comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -74,8 +73,6 @@ BasicChartTmpComp = withViewFn(BasicChartTmpComp, (comp) => {
log.error('theme chart error: ',error);
}

useMergeCompStyles?.(childrenToProps(comp.children),comp.dispatch);

consttriggerClickEvent=async(dispatch:any,action:CompAction<JSONValue>)=>{
awaitgetPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,7 +45,6 @@ import {
jsonValueExposingStateControl,
CalendarDeleteIcon,
Tooltip,
useMergeCompStyles,
EditorContext,
CompNameContext,
} from 'lowcoder-sdk';
Expand DownExpand Up@@ -137,8 +136,6 @@ let CalendarBasicComp = (function () {
const [left, setLeft] = useState<number | undefined>(undefined);
const [licensed, setLicensed] = useState<boolean>(props.licenseKey !== "");

useMergeCompStyles?.(props, dispatch);

useEffect(() => {
setLicensed(props.licenseKey !== "");
}, [props.licenseKey]);
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -71,8 +70,6 @@ CandleStickChartTmpComp = withViewFn(CandleStickChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/basicChartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -83,8 +82,6 @@ MapTmpComp = withViewFn(MapTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ FunnelChartTmpComp = withViewFn(FunnelChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ import {
getPromiseAfterDispatch,
dropdownControl,
JSONObject,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -73,8 +72,6 @@ GaugeChartTmpComp = withViewFn(GaugeChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ import {
getPromiseAfterDispatch,
dropdownControl,
JSONObject,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -73,8 +72,6 @@ GraphChartTmpComp = withViewFn(GraphChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ HeatmapChartTmpComp = withViewFn(HeatmapChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ RadarChartTmpComp = withViewFn(RadarChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ SankeyChartTmpComp = withViewFn(SankeyChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ SunburstChartTmpComp = withViewFn(SunburstChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ ThemeriverChartTmpComp = withViewFn(ThemeriverChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ TreeChartTmpComp = withViewFn(TreeChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,6 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand DownExpand Up@@ -72,8 +71,6 @@ TreemapChartTmpComp = withViewFn(TreemapChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,8 +55,6 @@ import {
autocompleteIconColor,
componentSize,
} from "./autoCompleteConstants";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";


const InputStyle = styled(Input) <{ $style: InputLikeStyleType }>`
box-shadow: ${props=>`${props.$style?.boxShadow} ${props.$style?.boxShadowColor}`};
Expand DownExpand Up@@ -104,9 +102,7 @@ const getValidate = (value: any): "" | "warning" | "error" | undefined => {
};

let AutoCompleteCompBase = (function () {
return new UICompBuilder(childrenMap, (props, dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);

return new UICompBuilder(childrenMap, (props) => {
const {
items,
onEvent,
Expand Down
5 changes: 1 addition & 4 deletionsclient/packages/lowcoder/src/comps/comps/avatar.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,7 +34,6 @@ import { BadgeBasicSection, badgeChildren } from "./badgeComp/badgeConstants";
import { DropdownOptionControl } from "../controls/optionsControl";
import { ReactElement, useContext, useEffect } from "react";
import { CompNameContext, EditorContext } from "../editorState";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const AvatarWrapper = styled(Avatar) <AvatarProps & { $cursorPointer?: boolean, $style: AvatarStyleType }>`
background: ${(props) => props.$style.background};
Expand DownExpand Up@@ -198,9 +197,7 @@ const AvatarView = (props: RecordConstructorToView<typeof childrenMap>) => {
};

let AvatarBasicComp = (function () {
return new UICompBuilder(childrenMap, (props , dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);

return new UICompBuilder(childrenMap, (props) => {
return(<AvatarView {...props} />)})
.setPropertyViewFn((children) => (
<>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,6 @@ import { optionsControl } from "../controls/optionsControl";
import { BoolControl } from "../controls/boolControl";
import { dropdownControl } from "../controls/dropdownControl";
import { JSONObject } from "util/jsonTypes";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const MacaroneList = [
'#fde68a',
Expand DownExpand Up@@ -143,9 +142,7 @@ const AvatarGroupView = (props: RecordConstructorToView<typeof childrenMap> & {
};

let AvatarGroupBasicComp = (function () {
return new UICompBuilder(childrenMap, (props, dispatch) =>{
useMergeCompStyles(props as Record<string, any>, dispatch);

return new UICompBuilder(childrenMap, (props, dispatch) => {
return( <AvatarGroupView {...props} dispatch={dispatch} />
)})
.setPropertyViewFn((children) => (
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,6 @@ import { RefControl } from "comps/controls/refControl";
import React, { useContext, useEffect } from "react";
import { AnimationStyle } from "@lowcoder-ee/comps/controls/styleControlConstants";
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const FormLabel = styled(CommonBlueLabel)`
font-size: 13px;
Expand DownExpand Up@@ -135,9 +134,7 @@ const ButtonTmpComp = (function () {
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
viewRef: RefControl<HTMLElement>,
};
return new UICompBuilder(childrenMap, (props , dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);

return new UICompBuilder(childrenMap, (props) => {
return(
<ButtonCompWrapper disabled={props.disabled}>
<EditorContext.Consumer>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,6 @@ import {
getButtonStyle,
} from "./buttonCompConstants";
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const StyledDropdownButton = styled(DropdownButton)`
width: 100%;
Expand DownExpand Up@@ -90,9 +89,7 @@ const DropdownTmpComp = (function () {
onEvent: ButtonEventHandlerControl,
style: styleControl(DropdownStyle, 'style'),
};
return new UICompBuilder(childrenMap, (props, dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);

return new UICompBuilder(childrenMap, (props) => {
const hasIcon =
props.options.findIndex((option) => (option.prefixIcon as ReactElement)?.props.value) > -1;
const items = props.options
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,6 @@ import styled from "styled-components";
import { ButtonEventHandlerControl } from "comps/controls/eventHandlerControl";
import { manualOptionsControl } from "comps/controls/optionsControl";
import { useContext, useEffect } from "react";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const StyledFloatButton = styled(FloatButton)<{
$animationStyle: AnimationStyleType;
Expand DownExpand Up@@ -133,8 +132,7 @@ const FloatButtonView = (props: RecordConstructorToView<typeof childrenMap>) =>
};

let FloatButtonBasicComp = (function () {
return new UICompBuilder(childrenMap, (props , dispatch) => {
useMergeCompStyles(props, dispatch);
return new UICompBuilder(childrenMap, (props) => {
return(
<FloatButtonView {...props} />
)})
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,7 +22,6 @@ import { RefControl } from "comps/controls/refControl";

import { EditorContext } from "comps/editorState";
import React, { useContext, useEffect } from "react";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const Link = styled(Button)<{
$style: LinkStyleType;
Expand DownExpand Up@@ -92,10 +91,7 @@ const LinkTmpComp = (function () {
suffixIcon: IconControl,
viewRef: RefControl<HTMLElement>,
};
return new UICompBuilder(childrenMap, (props, dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);


return new UICompBuilder(childrenMap, (props) => {
// chrome86 bug: button children should not contain only empty span
const hasChildren = hasIcon(props.prefixIcon) || !!props.text || hasIcon(props.suffixIcon);
return (
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@ import { BoolControl } from "comps/controls/boolControl";
import type { ItemType } from "antd/es/menu/interface";
import { RefControl } from "comps/controls/refControl";
import { EditorContext } from "comps/editorState";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";

const Error = styled.div`
color: #f5222d;
Expand DownExpand Up@@ -74,9 +73,7 @@ const ScannerTmpComp = (function () {
style: styleControl(DropdownStyle, 'style'),
viewRef: RefControl<HTMLElement>,
};
return new UICompBuilder(childrenMap, (props, dispatch) => {
useMergeCompStyles(props as Record<string, any>, dispatch);

return new UICompBuilder(childrenMap, (props) => {
const [showModal, setShowModal] = useState(false);
const [errMessage, setErrMessage] = useState("");
const [videoConstraints, setVideoConstraints] = useState<MediaTrackConstraints>({
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp