Skip to content

Commit 4a2f13b

Browse files
committed
revert link column type
1 parent 3deda9b commit 4a2f13b

File tree

1 file changed

+19
-34
lines changed
  • client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps

1 file changed

+19
-34
lines changed

client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnLinkComp.tsx

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ import { disabledPropertyView } from "comps/utils/propertyUtils";
1111
import styled, { css } from "styled-components";
1212
import { styleControl } from "comps/controls/styleControl";
1313
import { TableColumnLinkStyle } from "comps/controls/styleControlConstants";
14-
import { clickEvent, eventHandlerControl } from "comps/controls/eventHandlerControl";
1514

1615
export const ColumnValueTooltip = trans("table.columnValueTooltip");
1716

18-
const LinkEventOptions = [clickEvent] as const;
19-
2017
const childrenMap = {
2118
text: StringControl,
2219
onClick: ActionSelectorControlInContext,
23-
onEvent: eventHandlerControl(LinkEventOptions),
2420
disabled: BoolCodeControl,
2521
style: styleControl(TableColumnLinkStyle),
2622
};
@@ -37,16 +33,13 @@ const StyledLink = styled.a<{ $disabled: boolean }>`
3733
${(props) => props.$disabled && disableCss};
3834
`;
3935

40-
// Updated link component to handle both legacy and new event handlers
41-
export const ColumnLink = React.memo(({ disabled, label, onClick, onEvent }: { disabled: boolean; label: string; onClick?: () => void; onEvent?: (eventName: string) => void }) => {
36+
// Memoized link component
37+
export const ColumnLink = React.memo(({ disabled, label, onClick }: { disabled: boolean; label: string; onClick?: () => void }) => {
4238
const handleClick = useCallback(() => {
43-
if (!disabled) {
44-
// Trigger legacy onClick action for backward compatibility
45-
onClick?.();
46-
// Trigger new event handlers
47-
onEvent?.("click");
39+
if (!disabled && onClick) {
40+
onClick();
4841
}
49-
}, [disabled, onClick, onEvent]);
42+
}, [disabled, onClick]);
5043

5144
return (
5245
<StyledLink
@@ -113,7 +106,7 @@ export const LinkComp = (function () {
113106
childrenMap,
114107
(props, dispatch) => {
115108
const value = props.changeValue ?? getBaseValue(props, dispatch);
116-
return <ColumnLink disabled={props.disabled} label={value} onClick={props.onClick} onEvent={props.onEvent} />;
109+
return <ColumnLink disabled={props.disabled} label={value} onClick={props.onClick} />;
117110
},
118111
(nodeValue) => nodeValue.text.value,
119112
getBaseValue
@@ -125,27 +118,19 @@ export const LinkComp = (function () {
125118
onChangeEnd={props.onChangeEnd}
126119
/>
127120
))
128-
.setPropertyViewFn((children) => {
129-
// Check if there's a legacy action configured
130-
const hasLegacyAction = children.onClick.getView() &&
131-
typeof children.onClick.getView() === 'function' &&
132-
children.onClick.displayName() !== trans("eventHandler.incomplete");
133-
134-
return (
135-
<>
136-
{children.text.propertyView({
137-
label: trans("table.columnValue"),
138-
tooltip: ColumnValueTooltip,
139-
})}
140-
{disabledPropertyView(children)}
141-
{children.onEvent.propertyView()}
142-
{hasLegacyAction && children.onClick.propertyView({
143-
label: trans("table.action"),
144-
placement: "table",
145-
})}
146-
</>
147-
);
148-
})
121+
.setPropertyViewFn((children) => (
122+
<>
123+
{children.text.propertyView({
124+
label: trans("table.columnValue"),
125+
tooltip: ColumnValueTooltip,
126+
})}
127+
{disabledPropertyView(children)}
128+
{children.onClick.propertyView({
129+
label: trans("table.action"),
130+
placement: "table",
131+
})}
132+
</>
133+
))
149134
.setStylePropertyViewFn((children) => (
150135
<>
151136
{children.style.getPropertyView()}

0 commit comments

Comments
 (0)