Content-Length: 530041 | pFad | http://github.com/lowcoder-org/lowcoder/commit/0d1e53e9b4b154ecf86f9457774530a74421ba1f

0E revert table column's event handlers · lowcoder-org/lowcoder@0d1e53e · GitHub
Skip to content

Commit 0d1e53e

Browse files
revert table column's event handlers
1 parent 804449f commit 0d1e53e

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const LinkEventOptions = [clickEvent] as const;
1919

2020
const childrenMap = {
2121
text: StringControl,
22+
onClick: ActionSelectorControlInContext,
2223
onEvent: eventHandlerControl(LinkEventOptions),
2324
disabled: BoolCodeControl,
2425
style: styleControl(TableColumnLinkStyle),
@@ -37,12 +38,12 @@ const StyledLink = styled.a<{ $disabled: boolean }>`
3738
`;
3839

3940
// Memoized link component
40-
export const ColumnLink = React.memo(({ disabled, label, onEvent }: { disabled: boolean; label: string; onEvent?: (eventName: string) => void }) => {
41+
export const ColumnLink = React.memo(({ disabled, label, onClick, onEvent }: { disabled: boolean; label: string; onClick?: () => void; onEvent?: (eventName: string) => void }) => {
4142
const handleClick = useCallback(() => {
42-
if (!disabled && onEvent) {
43-
onEvent("click");
44-
}
45-
}, [disabled, onEvent]);
43+
if (disabled) return;
44+
onClick?.();
45+
// onEvent?.("click");
46+
}, [disabled, onClick, onEvent]);
4647

4748
return (
4849
<StyledLink
@@ -109,7 +110,7 @@ export const LinkComp = (function () {
109110
childrenMap,
110111
(props, dispatch) => {
111112
const value = props.changeValue ?? getBaseValue(props, dispatch);
112-
return <ColumnLink disabled={props.disabled} label={value} onEvent={props.onEvent} />;
113+
return <ColumnLink disabled={props.disabled} label={value} onClick={props.onClick} />;
113114
},
114115
(nodeValue) => nodeValue.text.value,
115116
getBaseValue
@@ -128,7 +129,11 @@ export const LinkComp = (function () {
128129
tooltip: ColumnValueTooltip,
129130
})}
130131
{disabledPropertyView(children)}
131-
{children.onEvent.propertyView()}
132+
{/* {children.onEvent.propertyView()} */}
133+
{children.onClick.propertyView({
134+
label: trans("table.action"),
135+
placement: "table",
136+
})}
132137
</>
133138
))
134139
.setStylePropertyViewFn((children) => (

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const OptionItem = new MultiCompBuilder(
6363
})}
6464
{hiddenPropertyView(children)}
6565
{disabledPropertyView(children)}
66-
{children.onEvent.propertyView()}
66+
{/* {children.onEvent.propertyView()} */}
6767
</>
6868
);
6969
})
@@ -76,9 +76,9 @@ const MenuItem = React.memo(({ option, index, onMainEvent }: { option: any; inde
7676
if (option.onClick) {
7777
option.onClick();
7878
}
79-
if (option.onEvent) {
80-
option.onEvent("click");
81-
}
79+
// if (option.onEvent) {
80+
// option.onEvent("click");
81+
// }
8282
// Trigger the main component's event handler
8383
if (onMainEvent) {
8484
onMainEvent("click");

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const childrenMap = {
3838
text: StringControl,
3939
buttonType: dropdownControl(ButtonTypeOptions, "primary"),
4040
onEvent: eventHandlerControl(ButtonEventOptions),
41+
onClick: ActionSelectorControlInContext,
4142
loading: BoolCodeControl,
4243
disabled: BoolCodeControl,
4344
prefixIcon: IconControl,
@@ -52,8 +53,9 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
5253
const iconOnly = !hasText && (hasPrefixIcon || hasSuffixIcon);
5354

5455
const handleClick = useCallback((e: React.MouseEvent) => {
55-
props.onEvent("click");
56-
}, [props.onEvent]);
56+
props.onClick?.();
57+
// props.onEvent?.("click");
58+
}, [props.onClick, props.onEvent]);
5759

5860
const buttonStyle = useMemo(() => ({
5961
margin: 0,
@@ -103,7 +105,11 @@ export const ButtonComp = (function () {
103105
})}
104106
{loadingPropertyView(children)}
105107
{disabledPropertyView(children)}
106-
{children.onEvent.propertyView()}
108+
{/* {children.onEvent.propertyView()} */}
109+
{children.onClick.propertyView({
110+
label: trans("table.action"),
111+
placement: "table",
112+
})}
107113
</>
108114
))
109115
.build();

client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
ConstructorToView,
1818
deferAction,
1919
fromRecord,
20+
isDynamicSegment,
2021
multiChangeAction,
2122
withFunction,
2223
wrapChildAction,
@@ -194,7 +195,6 @@ const ColumnPropertyView = React.memo(({
194195
summaryRowIndex: number;
195196
}) => {
196197
const selectedColumn = comp.children.render.getSelectedComp();
197-
198198
const columnType = useMemo(() =>
199199
selectedColumn.getComp().children.compType.getView(),
200200
[selectedColumn]
@@ -205,7 +205,7 @@ const ColumnPropertyView = React.memo(({
205205
if (column.comp?.hasOwnProperty('src')) {
206206
return (column.comp as any).src;
207207
} else if (column.comp?.hasOwnProperty('text')) {
208-
return (column.comp as any).text;
208+
return isDynamicSegment((column.comp as any).text) ? '{{currentCell}}' : (column.comp as any).text;
209209
}
210210
return '{{currentCell}}';
211211
}, [selectedColumn]);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/lowcoder-org/lowcoder/commit/0d1e53e9b4b154ecf86f9457774530a74421ba1f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy