Skip to content

Commit 2e0ec40

Browse files
committed
add button disabled styles
1 parent 4cc299e commit 2e0ec40

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

client/packages/lowcoder/src/comps/comps/buttonComp/buttonCompConstants.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ export function getButtonStyle(buttonStyle: ButtonStyleType) {
4848
: buttonStyle.border} !important;
4949
}
5050
}
51+
52+
/* Disabled state styling */
53+
&:disabled,
54+
&.ant-btn-disabled {
55+
color: ${buttonStyle.disabledText || buttonStyle.text};
56+
background: ${buttonStyle.disabledBackground || buttonStyle.background};
57+
border-color: ${
58+
buttonStyle.disabledBorder || buttonStyle.border
59+
} !important;
60+
cursor: not-allowed;
61+
}
5162
}
5263
`;
5364
}

client/packages/lowcoder/src/comps/comps/buttonComp/scannerComp.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import {
44
Button100,
55
ButtonCompWrapper,
66
buttonRefMethods,
7+
ButtonStyleControl,
78
} from "comps/comps/buttonComp/buttonCompConstants";
89
import { BoolCodeControl, StringControl } from "comps/controls/codeControl";
910
import { ScannerEventHandlerControl } from "comps/controls/eventHandlerControl";
10-
import { styleControl } from "comps/controls/styleControl";
11-
import { DropdownStyle } from "comps/controls/styleControlConstants";
1211
import { withDefault } from "comps/generators";
1312
import { UICompBuilder } from "comps/generators/uiCompBuilder";
1413
import { CustomModal, Section, sectionNames } from "lowcoder-design";
@@ -127,7 +126,7 @@ const ScannerTmpComp = (function () {
127126
maskClosable: withDefault(BoolControl, true),
128127
onEvent: ScannerEventHandlerControl,
129128
disabled: BoolCodeControl,
130-
style: styleControl(DropdownStyle, "style"),
129+
style: ButtonStyleControl,
131130
viewRef: RefControl<HTMLElement>,
132131
};
133132
return new UICompBuilder(childrenMap, (props) => {

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,39 @@ function replaceAndMergeMultipleStyles(
959959
return temp;
960960
}
961961

962+
// Add disabled style constants
963+
const DISABLED_BACKGROUND = {
964+
name: "disabledBackground",
965+
label: trans("style.disabledBackground"),
966+
color: SECOND_SURFACE_COLOR,
967+
} as const;
968+
969+
const DISABLED_BORDER = {
970+
name: "disabledBorder",
971+
label: trans("style.disabledBorder"),
972+
depName: "disabledBackground",
973+
transformer: backgroundToBorder,
974+
} as const;
975+
976+
const DISABLED_TEXT = {
977+
name: "disabledText",
978+
label: trans("style.disabledText"),
979+
depName: "disabledBackground",
980+
depType: DEP_TYPE.CONTRAST_TEXT,
981+
transformer: contrastText,
982+
} as const;
983+
984+
// Re-export for reuse in other components if needed
985+
export const DISABLED_STYLE_FIELDS = [
986+
DISABLED_BACKGROUND,
987+
DISABLED_BORDER,
988+
DISABLED_TEXT,
989+
] as const;
990+
962991
export const ButtonStyle = [
963992
getBackground('primary'),
964993
...STYLING_FIELDS_SEQUENCE,
994+
...DISABLED_STYLE_FIELDS,
965995
] as const;
966996

967997
export const DropdownStyle = [

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,9 @@ export const en = {
511511
"tabAccent": "Tab Accent",
512512
"checkedBackground": "Checked Background Color",
513513
"uncheckedBackground": "Unchecked Background Color",
514+
"disabledBackground": "Disabled Background Color",
515+
"disabledBorder": "Disabled Border Color",
516+
"disabledText": "Disabled Text Color",
514517
"uncheckedBorder": "Unchecked Border Color",
515518
"indicatorBackground": "Indicator Background Color",
516519
"tableCellText": "Cell Text",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy