state.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. const instalcePublic = {
  2. name: {
  3. type: String,
  4. },
  5. disabled: {
  6. type: [Boolean],
  7. },
  8. modelValue: {
  9. required: false,
  10. default: '',
  11. },
  12. placeholder: {
  13. require: false,
  14. default: '请输入',
  15. },
  16. }
  17. export const colorPropsDesc = {
  18. ...instalcePublic,
  19. width: {
  20. type: String,
  21. default: '100px',
  22. },
  23. height: {
  24. type: String,
  25. default: '34px',
  26. },
  27. }
  28. export const filePropsDesc = {
  29. ...instalcePublic,
  30. placeholder: {
  31. require: false,
  32. default: '请选择',
  33. },
  34. othPlaceholder: {
  35. require: false,
  36. default: '',
  37. },
  38. accept: {
  39. type: String,
  40. },
  41. scale: {
  42. type: String,
  43. },
  44. multiple: {
  45. type: Boolean,
  46. },
  47. preview: {
  48. type: Boolean,
  49. },
  50. maxSize: {
  51. type: Number,
  52. },
  53. maxLen: {
  54. type: Number,
  55. },
  56. }
  57. export const switchPropsDesc = {
  58. ...instalcePublic,
  59. width: {
  60. type: [Number, String],
  61. },
  62. height: {
  63. type: [Number, String],
  64. },
  65. }
  66. export const checkboxPropsDesc = {
  67. ...switchPropsDesc,
  68. label: {
  69. type: String,
  70. required: false,
  71. },
  72. }
  73. export const radioPropsDesc = {
  74. ...checkboxPropsDesc,
  75. icon: {
  76. type: String,
  77. },
  78. tip: {
  79. type: String,
  80. },
  81. }
  82. export const textPropsDesc = {
  83. ...instalcePublic,
  84. maxlength: {
  85. type: [String, Number],
  86. },
  87. placeholder: {
  88. type: String,
  89. default: '请输入',
  90. },
  91. readonly: {
  92. type: Boolean,
  93. default: false,
  94. },
  95. other: {
  96. type: Object,
  97. default: () => ({}),
  98. },
  99. right: {
  100. type: Boolean,
  101. },
  102. }
  103. export const textEmitsDesc = ['update:modelValue', 'focus', 'blur', 'click', 'keydown']
  104. export const textareaPropsDesc = {
  105. ...textPropsDesc,
  106. rich: {
  107. type: Boolean,
  108. },
  109. }
  110. export const richtextPropsDesc = {
  111. ...textareaPropsDesc,
  112. onUpdatePos: Function,
  113. }
  114. export const selectPropsDesc = {
  115. ...textPropsDesc,
  116. stopEl: {
  117. type: String,
  118. require: false,
  119. },
  120. floatingClass: {
  121. type: String,
  122. require: false,
  123. },
  124. showOptions: {
  125. type: Boolean,
  126. require: false,
  127. },
  128. placeholder: { ...textPropsDesc.placeholder, default: '请选择' },
  129. unplaceholder: { ...textPropsDesc.placeholder, default: '暂无选项' },
  130. hideScroll: {
  131. type: Boolean,
  132. default: false,
  133. },
  134. options: {
  135. type: Array,
  136. default: () => [],
  137. },
  138. dire: {
  139. type: String,
  140. default: 'bottom',
  141. },
  142. }
  143. export const searchPropsDesc = {
  144. ...selectPropsDesc,
  145. unplaceholder: { ...textPropsDesc.placeholder, default: '无搜索结果' },
  146. }
  147. export const numberPropsDesc = {
  148. ...textPropsDesc,
  149. inInput: {
  150. type: Boolean,
  151. default: true,
  152. },
  153. ctrl: {
  154. type: Boolean,
  155. default: true,
  156. },
  157. step: {
  158. type: Number,
  159. require: true,
  160. default: 1,
  161. },
  162. min: {
  163. type: [Number, String],
  164. require: false,
  165. },
  166. max: {
  167. type: [Number, String],
  168. require: false,
  169. },
  170. limit: {
  171. type: Number,
  172. default: 0,
  173. },
  174. inch: {
  175. type: [Boolean, String],
  176. default: false,
  177. },
  178. rangeInput: {
  179. type: Boolean,
  180. default: true,
  181. },
  182. rangeTips: {
  183. type: Boolean,
  184. default: false,
  185. },
  186. }
  187. export const rangePropsDesc = {
  188. ...numberPropsDesc,
  189. min: { ...numberPropsDesc.min, require: true },
  190. min: { ...numberPropsDesc.min, require: true },
  191. }
  192. const summary = {
  193. ...checkboxPropsDesc,
  194. ...radioPropsDesc,
  195. ...selectPropsDesc,
  196. ...textPropsDesc,
  197. ...rangePropsDesc,
  198. ...numberPropsDesc,
  199. ...switchPropsDesc,
  200. ...textareaPropsDesc,
  201. ...filePropsDesc,
  202. ...searchPropsDesc,
  203. ...richtextPropsDesc,
  204. ...colorPropsDesc,
  205. }
  206. for (let key in summary) {
  207. summary[key] = {
  208. ...summary[key],
  209. default: undefined,
  210. }
  211. }
  212. export const inputEmitDesc = {
  213. text: textEmitsDesc,
  214. }
  215. export const inputPropsDesc = {
  216. ...summary,
  217. type: {
  218. type: String,
  219. required: true,
  220. default: 'text',
  221. },
  222. width: {
  223. type: [Number, String],
  224. },
  225. height: {
  226. type: [Number, String],
  227. },
  228. require: {
  229. type: Boolean,
  230. },
  231. error: {
  232. type: String,
  233. },
  234. disabled: {
  235. type: Boolean,
  236. },
  237. }