textarea.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import uniqueId from '@form-create/utils/lib/unique';
  2. import {localeProps} from '../../utils';
  3. const label = '多行输入框';
  4. const name = 'textarea';
  5. export default {
  6. menu: 'main',
  7. icon: 'icon-textarea',
  8. label,
  9. name,
  10. input: true,
  11. event: ['blur', 'focus', 'change', 'input'],
  12. validate: ['string'],
  13. rule({t}) {
  14. return {
  15. type: 'input',
  16. field: uniqueId(),
  17. title: t('com.textarea.name'),
  18. info: '',
  19. $required: false,
  20. props: {
  21. type: 'textarea'
  22. }
  23. };
  24. },
  25. props(_, {t}) {
  26. return localeProps(t, name + '.props', [
  27. {
  28. type: 'switch',
  29. field: 'disabled'
  30. },
  31. {
  32. type: 'switch',
  33. field: 'readonly'
  34. },
  35. {
  36. type: 'inputNumber',
  37. field: 'maxlength',
  38. props: {min: 0}
  39. },
  40. {
  41. type: 'switch',
  42. field: 'showWordLimit'
  43. },
  44. {
  45. type: 'input',
  46. field: 'placeholder'
  47. },
  48. {
  49. type: 'inputNumber',
  50. field: 'rows',
  51. props: {
  52. min: 0
  53. }
  54. },
  55. {
  56. type: 'switch',
  57. field: 'autosize'
  58. },
  59. ]);
  60. }
  61. };