constants.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React from 'react'
  2. import { Select } from 'antd'
  3. const { Option } = Select
  4. import ColorPicker from 'components/ColorPicker'
  5. import { IFontSetting } from './types'
  6. import {
  7. PIVOT_CHART_FONT_FAMILIES,
  8. PIVOT_CHART_FONT_SIZES,
  9. PIVOT_CHART_FONT_WEIGHTS,
  10. PIVOT_CHART_FONT_STYLE,
  11. PIVOT_DEFAULT_FONT_COLOR,
  12. DEFAULT_FONT_FAMILY,
  13. DEFAULT_FONT_STYLE,
  14. DEFAULT_FONT_SIZE,
  15. DEFAULT_FONT_WEIGHT
  16. } from 'app/globalConstants'
  17. const weight = (
  18. <Select dropdownMatchSelectWidth={false}>
  19. {PIVOT_CHART_FONT_WEIGHTS.map((w) => (
  20. <Option value={w} key={w}>
  21. {w}
  22. </Option>
  23. ))}
  24. </Select>
  25. )
  26. const style = (
  27. <Select dropdownMatchSelectWidth={false}>
  28. {PIVOT_CHART_FONT_STYLE.map((s) => (
  29. <Option value={s.value} key={s.value}>
  30. {s.name}
  31. </Option>
  32. ))}
  33. </Select>
  34. )
  35. const family = (
  36. <Select dropdownMatchSelectWidth={false}>
  37. {PIVOT_CHART_FONT_FAMILIES.map((f) => (
  38. <Option value={f.value} key={f.value}>
  39. {f.name}
  40. </Option>
  41. ))}
  42. </Select>
  43. )
  44. const size = (
  45. <Select dropdownMatchSelectWidth={false}>
  46. {PIVOT_CHART_FONT_SIZES.map((s) => (
  47. <Option value={s.toString()} key={`${s}`}>
  48. {s}
  49. </Option>
  50. ))}
  51. </Select>
  52. )
  53. const color = (
  54. <ColorPicker />
  55. )
  56. export const fontSelect = {
  57. weight,
  58. style,
  59. family,
  60. size,
  61. color
  62. }
  63. export const EmptyFontSetting: IFontSetting = {
  64. fontFamily: PIVOT_CHART_FONT_FAMILIES[0].value,
  65. fontStyle: DEFAULT_FONT_STYLE,
  66. fontSize: DEFAULT_FONT_SIZE,
  67. fontWeight: DEFAULT_FONT_WEIGHT,
  68. fontColor: PIVOT_DEFAULT_FONT_COLOR
  69. }