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

Commit6eb8842

Browse files
added migration to handle old action handlers in table's button column type
1 parentfafab63 commit6eb8842

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

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

Lines changed: 20 additions & 9 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=[
@@ -38,7 +52,7 @@ const childrenMap = {
3852
text:StringControl,
3953
buttonType:dropdownControl(ButtonTypeOptions,"primary"),
4054
onEvent:eventHandlerControl(ButtonEventOptions),
41-
onClick:ActionSelectorControlInContext,
55+
onClick:eventHandlerControl(ButtonEventOptions),//ActionSelectorControlInContext,
4256
loading:BoolCodeControl,
4357
disabled:BoolCodeControl,
4458
prefixIcon:IconControl,
@@ -53,8 +67,7 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
5367
consticonOnly=!hasText&&(hasPrefixIcon||hasSuffixIcon);
5468

5569
consthandleClick=useCallback((e:React.MouseEvent)=>{
56-
props.onClick?.();
57-
// props.onEvent?.("click");
70+
props.onClick?.("click");
5871
},[props.onClick,props.onEvent]);
5972

6073
constbuttonStyle=useMemo(()=>({
@@ -81,7 +94,7 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
8194
);
8295
});
8396

84-
exportconstButtonComp=(function(){
97+
constButtonCompTmp=(function(){
8598
returnnewColumnTypeCompBuilder(
8699
childrenMap,
87100
(props)=><ButtonStyledprops={props}/>,
@@ -105,12 +118,10 @@ export const ButtonComp = (function () {
105118
})}
106119
{loadingPropertyView(children)}
107120
{disabledPropertyView(children)}
108-
{/* {children.onEvent.propertyView()} */}
109-
{children.onClick.propertyView({
110-
label:trans("table.action"),
111-
placement:"table",
112-
})}
121+
{children.onClick.propertyView()}
113122
</>
114123
))
115124
.build();
116125
})();
126+
127+
exportconstButtonComp=migrateOldData(ButtonCompTmp,fixOldActionData);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp