Skip to content

Commit 4f06801

Browse files
author
FalkWolsky
committed
Adding Disabled and Event hander to view for Switch in Table Column
1 parent eef987e commit 4f06801

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { styleControl } from "comps/controls/styleControl";
1212
import { RefControl } from "comps/controls/refControl";
1313
import { booleanExposingStateControl } from "comps/controls/codeStateControl";
1414
import { changeEvent, eventHandlerControl } from "comps/controls/eventHandlerControl";
15+
import { disabledPropertyView } from "comps/utils/propertyUtils";
1516

1617
interface SwitchWrapperProps {
1718
disabled: boolean;
@@ -50,15 +51,6 @@ const getStyle = (style: SwitchStyleType) => {
5051
const SwitchWrapper = styled.div<{ disabled: boolean }>`
5152
display: flex;
5253
align-items: center;
53-
// Can respond to drag & select events when disabled
54-
${(props) =>
55-
props.disabled &&
56-
`
57-
cursor: not-allowed;
58-
>button:disabled {
59-
pointer-events: none;
60-
}
61-
`};
6254
`;
6355

6456
const Wrapper = styled.div`
@@ -72,7 +64,6 @@ const childrenMap = {
7264
onEvent: eventHandlerControl(EventOptions),
7365
disabled: BoolCodeControl,
7466
style: styleControl(InputFieldStyle),
75-
labelStyle: styleControl(LabelStyle.filter((style) => ['accent', 'validate'].includes(style.name) === false)),
7667
viewRef: RefControl<HTMLElement>,
7768
};
7869

@@ -87,7 +78,7 @@ export const SwitchComp = (function () {
8778
return (
8879
<Switch
8980
checked={value}
90-
disabled={props.disabled || true}
81+
disabled={props.disabled}
9182
ref={props.viewRef}
9283
onChange={(checked) => {
9384
props.value.onChange(checked);
@@ -129,6 +120,8 @@ export const SwitchComp = (function () {
129120
label: trans("table.columnValue"),
130121
tooltip: ColumnValueTooltip,
131122
})}
123+
{children.onEvent.propertyView()}
124+
{disabledPropertyView(children)}
132125

133126
</>
134127
);

0 commit comments

Comments
 (0)