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

Commitdd50f07

Browse files
hide gradient selection in color picker for text/border colors
1 parentbd028f3 commitdd50f07

File tree

7 files changed

+34
-10
lines changed

7 files changed

+34
-10
lines changed

‎client/packages/lowcoder-design/src/components/colorSelect/index.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface ColorSelectProps {
2121
dispatch?:(value:any)=>void;
2222
changeColor?:(value:any)=>void;
2323
presetColors?:string[];
24+
allowGradient?:boolean;
2425
}
2526

2627
exportconstColorSelect=(props:ColorSelectProps)=>{
@@ -31,9 +32,11 @@ export const ColorSelect = (props: ColorSelectProps) => {
3132

3233
constpresetColors=useMemo(()=>{
3334
letcolors=props.presetColors||[];
34-
colors=colors.concat(gradientColors.slice(0,16-colors.length));
35+
if(props.allowGradient){
36+
colors=colors.concat(gradientColors.slice(0,16-colors.length));
37+
}
3538
returncolors;
36-
},[props.presetColors,selectedColor]);
39+
},[props.presetColors,selectedColor,props.allowGradient]);
3740

3841
constthrottleChange=useCallback(
3942
throttle((rgbaColor:string)=>{
@@ -70,6 +73,7 @@ export const ColorSelect = (props: ColorSelectProps) => {
7073
width={250}
7174
height={160}
7275
presets={presetColors}
76+
$allowGradient={props.allowGradient}
7377
/>
7478
</PopoverContainer>
7579
}
@@ -191,11 +195,14 @@ const ColorBlock = styled.div<{ $color: string }>`
191195
overflow: hidden;
192196
`;
193197

194-
constStyledColorPicker=styled(ColorPicker)`
198+
constStyledColorPicker=styled(ColorPicker)<{$allowGradient?:boolean}>`
199+
#rbgcp-wrapper > div:nth-child(2) > div:first-child > div:first-child {
200+
${props=>!props.$allowGradient&&`visibility: hidden`};
201+
}
195202
#rbgcp-wrapper > div:last-child > div:last-child {
196203
justify-content: flex-start !important;
197204
gap: 3px;
198-
205+
199206
> div {
200207
border: 1px solid lightgray;
201208
}

‎client/packages/lowcoder/src/components/ThemeSettingsSelector.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,10 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
379379
themeSettingKey!=="gridBgImageOrigin"&&(
380380
<divclassName="config-input">
381381
<ColorSelect
382-
changeColor={_.debounce(setColor,500,{
383-
leading:true,
384-
trailing:true,
385-
})}
382+
changeColor={setColor}
386383
color={color!}
387384
trigger="hover"
385+
allowGradient={themeSettingKey==='canvas'||themeSettingKey==='primarySurface'}
388386
/>
389387
<TacoInput
390388
value={color}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ function AppCanvasSettingsModal(props: ChildrenInstance) {
477477
})}
478478
{gridBg.propertyView({
479479
label:trans("style.background"),
480+
allowGradient:true,
480481
})}
481482
{gridBgImage.propertyView({
482483
label:trans("appSetting.gridBgImage"),

‎client/packages/lowcoder/src/comps/controls/colorControl.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ type PropertyViewParam = {
7373
isDep?:boolean;
7474
// auto-generated message?
7575
depMsg?:string;
76+
allowGradient?:boolean;
7677
};
7778

7879
exportclassColorControlextendsColorCodeControl{
@@ -95,7 +96,7 @@ function ColorItem(props: {
9596
constinputRef=React.createRef<HTMLDivElement>();
9697
constcontainerRef=React.createRef<HTMLDivElement>();
9798

98-
constcurrentThemeColors=useThemeColors();
99+
constcurrentThemeColors=useThemeColors(param.allowGradient);
99100

100101
constinput=propertyView.call(controlThis,{
101102
placeholder:param.panelDefaultColor,
@@ -138,6 +139,7 @@ function ColorItem(props: {
138139
<ColorSelect
139140
dispatch={controlThis.dispatch}
140141
color={param.panelDefaultColor||color||DEFAULT_COLOR}
142+
allowGradient={param.allowGradient}
141143
presetColors={currentThemeColors}
142144
/>
143145
<divstyle={{display:"flex"}}>

‎client/packages/lowcoder/src/comps/controls/styleControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
13651365
isDep:true,
13661366
depMsg:
13671367
depMsg,
1368+
allowGradient:config.name.includes('background'),
13681369
})}
13691370
</div>
13701371
);

‎client/packages/lowcoder/src/util/hooks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export function useMergeCompStyles(
233233
typeColorKey='primary'|'textDark'|'textLight'|'canvas'|'primarySurface'|'border';
234234
typeColorKeys=ColorKey[];
235235

236-
exportfunctionuseThemeColors(){
236+
exportfunctionuseThemeColors(allowGradient?:boolean){
237237
constcurrentTheme=useContext(ThemeContext)?.theme??{}asThemeDetail;
238238
constcolorKeys:ColorKeys=['primary','textDark','textLight','canvas','primarySurface','border'];
239239

@@ -248,6 +248,9 @@ export function useThemeColors() {
248248
colors.push(currentTheme[colorKey]??'');
249249
}
250250
})
251+
if(!allowGradient){
252+
colors=colors.concat(constantColors);
253+
}
251254
returnuniq(colors);
252255
},[
253256
currentTheme,

‎client/packages/lowcoder/src/util/styleUtils.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ const getBackgroundStyle = (style: Record<string, string | undefined>) => {
1515
`;
1616
}
1717

18+
constgetTextStyle=(color?:string)=>{
19+
returncss`
20+
${isValidColor(color)&&`color:${color};`}
21+
${isValidGradient(color)&&`
22+
background-image: -webkit-${color};
23+
-webkit-background-clip: text;
24+
-webkit-text-fill-color: transparent;
25+
`}
26+
`;
27+
}
28+
1829
export{
1930
getBackgroundStyle,
31+
getTextStyle,
2032
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp