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

Commit5a9732c

Browse files
Merge pull request#1674 from iamfaran/feat/1579-icon-buttons-table
[Feat]:#1579 Able to add Icon Buttons if Button Column type is selected
2 parents5331828 +9204237 commit5a9732c

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

‎client/packages/lowcoder/src/comps/comps/tableComp/column/simpleColumnTypeComps.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { trans } from "i18n";
77
import{useStyle}from"comps/controls/styleControl";
88
import{ButtonStyle}from"comps/controls/styleControlConstants";
99
import{Button100}from"comps/comps/buttonComp/buttonCompConstants";
10+
import{IconControl}from"comps/controls/iconControl";
11+
import{hasIcon}from"comps/utils";
1012

1113
exportconstColumnValueTooltip=trans("table.columnValueTooltip");
1214

@@ -20,7 +22,7 @@ export const ButtonTypeOptions = [
2022
value:"default",
2123
},
2224
{
23-
label:trans("text"),
25+
label:trans("table.text"),
2426
value:"text",
2527
},
2628
]asconst;
@@ -32,23 +34,36 @@ export const ButtonComp = (function () {
3234
onClick:ActionSelectorControlInContext,
3335
loading:BoolCodeControl,
3436
disabled:BoolCodeControl,
37+
prefixIcon:IconControl,
38+
suffixIcon:IconControl,
3539
};
3640
returnnewColumnTypeCompBuilder(
3741
childrenMap,
3842
(props)=>{
3943
constButtonStyled=()=>{
4044
conststyle=useStyle(ButtonStyle);
45+
consthasText=!!props.text;
46+
consthasPrefixIcon=hasIcon(props.prefixIcon);
47+
consthasSuffixIcon=hasIcon(props.suffixIcon);
48+
consticonOnly=!hasText&&(hasPrefixIcon||hasSuffixIcon);
49+
4150
return(
4251
<Button100
4352
type={props.buttonType}
4453
onClick={props.onClick}
4554
loading={props.loading}
4655
disabled={props.disabled}
4756
$buttonStyle={props.buttonType==="primary" ?style :undefined}
48-
style={{margin:0}}
57+
style={{
58+
margin:0,
59+
width:iconOnly ?'auto' :undefined,
60+
minWidth:iconOnly ?'auto' :undefined,
61+
padding:iconOnly ?'0 8px' :undefined
62+
}}
63+
icon={hasPrefixIcon ?props.prefixIcon :undefined}
4964
>
50-
{/* prevent the button from disappearing */}
51-
{!props.text ?" " :props.text}
65+
{hasText ?props.text :(iconOnly ?null :" ")}
66+
{hasSuffixIcon&&!props.loading&&<spanstyle={{marginLeft:hasText ?'8px' :0}}>{props.suffixIcon}</span>}
5267
</Button100>
5368
);
5469
};
@@ -62,6 +77,12 @@ export const ButtonComp = (function () {
6277
label:trans("table.columnValue"),
6378
tooltip:ColumnValueTooltip,
6479
})}
80+
{children.prefixIcon.propertyView({
81+
label:trans("button.prefixIcon"),
82+
})}
83+
{children.suffixIcon.propertyView({
84+
label:trans("button.suffixIcon"),
85+
})}
6586
{children.buttonType.propertyView({
6687
label:trans("table.type"),
6788
radioButton:true,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp