({mode, disabled})
| 18 | * @constructor |
| 19 | */ |
| 20 | export const SelectMode = ({mode, disabled}) => { |
| 21 | const dispatch = useDispatch(); |
| 22 | const {t} = useTranslation(); |
| 23 | |
| 24 | /** |
| 25 | * 模式切换后的回调 |
| 26 | * |
| 27 | * @param value 模式的值 |
| 28 | */ |
| 29 | const onChange = (value) => { |
| 30 | if (value === mode) { |
| 31 | return; |
| 32 | } |
| 33 | dispatch({type: 'changeMode', value}); |
| 34 | }; |
| 35 | |
| 36 | return (<> |
| 37 | <div style={{display: 'flex', alignItems: 'center'}}> |
| 38 | <div className='mode-select-title jade-panel-header-font'>{t('modeSelect')}</div> |
| 39 | <JadeStopPropagationSelect |
| 40 | disabled={disabled} |
| 41 | className={'jade-select'} |
| 42 | showSearch |
| 43 | optionFilterProp='children' |
| 44 | onChange={onChange} |
| 45 | defaultValue='mode-variables' |
| 46 | value={mode} |
| 47 | options={[ |
| 48 | {value: 'variables', label: t('directlyOutputTheResult')}, |
| 49 | {value: 'manualCheck', label: t('intelligentFormShowResult')}, |
| 50 | ]} |
| 51 | style={{width: '70%', marginLeft: 'auto'}} |
| 52 | > |
| 53 | </JadeStopPropagationSelect> |
| 54 | </div> |
| 55 | </>); |
| 56 | }; |
| 57 | |
| 58 | SelectMode.propTypes = { |
| 59 | mode: PropTypes.string, |
nothing calls this directly
no test coverage detected