Funnel.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import React from 'react'
  2. import { Row, Col, Checkbox, InputNumber, Select } from 'antd'
  3. import { onSectionChange } from './util'
  4. import { ISpecConfig } from '../types'
  5. import { chartSortModeOptions, chartAlignmentModeOptions } from '../../constants'
  6. import styles from '../../../Workbench.less'
  7. interface ISpecSectionFunnelProps {
  8. spec: ISpecConfig
  9. title: string
  10. onChange: (value: string | number, propPath: string | string[]) => void
  11. }
  12. function SpecSectionFunnel (props: ISpecSectionFunnelProps) {
  13. const { spec, title, onChange } = props
  14. const { sortMode, gapNumber, alignmentMode } = spec
  15. return (
  16. <div className={styles.paneBlock}>
  17. <h4>{title}</h4>
  18. <div className={styles.blockBody}>
  19. <Row gutter={8} type="flex" align="middle" className={styles.blockRow}>
  20. <Col span={4}>排序</Col>
  21. <Col span={8}>
  22. <Select
  23. placeholder="排序"
  24. className={styles.blockElm}
  25. value={sortMode}
  26. onChange={onSectionChange(onChange, 'sortMode')}
  27. >
  28. {chartSortModeOptions}
  29. </Select>
  30. </Col>
  31. <Col span={4}>间距</Col>
  32. <Col span={8}>
  33. <InputNumber
  34. placeholder="间距"
  35. className={styles.blockElm}
  36. value={gapNumber}
  37. min={0}
  38. onChange={onSectionChange(onChange, 'gapNumber')}
  39. />
  40. </Col>
  41. </Row>
  42. <Row gutter={8} type="flex" align="middle" className={styles.blockRow}>
  43. <Col span={4}>对齐</Col>
  44. <Col span={8}>
  45. <Select
  46. placeholder="对齐"
  47. className={styles.blockElm}
  48. value={alignmentMode}
  49. onChange={onSectionChange(onChange, 'alignmentMode')}
  50. >
  51. {chartAlignmentModeOptions}
  52. </Select>
  53. </Col>
  54. </Row>
  55. </div>
  56. </div>
  57. )
  58. }
  59. export default SpecSectionFunnel