input-configure-options.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. export const configureOptionsFieldConfigMap = {
  2. key: {
  3. type: 'input',
  4. label: '字段标识',
  5. limit: 50
  6. },
  7. otherKey: {
  8. type: 'input',
  9. label: '其他字段标识',
  10. limit: 50
  11. },
  12. extraKey: {
  13. type: 'input',
  14. label: '额外字段标识',
  15. limit: 50
  16. },
  17. label: {
  18. type: 'input',
  19. label: '标题',
  20. limit: 20
  21. },
  22. labelPosition: {
  23. type: 'radio',
  24. label: '标签对齐方式',
  25. options: [
  26. { label: '左对齐', value: 'left' },
  27. { label: '右对齐', value: 'right' },
  28. { label: '顶部对齐', value: 'top' }
  29. ],
  30. isButton: true,
  31. defaultValue: 'right'
  32. },
  33. isMainField: {
  34. type: 'switch',
  35. label: '是否为主要字段',
  36. description: '该项设置用于表单作为一个组件被引入时列表的主要信息'
  37. },
  38. description: {
  39. type: 'textarea',
  40. label: '字段说明',
  41. limit: 200
  42. },
  43. hideLabel: {
  44. type: 'switch',
  45. label: '是否隐藏标题'
  46. },
  47. hideItem: {
  48. type: 'switch',
  49. label: '是否隐藏此项'
  50. },
  51. width: {
  52. type: 'input',
  53. label: '宽度',
  54. defaultValue: '100%',
  55. limit: 10
  56. },
  57. labelWidth: { // 配置由插槽实现
  58. type: 'number',
  59. label: '标签宽度',
  60. step: 10
  61. },
  62. placeholder: {
  63. type: 'input',
  64. label: '占位内容',
  65. limit: 200
  66. },
  67. defaultValue: {
  68. type: 'input',
  69. label: '默认值'
  70. },
  71. limit: {
  72. type: 'number',
  73. label: '长度限制'
  74. },
  75. required: {
  76. label: '校验',
  77. type: 'singleCheckbox',
  78. option: { value: true, label: '必填' }
  79. },
  80. requiredErrorMessage: {
  81. label: '',
  82. type: 'input',
  83. placeholder: '自定义错误提示',
  84. dependOn: ['required'],
  85. readable: false,
  86. changeConfig: (config, { required }) => {
  87. if (required) config.writable = true
  88. return config
  89. },
  90. limit: 20
  91. },
  92. validateValue: {},
  93. validateValueErrorMessage: {
  94. label: '',
  95. type: 'input',
  96. placeholder: '自定义错误提示',
  97. dependOn: ['validateValue'],
  98. readable: false,
  99. changeConfig: (config, { validateValue }) => {
  100. if (validateValue) config.writable = true
  101. return config
  102. },
  103. limit: 20
  104. },
  105. regexpValidate: {},
  106. regexpValidateErrorMessage: {
  107. label: '',
  108. type: 'input',
  109. placeholder: '自定义错误提示',
  110. dependOn: ['regexpValidate'],
  111. readable: false,
  112. changeConfig: (config, { regexpValidate }) => {
  113. if (regexpValidate) config.writable = true
  114. return config
  115. },
  116. limit: 20
  117. }
  118. }
  119. export const basicInputConfigureOptions = () => {
  120. return {
  121. key: {},
  122. label: {},
  123. // labelPosition: {}, //暂不开启组件自定义label对其方式
  124. description: {},
  125. hideLabel: {},
  126. hideItem: {},
  127. width: {},
  128. labelWidth: {}
  129. }
  130. }
  131. export const basicTwoInputConfigureOptions = () => {
  132. return {
  133. key: {},
  134. otherKey: {},
  135. label: {},
  136. description: {},
  137. isMainField: {},
  138. hideLabel: {},
  139. hideItem: {},
  140. width: {},
  141. labelWidth: {}
  142. }
  143. }
  144. // input文件夹内无configure.js的配置文件使用此默认options
  145. export const defaultConfigureOptions = () => ({
  146. ...basicInputConfigureOptions(),
  147. required: {},
  148. requiredErrorMessage: {},
  149. validateValue: {},
  150. validateValueErrorMessage: {},
  151. regexpValidate: {},
  152. regexpValidateErrorMessage: {}
  153. })