color.ts 947 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import uniqueId from '@form-create/utils/lib/unique'
  2. import { localeProps, makeRequiredRule } from '../../utils/formCreateIndex'
  3. const label = '颜色选择器'
  4. const name = 'colorPicker'
  5. export default {
  6. icon: 'icon-color',
  7. label,
  8. name,
  9. rule({ t }) {
  10. return {
  11. type: name,
  12. field: uniqueId(),
  13. title: t('components.colorPicker.name'),
  14. info: '',
  15. $required: false,
  16. props: {}
  17. }
  18. },
  19. props(_, { t }) {
  20. return localeProps(t, name + '.props', [
  21. makeRequiredRule(),
  22. {
  23. type: 'switch',
  24. field: 'disabled',
  25. title: '是否禁用'
  26. },
  27. {
  28. type: 'switch',
  29. field: 'showAlpha',
  30. title: '是否支持透明度选择'
  31. },
  32. {
  33. type: 'select',
  34. field: 'colorFormat',
  35. title: '颜色的格式',
  36. options: [
  37. { label: 'hsl', value: 'hsl' },
  38. { label: 'hsv', value: 'hsv' },
  39. {
  40. label: 'hex',
  41. value: 'hex'
  42. },
  43. { label: 'rgb', value: 'rgb' }
  44. ]
  45. }
  46. ])
  47. }
  48. }