GroupNameControl.tsx 647 B

1234567891011121314151617181920212223242526272829
  1. import { ArrayItems } from '@formily/antd';
  2. import { Select } from 'antd';
  3. interface Props {
  4. name?: string;
  5. value: string;
  6. onChange: () => void;
  7. }
  8. const GroupNameControl = (props: Props) => {
  9. const index = ArrayItems.useIndex!();
  10. return (
  11. <>
  12. {index === 0 ? (
  13. <div style={{ fontWeight: 600 }}>{props?.name || '第一组'}</div>
  14. ) : (
  15. <Select
  16. onChange={props.onChange}
  17. value={props.value}
  18. options={[
  19. { label: '并且', value: 'and' },
  20. { label: '或者', value: 'or' },
  21. ]}
  22. />
  23. )}
  24. </>
  25. );
  26. };
  27. export default GroupNameControl;