forked from alibaba/lowcode-engine-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
30 lines (27 loc) · 707 Bytes
/
index.tsx
File metadata and controls
30 lines (27 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import * as React from 'react';
import { Switch } from '@alifd/next';
import './index.less';
interface BoolSetterProps {
value: boolean;
disabled: boolean;
defaultValue: any;
onChange: (val: number) => void;
}
interface BoolSetterState {
setterValue: boolean;
}
export default class BoolSetter extends React.PureComponent<BoolSetterProps, BoolSetterState> {
static displayName = 'BoolSetter';
render() {
const { onChange, value, defaultValue, disabled } = this.props;
return (
<Switch
className="switch-style"
checked={value ?? defaultValue}
disabled={disabled}
size="small"
onChange={(val: any) => onChange(val)}
/>
);
}
}