Map.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React from 'react'
  2. import { Row, Col, Checkbox, Select, InputNumber } from 'antd'
  3. import { onSectionChange } from './util'
  4. import { ISpecConfig } from '../types'
  5. import { chartLayerTypeOptions, chartSymbolTypeOptions } from '../../constants'
  6. import styles from '../../../Workbench.less'
  7. interface ISpecSectionMapProps {
  8. spec: ISpecConfig
  9. isLegendSection: boolean
  10. title: string
  11. onChange: (value: string | number, propPath: string | string[]) => void
  12. }
  13. function SpecSectionMap (props: ISpecSectionMapProps) {
  14. const { spec, isLegendSection, title, onChange } = props
  15. const { roam, layerType, linesSpeed, symbolType } = spec
  16. return (
  17. <div className={styles.paneBlock}>
  18. <h4>{title}</h4>
  19. <div className={styles.blockBody}>
  20. <Row gutter={8} type="flex" align="middle" className={styles.blockRow}>
  21. <Col span={10}>
  22. <Checkbox checked={roam} onChange={onSectionChange(onChange, 'roam')}>
  23. 移动&缩放
  24. </Checkbox>
  25. </Col>
  26. <Col span={4}>类型</Col>
  27. <Col span={10}>
  28. <Select
  29. placeholder="类型"
  30. className={styles.blockElm}
  31. value={layerType}
  32. onChange={onSectionChange(onChange, 'layerType')}
  33. >
  34. {chartLayerTypeOptions}
  35. </Select>
  36. </Col>
  37. </Row>
  38. {isLegendSection ? (
  39. <Row
  40. gutter={8}
  41. type="flex"
  42. align="middle"
  43. className={styles.blockRow}
  44. >
  45. <Col span={4}>速度</Col>
  46. <Col span={6}>
  47. <InputNumber
  48. placeholder="速度"
  49. className={styles.blockElm}
  50. value={linesSpeed}
  51. min={0}
  52. onChange={onSectionChange(onChange, 'linesSpeed')}
  53. />
  54. </Col>
  55. <Col span={4}>标记</Col>
  56. <Col span={10}>
  57. <Select
  58. placeholder="标记"
  59. className={styles.blockElm}
  60. value={symbolType}
  61. onChange={onSectionChange(onChange, 'symbolType')}
  62. >
  63. {chartSymbolTypeOptions}
  64. </Select>
  65. </Col>
  66. </Row>
  67. ) : null}
  68. </div>
  69. </div>
  70. )
  71. }
  72. export default SpecSectionMap