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

Commit7bf7051

Browse files
committed
[FEAT]:#1579 Replace Display Mode with Prefix/Suffix Icons approach
1 parent318571a commit7bf7051

File tree

2 files changed

+24
-40
lines changed

2 files changed

+24
-40
lines changed

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

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,38 +27,25 @@ export const ButtonTypeOptions = [
2727
},
2828
]asconst;
2929

30-
exportconstButtonDisplayOptions=[
31-
{
32-
label:trans("table.text"),
33-
value:"text",
34-
},
35-
{
36-
label:trans("table.icon"),
37-
value:"icon",
38-
},
39-
{
40-
label:trans("table.textAndIcon"),
41-
value:"textAndIcon",
42-
},
43-
]asconst;
44-
4530
exportconstButtonComp=(function(){
4631
constchildrenMap={
4732
text:StringControl,
4833
buttonType:dropdownControl(ButtonTypeOptions,"primary"),
4934
onClick:ActionSelectorControlInContext,
5035
loading:BoolCodeControl,
5136
disabled:BoolCodeControl,
52-
displayMode:dropdownControl(ButtonDisplayOptions,"text"),
53-
icon:IconControl,
37+
prefixIcon:IconControl,
38+
suffixIcon:IconControl,
5439
};
5540
returnnewColumnTypeCompBuilder(
5641
childrenMap,
5742
(props)=>{
5843
constButtonStyled=()=>{
5944
conststyle=useStyle(ButtonStyle);
60-
constshowIcon=props.displayMode==="icon"||props.displayMode==="textAndIcon";
61-
constshowText=props.displayMode==="text"||props.displayMode==="textAndIcon";
45+
consthasText=!!props.text;
46+
consthasPrefixIcon=hasIcon(props.prefixIcon);
47+
consthasSuffixIcon=hasIcon(props.suffixIcon);
48+
consticonOnly=!hasText&&(hasPrefixIcon||hasSuffixIcon);
6249

6350
return(
6451
<Button100
@@ -67,11 +54,16 @@ export const ButtonComp = (function () {
6754
loading={props.loading}
6855
disabled={props.disabled}
6956
$buttonStyle={props.buttonType==="primary" ?style :undefined}
70-
style={{margin:0}}
71-
icon={showIcon&&hasIcon(props.icon) ?props.icon :undefined}
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}
7264
>
73-
{/* prevent the button from disappearing */}
74-
{showText ?(!props.text ?" " :props.text) :null}
65+
{hasText ?props.text :(iconOnly ?null :" ")}
66+
{hasSuffixIcon&&!props.loading&&<spanstyle={{marginLeft:hasText ?'8px' :0}}>{props.suffixIcon}</span>}
7567
</Button100>
7668
);
7769
};
@@ -81,21 +73,16 @@ export const ButtonComp = (function () {
8173
)
8274
.setPropertyViewFn((children)=>(
8375
<>
84-
{children.displayMode.propertyView({
85-
label:trans("table.displayMode"),
86-
radioButton:true,
76+
{children.text.propertyView({
77+
label:trans("table.columnValue"),
78+
tooltip:ColumnValueTooltip,
79+
})}
80+
{children.prefixIcon.propertyView({
81+
label:trans("button.prefixIcon"),
82+
})}
83+
{children.suffixIcon.propertyView({
84+
label:trans("button.suffixIcon"),
8785
})}
88-
{(children.displayMode.getView()==="text"||children.displayMode.getView()==="textAndIcon")&&
89-
children.text.propertyView({
90-
label:trans("table.columnValue"),
91-
tooltip:ColumnValueTooltip,
92-
})
93-
}
94-
{(children.displayMode.getView()==="icon"||children.displayMode.getView()==="textAndIcon")&&
95-
children.icon.propertyView({
96-
label:trans("table.icon"),
97-
})
98-
}
9986
{children.buttonType.propertyView({
10087
label:trans("table.type"),
10188
radioButton:true,

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,9 +2066,6 @@ export const en = {
20662066
"primaryButton":"Primary",
20672067
"defaultButton":"Default",
20682068
"type":"Type",
2069-
"displayMode":"Display Mode",
2070-
"textAndIcon":"Text and Icon",
2071-
"icon":"Icon",
20722069
"tableSize":"Table Size",
20732070
"hideHeader":"Hide Table Header",
20742071
"hideToolbar":"Hide Table Toolbar (Footer)",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp