input-configure-options.js 4.2 KB

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