col.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {localeProps} from '../../utils';
  2. const name = 'col';
  3. const devices = {
  4. xs: '<768px',
  5. sm: '≥768px',
  6. md: '≥992px',
  7. lg: '≥1200px',
  8. xl: '≥1920px',
  9. };
  10. export default {
  11. name,
  12. label: '格子',
  13. drag: true,
  14. dragBtn: false,
  15. inside: true,
  16. mask: false,
  17. rule() {
  18. return {
  19. type: name,
  20. props: {span: 12},
  21. children: []
  22. };
  23. },
  24. props(_, {t}) {
  25. return localeProps(t, name + '.props', [
  26. {type: 'slider', field: 'span', value: 12, props: {min: 0, max: 24}},
  27. {type: 'slider', field: 'offset', props: {min: 0, max: 24}},
  28. {type: 'slider', field: 'push', props: {min: 0, max: 24}},
  29. {type: 'slider', field: 'pull', props: {min: 0, max: 24}},
  30. {
  31. type: 'ConfigItem',
  32. props: {
  33. label: t('props.reactive')
  34. },
  35. children: [
  36. {
  37. type: 'elTabs',
  38. style: {
  39. width: '100%'
  40. },
  41. slot: 'append',
  42. children: Object.keys(devices).map(k => {
  43. return {
  44. type: 'elTabPane',
  45. props: {
  46. label: devices[k]
  47. },
  48. style: 'padding:0 10px;',
  49. children: [
  50. {
  51. type: 'slider',
  52. field: k + '>span',
  53. title: t('com.col.props.span'),
  54. value: 12,
  55. props: {min: 0, max: 24},
  56. },
  57. {
  58. type: 'slider',
  59. field: k + '>offset',
  60. title: t('com.col.props.offset'),
  61. props: {min: 0, max: 24},
  62. },
  63. {
  64. type: 'slider',
  65. field: k + '>push',
  66. title: t('com.col.props.push'),
  67. props: {min: 0, max: 24},
  68. },
  69. {
  70. type: 'slider',
  71. field: k + '>pull',
  72. title: t('com.col.props.pull'),
  73. props: {min: 0, max: 24},
  74. }
  75. ]
  76. };
  77. })
  78. }
  79. ]
  80. },
  81. ]);
  82. }
  83. };