| | |
| | | import { Select } from 'antd' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | class MKSelect extends Component { |
| | | constructor(props) { |
| | |
| | | const { config } = this.state |
| | | |
| | | let options = config.oriOptions.filter(option => option.ParentID === parentId || option.value === '') |
| | | let _option = options[0] || null |
| | | let _option = options[0] && !options[0].$disabled ? options[0] : null |
| | | let val = _option ? _option.value : '' |
| | | |
| | | this.setState({ |
| | |
| | | allowClear |
| | | id={config.uuid} |
| | | value={value} |
| | | dropdownMatchSelectWidth={config.dropdown !== 'false'} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onSelect={this.selectChange} |
| | | onChange={(val) => val === undefined && this.selectChange('')} |
| | | disabled={config.readonly} |
| | | > |
| | | {options.map(option => |
| | | <Select.Option id={option.key} title={option.label} key={option.key} value={option.value}>{option.label}</Select.Option> |
| | | <Select.Option id={option.key} title={option.label} disabled={option.$disabled} key={option.key} value={option.value}>{option.label}</Select.Option> |
| | | )} |
| | | </Select> |
| | | ) |
| | |
| | | disabled={config.readonly} |
| | | > |
| | | {options.map(option => |
| | | <Select.Option id={option.key} title={option.label} key={option.key} value={option.value}>{option.label}</Select.Option> |
| | | <Select.Option id={option.key} title={option.label} disabled={option.$disabled} key={option.key} value={option.value}>{option.label}</Select.Option> |
| | | )} |
| | | </Select>) |
| | | } |