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

Commite361299

Browse files
committed
fix simple column type (btn)
1 parentdfe87b3 commite361299

File tree

1 file changed

+41
-40
lines changed

1 file changed

+41
-40
lines changed

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

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,21 @@ import { CSSProperties } from "react";
1414
import{RecordConstructorToComp}from"lowcoder-core";
1515
import{ToViewReturn}from"@lowcoder-ee/comps/generators/multi";
1616
import{clickEvent,eventHandlerControl}from"comps/controls/eventHandlerControl";
17+
import{migrateOldData}from"@lowcoder-ee/comps/generators/simpleGenerators";
1718

19+
exportconstfixOldActionData=(oldData:any)=>{
20+
if(!oldData)returnoldData;
21+
if(Boolean(oldData.onClick)){
22+
return{
23+
...oldData,
24+
onClick:[{
25+
name:"click",
26+
handler:oldData.onClick,
27+
}],
28+
};
29+
}
30+
returnoldData;
31+
}
1832
exportconstColumnValueTooltip=trans("table.columnValueTooltip");
1933

2034
exportconstButtonTypeOptions=[
@@ -37,8 +51,7 @@ const ButtonEventOptions = [clickEvent] as const;
3751
constchildrenMap={
3852
text:StringControl,
3953
buttonType:dropdownControl(ButtonTypeOptions,"primary"),
40-
onClick:ActionSelectorControlInContext,
41-
onEvent:eventHandlerControl(ButtonEventOptions),
54+
onClick:eventHandlerControl(ButtonEventOptions),
4255
loading:BoolCodeControl,
4356
disabled:BoolCodeControl,
4457
prefixIcon:IconControl,
@@ -53,11 +66,8 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
5366
consticonOnly=!hasText&&(hasPrefixIcon||hasSuffixIcon);
5467

5568
consthandleClick=useCallback((e:React.MouseEvent)=>{
56-
// Trigger legacy onClick action for backward compatibility
57-
props.onClick?.();
58-
// Trigger new event handlers
59-
props.onEvent?.("click");
60-
},[props.onClick,props.onEvent]);
69+
props.onClick?.("click");
70+
},[props.onClick]);
6171

6272
constbuttonStyle=useMemo(()=>({
6373
margin:0,
@@ -83,43 +93,34 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
8393
);
8494
});
8595

86-
exportconstButtonComp=(function(){
96+
constButtonCompTmp=(function(){
8797
returnnewColumnTypeCompBuilder(
8898
childrenMap,
8999
(props)=><ButtonStyledprops={props}/>,
90100
(nodeValue)=>nodeValue.text.value
91101
)
92-
.setPropertyViewFn((children)=>{
93-
// Check if there's a legacy action configured
94-
consthasLegacyAction=children.onClick.getView()&&
95-
typeofchildren.onClick.getView()==='function'&&
96-
children.onClick.displayName()!==trans("eventHandler.incomplete");
97-
98-
return(
99-
<>
100-
{children.text.propertyView({
101-
label:trans("table.columnValue"),
102-
tooltip:ColumnValueTooltip,
103-
})}
104-
{children.prefixIcon.propertyView({
105-
label:trans("button.prefixIcon"),
106-
})}
107-
{children.suffixIcon.propertyView({
108-
label:trans("button.suffixIcon"),
109-
})}
110-
{children.buttonType.propertyView({
111-
label:trans("table.type"),
112-
radioButton:true,
113-
})}
114-
{loadingPropertyView(children)}
115-
{disabledPropertyView(children)}
116-
{children.onEvent.propertyView()}
117-
{hasLegacyAction&&children.onClick.propertyView({
118-
label:trans("table.action"),
119-
placement:"table",
120-
})}
121-
</>
122-
);
123-
})
102+
.setPropertyViewFn((children)=>(
103+
<>
104+
{children.text.propertyView({
105+
label:trans("table.columnValue"),
106+
tooltip:ColumnValueTooltip,
107+
})}
108+
{children.prefixIcon.propertyView({
109+
label:trans("button.prefixIcon"),
110+
})}
111+
{children.suffixIcon.propertyView({
112+
label:trans("button.suffixIcon"),
113+
})}
114+
{children.buttonType.propertyView({
115+
label:trans("table.type"),
116+
radioButton:true,
117+
})}
118+
{loadingPropertyView(children)}
119+
{disabledPropertyView(children)}
120+
{children.onClick.propertyView()}
121+
</>
122+
))
124123
.build();
125124
})();
125+
126+
exportconstButtonComp=migrateOldData(ButtonCompTmp,fixOldActionData);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp