skhj-variant 2.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/package.iml +12 -0
  4. package/README.md +180 -0
  5. package/babel.config.js +5 -0
  6. package/dist/build/css/app.9b74af27.css +1 -0
  7. package/dist/build/css/chunk-vendors.a16c4353.css +1 -0
  8. package/dist/build/favicon.ico +0 -0
  9. package/dist/build/fonts/element-icons.535877f5.woff +0 -0
  10. package/dist/build/fonts/element-icons.732389de.ttf +0 -0
  11. package/dist/build/img/t1.21b2c158.png +0 -0
  12. package/dist/build/img/t2.6991670f.png +0 -0
  13. package/dist/build/img/t3.49724600.png +0 -0
  14. package/dist/build/img/t4.4acb1808.png +0 -0
  15. package/dist/build/img/t5.e5e1948c.png +0 -0
  16. package/dist/build/img/t6.40836551.png +0 -0
  17. package/dist/build/img/t7.94cf1cc9.png +0 -0
  18. package/dist/build/img/t8.9291e9c1.png +0 -0
  19. package/dist/build/index.html +1 -0
  20. package/dist/build/js/app.dbcf7751.js +1 -0
  21. package/dist/build/js/chunk-1d66e3dd.7d669272.js +23 -0
  22. package/dist/build/js/chunk-vendors.be32fc27.js +24 -0
  23. package/dist/build/report.html +53 -0
  24. package/dist/lib/VFormDesigner.common-report.html +53 -0
  25. package/dist/lib/VFormDesigner.common.1.js +14583 -0
  26. package/dist/lib/VFormDesigner.common.1.js.map +1 -0
  27. package/dist/lib/VFormDesigner.common.js +71232 -0
  28. package/dist/lib/VFormDesigner.common.js.map +1 -0
  29. package/dist/lib/VFormDesigner.css +1 -0
  30. package/dist/lib/VFormDesigner.umd-report.html +53 -0
  31. package/dist/lib/VFormDesigner.umd.1.js +14583 -0
  32. package/dist/lib/VFormDesigner.umd.1.js.map +1 -0
  33. package/dist/lib/VFormDesigner.umd.js +71242 -0
  34. package/dist/lib/VFormDesigner.umd.js.map +1 -0
  35. package/dist/lib/VFormDesigner.umd.min-report.html +53 -0
  36. package/dist/lib/VFormDesigner.umd.min.1.js +23 -0
  37. package/dist/lib/VFormDesigner.umd.min.js +19 -0
  38. package/dist/lib/demo.html +10 -0
  39. package/dist/lib/img/t1.21b2c158.png +0 -0
  40. package/dist/lib/img/t2.6991670f.png +0 -0
  41. package/dist/lib/img/t3.49724600.png +0 -0
  42. package/dist/lib/img/t4.4acb1808.png +0 -0
  43. package/dist/lib/img/t5.e5e1948c.png +0 -0
  44. package/dist/lib/img/t6.40836551.png +0 -0
  45. package/dist/lib/img/t7.94cf1cc9.png +0 -0
  46. package/dist/lib/img/t8.9291e9c1.png +0 -0
  47. package/dist/lib-render/VFormRender.common-report.html +53 -0
  48. package/dist/lib-render/VFormRender.common.1.js +14583 -0
  49. package/dist/lib-render/VFormRender.common.1.js.map +1 -0
  50. package/dist/lib-render/VFormRender.common.js +32421 -0
  51. package/dist/lib-render/VFormRender.common.js.map +1 -0
  52. package/dist/lib-render/VFormRender.css +1 -0
  53. package/dist/lib-render/VFormRender.umd-report.html +53 -0
  54. package/dist/lib-render/VFormRender.umd.1.js +14583 -0
  55. package/dist/lib-render/VFormRender.umd.1.js.map +1 -0
  56. package/dist/lib-render/VFormRender.umd.js +32431 -0
  57. package/dist/lib-render/VFormRender.umd.js.map +1 -0
  58. package/dist/lib-render/VFormRender.umd.min-report.html +53 -0
  59. package/dist/lib-render/VFormRender.umd.min.1.js +23 -0
  60. package/dist/lib-render/VFormRender.umd.min.js +15 -0
  61. package/dist/lib-render/demo.html +10 -0
  62. package/index_template/index_dev.html +19 -0
  63. package/index_template/index_prod.html +28 -0
  64. package/index_template/vform_demo.gif +0 -0
  65. package/install-render.js +29 -0
  66. package/install.js +41 -0
  67. package/jsconfig.json +10 -0
  68. package/license.txt +8 -0
  69. package/package.json +58 -0
  70. package/public/favicon.ico +0 -0
  71. package/public/index.html +28 -0
  72. package/src/App.vue +22 -0
  73. package/src/assets/ft-images/t1.png +0 -0
  74. package/src/assets/ft-images/t2.png +0 -0
  75. package/src/assets/ft-images/t3.png +0 -0
  76. package/src/assets/ft-images/t4.png +0 -0
  77. package/src/assets/ft-images/t5.png +0 -0
  78. package/src/assets/ft-images/t6.png +0 -0
  79. package/src/assets/ft-images/t7.png +0 -0
  80. package/src/assets/ft-images/t8.png +0 -0
  81. package/src/assets/style.scss +92 -0
  82. package/src/assets/vform-logo.png +0 -0
  83. package/src/components/code-editor/index.vue +130 -0
  84. package/src/components/form-designer/designer.js +926 -0
  85. package/src/components/form-designer/form-widget/container-widget/container-wrapper.vue +107 -0
  86. package/src/components/form-designer/form-widget/container-widget/containerMixin.js +85 -0
  87. package/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue +310 -0
  88. package/src/components/form-designer/form-widget/container-widget/grid-widget.vue +89 -0
  89. package/src/components/form-designer/form-widget/container-widget/index.js +24 -0
  90. package/src/components/form-designer/form-widget/container-widget/tab-widget.vue +119 -0
  91. package/src/components/form-designer/form-widget/container-widget/table-cell-widget.vue +341 -0
  92. package/src/components/form-designer/form-widget/container-widget/table-widget.vue +111 -0
  93. package/src/components/form-designer/form-widget/field-widget/button-widget.vue +87 -0
  94. package/src/components/form-designer/form-widget/field-widget/cascader-widget.vue +104 -0
  95. package/src/components/form-designer/form-widget/field-widget/checkbox-widget.vue +105 -0
  96. package/src/components/form-designer/form-widget/field-widget/color-widget.vue +99 -0
  97. package/src/components/form-designer/form-widget/field-widget/date-range-widget.vue +104 -0
  98. package/src/components/form-designer/form-widget/field-widget/date-widget.vue +103 -0
  99. package/src/components/form-designer/form-widget/field-widget/divider-widget.vue +83 -0
  100. package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +535 -0
  101. package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue +271 -0
  102. package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue +331 -0
  103. package/src/components/form-designer/form-widget/field-widget/html-text-widget.vue +82 -0
  104. package/src/components/form-designer/form-widget/field-widget/index.js +10 -0
  105. package/src/components/form-designer/form-widget/field-widget/input-widget.vue +112 -0
  106. package/src/components/form-designer/form-widget/field-widget/number-widget.vue +103 -0
  107. package/src/components/form-designer/form-widget/field-widget/picture-upload-widget.vue +226 -0
  108. package/src/components/form-designer/form-widget/field-widget/radio-widget.vue +105 -0
  109. package/src/components/form-designer/form-widget/field-widget/rate-widget.vue +102 -0
  110. package/src/components/form-designer/form-widget/field-widget/rich-editor-widget.vue +122 -0
  111. package/src/components/form-designer/form-widget/field-widget/select-widget.vue +115 -0
  112. package/src/components/form-designer/form-widget/field-widget/slider-widget.vue +100 -0
  113. package/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue +189 -0
  114. package/src/components/form-designer/form-widget/field-widget/static-text-widget.vue +82 -0
  115. package/src/components/form-designer/form-widget/field-widget/switch-widget.vue +101 -0
  116. package/src/components/form-designer/form-widget/field-widget/textarea-widget.vue +99 -0
  117. package/src/components/form-designer/form-widget/field-widget/time-range-widget.vue +104 -0
  118. package/src/components/form-designer/form-widget/field-widget/time-widget.vue +103 -0
  119. package/src/components/form-designer/form-widget/index.vue +260 -0
  120. package/src/components/form-designer/index.vue +448 -0
  121. package/src/components/form-designer/setting-panel/form-setting.vue +324 -0
  122. package/src/components/form-designer/setting-panel/index.vue +328 -0
  123. package/src/components/form-designer/setting-panel/option-items-setting.vue +234 -0
  124. package/src/components/form-designer/setting-panel/property-editor/allowCreate-editor.vue +24 -0
  125. package/src/components/form-designer/setting-panel/property-editor/appendButton-editor.vue +28 -0
  126. package/src/components/form-designer/setting-panel/property-editor/appendButtonDisabled-editor.vue +23 -0
  127. package/src/components/form-designer/setting-panel/property-editor/automaticDropdown-editor.vue +23 -0
  128. package/src/components/form-designer/setting-panel/property-editor/border-editor.vue +23 -0
  129. package/src/components/form-designer/setting-panel/property-editor/buttonIcon-editor.vue +23 -0
  130. package/src/components/form-designer/setting-panel/property-editor/buttonStyle-editor.vue +23 -0
  131. package/src/components/form-designer/setting-panel/property-editor/clearable-editor.vue +23 -0
  132. package/src/components/form-designer/setting-panel/property-editor/columnWidth-editor.vue +40 -0
  133. package/src/components/form-designer/setting-panel/property-editor/container-grid/colHeight-editor.vue +28 -0
  134. package/src/components/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +81 -0
  135. package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +24 -0
  136. package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +24 -0
  137. package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +24 -0
  138. package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-responsive-editor.vue +23 -0
  139. package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue +48 -0
  140. package/src/components/form-designer/setting-panel/property-editor/container-sub-form/showBlankRow-editor.vue +23 -0
  141. package/src/components/form-designer/setting-panel/property-editor/container-sub-form/showRowNumber-editor.vue +23 -0
  142. package/src/components/form-designer/setting-panel/property-editor/container-sub-form/sub-form-labelAlign-editor.vue +36 -0
  143. package/src/components/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue +119 -0
  144. package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue +23 -0
  145. package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue +23 -0
  146. package/src/components/form-designer/setting-panel/property-editor/customClass-editor.vue +40 -0
  147. package/src/components/form-designer/setting-panel/property-editor/defaultValue-editor.vue +25 -0
  148. package/src/components/form-designer/setting-panel/property-editor/disabled-editor.vue +23 -0
  149. package/src/components/form-designer/setting-panel/property-editor/displayStyle-editor.vue +26 -0
  150. package/src/components/form-designer/setting-panel/property-editor/editable-editor.vue +24 -0
  151. package/src/components/form-designer/setting-panel/property-editor/endPlaceholder-editor.vue +23 -0
  152. package/src/components/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +12 -0
  153. package/src/components/form-designer/setting-panel/property-editor/event-handler/onBeforeUpload-editor.vue +30 -0
  154. package/src/components/form-designer/setting-panel/property-editor/event-handler/onBlur-editor.vue +30 -0
  155. package/src/components/form-designer/setting-panel/property-editor/event-handler/onChange-editor.vue +30 -0
  156. package/src/components/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +30 -0
  157. package/src/components/form-designer/setting-panel/property-editor/event-handler/onCreated-editor.vue +31 -0
  158. package/src/components/form-designer/setting-panel/property-editor/event-handler/onFocus-editor.vue +30 -0
  159. package/src/components/form-designer/setting-panel/property-editor/event-handler/onInput-editor.vue +30 -0
  160. package/src/components/form-designer/setting-panel/property-editor/event-handler/onMounted-editor.vue +30 -0
  161. package/src/components/form-designer/setting-panel/property-editor/event-handler/onRemoteQuery-editor.vue +30 -0
  162. package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowAdd-editor.vue +30 -0
  163. package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowChange-editor.vue +30 -0
  164. package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowDelete-editor.vue +30 -0
  165. package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowInsert-editor.vue +30 -0
  166. package/src/components/form-designer/setting-panel/property-editor/event-handler/onUploadError-editor.vue +30 -0
  167. package/src/components/form-designer/setting-panel/property-editor/event-handler/onUploadSuccess-editor.vue +30 -0
  168. package/src/components/form-designer/setting-panel/property-editor/event-handler/onValidate-editor.vue +30 -0
  169. package/src/components/form-designer/setting-panel/property-editor/field-button/button-type-editor.vue +32 -0
  170. package/src/components/form-designer/setting-panel/property-editor/field-button/circle-editor.vue +23 -0
  171. package/src/components/form-designer/setting-panel/property-editor/field-button/icon-editor.vue +23 -0
  172. package/src/components/form-designer/setting-panel/property-editor/field-button/plain-editor.vue +24 -0
  173. package/src/components/form-designer/setting-panel/property-editor/field-button/round-editor.vue +23 -0
  174. package/src/components/form-designer/setting-panel/property-editor/field-color/color-defaultValue-editor.vue +23 -0
  175. package/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +24 -0
  176. package/src/components/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +30 -0
  177. package/src/components/form-designer/setting-panel/property-editor/field-date/date-type-editor.vue +30 -0
  178. package/src/components/form-designer/setting-panel/property-editor/field-date/date-valueFormat-editor.vue +26 -0
  179. package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +24 -0
  180. package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +30 -0
  181. package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-type-editor.vue +27 -0
  182. package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-valueFormat-editor.vue +26 -0
  183. package/src/components/form-designer/setting-panel/property-editor/field-divider/contentPosition-editor.vue +27 -0
  184. package/src/components/form-designer/setting-panel/property-editor/field-file-upload/file-upload-fileTypes-editor.vue +44 -0
  185. package/src/components/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue +23 -0
  186. package/src/components/form-designer/setting-panel/property-editor/field-number/controlsPosition-editor.vue +27 -0
  187. package/src/components/form-designer/setting-panel/property-editor/field-picture-upload/picture-upload-fileTypes-editor.vue +43 -0
  188. package/src/components/form-designer/setting-panel/property-editor/field-rate/allowHalf-editor.vue +23 -0
  189. package/src/components/form-designer/setting-panel/property-editor/field-rate/highThreshold-editor.vue +24 -0
  190. package/src/components/form-designer/setting-panel/property-editor/field-rate/lowThreshold-editor.vue +24 -0
  191. package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +26 -0
  192. package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-max-editor.vue +25 -0
  193. package/src/components/form-designer/setting-panel/property-editor/field-rate/showScore-editor.vue +23 -0
  194. package/src/components/form-designer/setting-panel/property-editor/field-rate/showText-editor.vue +23 -0
  195. package/src/components/form-designer/setting-panel/property-editor/field-slider/range-editor.vue +23 -0
  196. package/src/components/form-designer/setting-panel/property-editor/field-slider/showStops-editor.vue +23 -0
  197. package/src/components/form-designer/setting-panel/property-editor/field-slider/vertical-editor.vue +23 -0
  198. package/src/components/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +23 -0
  199. package/src/components/form-designer/setting-panel/property-editor/field-switch/activeColor-editor.vue +23 -0
  200. package/src/components/form-designer/setting-panel/property-editor/field-switch/activeText-editor.vue +23 -0
  201. package/src/components/form-designer/setting-panel/property-editor/field-switch/inactiveColor-editor.vue +23 -0
  202. package/src/components/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue +23 -0
  203. package/src/components/form-designer/setting-panel/property-editor/field-switch/switch-defaultValue-editor.vue +25 -0
  204. package/src/components/form-designer/setting-panel/property-editor/field-switch/switchWidth-editor.vue +23 -0
  205. package/src/components/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +24 -0
  206. package/src/components/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +27 -0
  207. package/src/components/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +24 -0
  208. package/src/components/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +27 -0
  209. package/src/components/form-designer/setting-panel/property-editor/fileMaxSize-editor.vue +23 -0
  210. package/src/components/form-designer/setting-panel/property-editor/filterable-editor.vue +23 -0
  211. package/src/components/form-designer/setting-panel/property-editor/hidden-editor.vue +23 -0
  212. package/src/components/form-designer/setting-panel/property-editor/index.js +10 -0
  213. package/src/components/form-designer/setting-panel/property-editor/label-editor.vue +30 -0
  214. package/src/components/form-designer/setting-panel/property-editor/labelAlign-editor.vue +42 -0
  215. package/src/components/form-designer/setting-panel/property-editor/labelHidden-editor.vue +23 -0
  216. package/src/components/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +28 -0
  217. package/src/components/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +37 -0
  218. package/src/components/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +23 -0
  219. package/src/components/form-designer/setting-panel/property-editor/labelWidth-editor.vue +25 -0
  220. package/src/components/form-designer/setting-panel/property-editor/limit-editor.vue +24 -0
  221. package/src/components/form-designer/setting-panel/property-editor/max-editor.vue +39 -0
  222. package/src/components/form-designer/setting-panel/property-editor/maxLength-editor.vue +40 -0
  223. package/src/components/form-designer/setting-panel/property-editor/min-editor.vue +40 -0
  224. package/src/components/form-designer/setting-panel/property-editor/minLength-editor.vue +41 -0
  225. package/src/components/form-designer/setting-panel/property-editor/multiple-editor.vue +24 -0
  226. package/src/components/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +24 -0
  227. package/src/components/form-designer/setting-panel/property-editor/multipleSelect-editor.vue +24 -0
  228. package/src/components/form-designer/setting-panel/property-editor/name-editor.vue +80 -0
  229. package/src/components/form-designer/setting-panel/property-editor/optionItems-editor.vue +28 -0
  230. package/src/components/form-designer/setting-panel/property-editor/placeholder-editor.vue +24 -0
  231. package/src/components/form-designer/setting-panel/property-editor/precision-editor.vue +23 -0
  232. package/src/components/form-designer/setting-panel/property-editor/prefixIcon-editor.vue +23 -0
  233. package/src/components/form-designer/setting-panel/property-editor/propertyMixin.js +47 -0
  234. package/src/components/form-designer/setting-panel/property-editor/readonly-editor.vue +23 -0
  235. package/src/components/form-designer/setting-panel/property-editor/remote-editor.vue +25 -0
  236. package/src/components/form-designer/setting-panel/property-editor/required-editor.vue +23 -0
  237. package/src/components/form-designer/setting-panel/property-editor/rows-editor.vue +24 -0
  238. package/src/components/form-designer/setting-panel/property-editor/showFileList-editor.vue +23 -0
  239. package/src/components/form-designer/setting-panel/property-editor/showPassword-editor.vue +24 -0
  240. package/src/components/form-designer/setting-panel/property-editor/showWordLimit-editor.vue +23 -0
  241. package/src/components/form-designer/setting-panel/property-editor/size-editor.vue +38 -0
  242. package/src/components/form-designer/setting-panel/property-editor/startPlaceholder-editor.vue +23 -0
  243. package/src/components/form-designer/setting-panel/property-editor/step-editor.vue +23 -0
  244. package/src/components/form-designer/setting-panel/property-editor/suffixIcon-editor.vue +23 -0
  245. package/src/components/form-designer/setting-panel/property-editor/type-editor.vue +33 -0
  246. package/src/components/form-designer/setting-panel/property-editor/uploadTip-editor.vue +24 -0
  247. package/src/components/form-designer/setting-panel/property-editor/uploadURL-editor.vue +28 -0
  248. package/src/components/form-designer/setting-panel/property-editor/validation-editor.vue +48 -0
  249. package/src/components/form-designer/setting-panel/property-editor/validationHint-editor.vue +23 -0
  250. package/src/components/form-designer/setting-panel/property-editor/withCredentials-editor.vue +23 -0
  251. package/src/components/form-designer/setting-panel/property-editor-factory.js +173 -0
  252. package/src/components/form-designer/setting-panel/propertyRegister.js +198 -0
  253. package/src/components/form-designer/toolbar-panel/index.vue +1070 -0
  254. package/src/components/form-designer/widget-panel/index.vue +530 -0
  255. package/src/components/form-designer/widget-panel/templatesConfig.js +58 -0
  256. package/src/components/form-designer/widget-panel/widgetsConfig.js +966 -0
  257. package/src/components/form-render/container-item/container-item-wrapper.vue +34 -0
  258. package/src/components/form-render/container-item/containerItemMixin.js +136 -0
  259. package/src/components/form-render/container-item/grid-col-item.vue +115 -0
  260. package/src/components/form-render/container-item/grid-item.vue +54 -0
  261. package/src/components/form-render/container-item/index.js +24 -0
  262. package/src/components/form-render/container-item/sub-form-item.vue +405 -0
  263. package/src/components/form-render/container-item/tab-item.vue +89 -0
  264. package/src/components/form-render/container-item/table-cell-item.vue +61 -0
  265. package/src/components/form-render/container-item/table-item.vue +65 -0
  266. package/src/components/form-render/index.vue +712 -0
  267. package/src/components/form-render/refMixin.js +22 -0
  268. package/src/components/svg-icon/index.vue +49 -0
  269. package/src/components/v-table/index.vue +106 -0
  270. package/src/extension/extension-helper.js +23 -0
  271. package/src/extension/extension-loader.js +112 -0
  272. package/src/extension/samples/alert/alert-widget.vue +72 -0
  273. package/src/extension/samples/card/card-item.vue +90 -0
  274. package/src/extension/samples/card/card-widget.vue +119 -0
  275. package/src/extension/samples/extension-schema.js +36 -0
  276. package/src/extension/samples/extension-sfc-generator.js +50 -0
  277. package/src/iconfont/iconfont.css +29 -0
  278. package/src/iconfont/iconfont.eot +0 -0
  279. package/src/iconfont/iconfont.js +1 -0
  280. package/src/iconfont/iconfont.json +37 -0
  281. package/src/iconfont/iconfont.svg +35 -0
  282. package/src/iconfont/iconfont.ttf +0 -0
  283. package/src/iconfont/iconfont.woff +0 -0
  284. package/src/iconfont/iconfont.woff2 +0 -0
  285. package/src/icons/index.js +9 -0
  286. package/src/icons/svg/alert.svg +1 -0
  287. package/src/icons/svg/button.svg +1 -0
  288. package/src/icons/svg/card.svg +1 -0
  289. package/src/icons/svg/cascader-field.svg +1 -0
  290. package/src/icons/svg/checkbox-field.svg +1 -0
  291. package/src/icons/svg/color-field.svg +1 -0
  292. package/src/icons/svg/custom-component.svg +1 -0
  293. package/src/icons/svg/data-table.svg +1 -0
  294. package/src/icons/svg/date-field.svg +1 -0
  295. package/src/icons/svg/date-range-field.svg +1 -0
  296. package/src/icons/svg/divider.svg +1 -0
  297. package/src/icons/svg/document.svg +1 -0
  298. package/src/icons/svg/drag.svg +1 -0
  299. package/src/icons/svg/file-upload-field.svg +1 -0
  300. package/src/icons/svg/github.svg +1 -0
  301. package/src/icons/svg/grid.svg +1 -0
  302. package/src/icons/svg/html-text.svg +1 -0
  303. package/src/icons/svg/node-tree.svg +1 -0
  304. package/src/icons/svg/number-field.svg +1 -0
  305. package/src/icons/svg/picture-upload-field.svg +1 -0
  306. package/src/icons/svg/radio-field.svg +1 -0
  307. package/src/icons/svg/rate-field.svg +1 -0
  308. package/src/icons/svg/redo.svg +1 -0
  309. package/src/icons/svg/rich-editor-field.svg +1 -0
  310. package/src/icons/svg/section.svg +1 -0
  311. package/src/icons/svg/select-field.svg +1 -0
  312. package/src/icons/svg/slider-field.svg +1 -0
  313. package/src/icons/svg/slot-component.svg +1 -0
  314. package/src/icons/svg/static-text.svg +1 -0
  315. package/src/icons/svg/sub-form.svg +1 -0
  316. package/src/icons/svg/switch-field.svg +1 -0
  317. package/src/icons/svg/tab.svg +1 -0
  318. package/src/icons/svg/table.svg +1 -0
  319. package/src/icons/svg/text-field.svg +1 -0
  320. package/src/icons/svg/textarea-field.svg +1 -0
  321. package/src/icons/svg/time-field.svg +1 -0
  322. package/src/icons/svg/time-range-field.svg +1 -0
  323. package/src/icons/svg/undo.svg +1 -0
  324. package/src/icons/svg/vue-sfc.svg +1 -0
  325. package/src/index.js +41 -0
  326. package/src/lang/en-US.js +321 -0
  327. package/src/lang/en-US_extension.js +26 -0
  328. package/src/lang/en-US_render.js +38 -0
  329. package/src/lang/zh-CN.js +321 -0
  330. package/src/lang/zh-CN_extension.js +26 -0
  331. package/src/lang/zh-CN_render.js +38 -0
  332. package/src/main.js +29 -0
  333. package/src/styles/global.scss +103 -0
  334. package/src/styles/index.scss +15 -0
  335. package/src/utils/beautifierLoader.js +77 -0
  336. package/src/utils/code-generator.js +91 -0
  337. package/src/utils/config.js +19 -0
  338. package/src/utils/debug-console.js +7 -0
  339. package/src/utils/directive.js +74 -0
  340. package/src/utils/i18n.js +70 -0
  341. package/src/utils/sfc-generator.js +583 -0
  342. package/src/utils/util.js +232 -0
  343. package/src/utils/validators.js +127 -0
  344. package/src/utils/vue2js-generator.js +144 -0
  345. package/src/utils/vue3js-generator.js +70 -0
  346. package/vue.config.js +92 -0
@@ -0,0 +1,583 @@
1
+ import {isNotNull} from "@/utils/util";
2
+ import {genVue2JS} from "@/utils/vue2js-generator";
3
+ import {beautifierOpts} from "@/utils/beautifierLoader";
4
+ import {genVue3JS} from "@/utils/vue3js-generator";
5
+
6
+ export function buildClassAttr(ctn, defaultClass) {
7
+ const cop = ctn.options
8
+ let gridClassArray = []
9
+ !!defaultClass && gridClassArray.push(defaultClass)
10
+ !!cop.customClass && (cop.customClass.length > 0) && gridClassArray.push(cop.customClass.join(' '))
11
+ return gridClassArray.length > 0 ? `class="${gridClassArray.join(' ')}"` : ''
12
+ }
13
+
14
+ const containerTemplates = { //容器组件属性
15
+ 'grid': (ctn, formConfig) => {
16
+ const gridClassAttr = buildClassAttr(ctn)
17
+ const gridTemplate =
18
+ `<el-row ${gridClassAttr}>
19
+ ${ctn.cols.map(col => {
20
+ const colOpt = col.options
21
+ const spanAttr = !!colOpt.responsive ? '' : `:span="${colOpt.span}"`
22
+ const mdAttr = !colOpt.responsive ? '' : `:md="${colOpt.md}"`
23
+ const smAttr = !colOpt.responsive ? '' : `:sm="${colOpt.sm}"`
24
+ const xsAttr = !colOpt.responsive ? '' : `:xs="${colOpt.xs}"`
25
+ const offsetAttr = !!colOpt.offset ? `:offset="${colOpt.offset}"` : ''
26
+ const pushAttr = !!colOpt.push ? `:push="${colOpt.push}"` : ''
27
+ const pullAttr = !!colOpt.pull ? `:pull="${colOpt.pull}"` : ''
28
+ const colClassAttr = buildClassAttr(col, 'grid-cell')
29
+ return `<el-col ${spanAttr} ${mdAttr} ${smAttr} ${xsAttr} ${offsetAttr} ${pushAttr} ${pullAttr} ${colClassAttr}>
30
+ ${col.widgetList.map(cw => {
31
+ if (cw.category === 'container') {
32
+ return buildContainerWidget(cw, formConfig)
33
+ } else {
34
+ return buildFieldWidget(cw, formConfig)
35
+ }
36
+ }).join('')
37
+ }
38
+ </el-col>`
39
+ }).join('')
40
+ }
41
+ </el-row>`
42
+
43
+ return gridTemplate
44
+ },
45
+
46
+ 'table': (ctn, formConfig) => {
47
+ const tableClassAttr = buildClassAttr(ctn, 'table-layout')
48
+ const tableTemplate =
49
+ `<div class="table-container">
50
+ <table ${tableClassAttr}><tbody>
51
+ ${ctn.rows.map(tr => {
52
+ return `<tr>${
53
+ tr.cols.filter(td => !td.merged).map(td => {
54
+ const tdOpt = td.options
55
+ const tdClassAttr = buildClassAttr(td, 'table-cell')
56
+ const colspanAttr = (!isNaN(tdOpt.colspan) && (tdOpt.colspan !== 1)) ? `colspan="${tdOpt.colspan}"` : ''
57
+ const rowspanAttr = (!isNaN(tdOpt.rowspan) && (tdOpt.rowspan !== 1)) ? `rowspan="${tdOpt.rowspan}"` : ''
58
+
59
+ let tdStyleArray = []
60
+ !!tdOpt.cellWidth && tdStyleArray.push('width: ' + tdOpt.cellWidth + ' !important')
61
+ !!tdOpt.cellHeight && tdStyleArray.push('height: ' + tdOpt.cellHeight + ' !important')
62
+ let tdStyleAttr = (tdStyleArray.length > 0) ? `style="${tdStyleArray.join(';')}"` : ''
63
+
64
+ return `<td ${tdClassAttr} ${colspanAttr} ${rowspanAttr} ${tdStyleAttr}>${td.widgetList.map(tw => {
65
+ if (tw.category === 'container') {
66
+ return buildContainerWidget(tw, formConfig)
67
+ } else {
68
+ return buildFieldWidget(tw, formConfig)
69
+ }
70
+ }).join('')
71
+ }
72
+ </td>`
73
+ }).join('')
74
+ }</tr>`
75
+ }).join('')
76
+ }
77
+ </tbody></table>
78
+ </div>`
79
+ return tableTemplate
80
+ },
81
+
82
+ 'tab': (ctn, formConfig) => {
83
+ const tabClassAttr = buildClassAttr(ctn)
84
+ const vModel = ctn.tabs && (ctn.tabs.length > 0) ? `v-model="${ctn.options.name}ActiveTab"` : ''
85
+ const tabTemplate =
86
+ `<div class="tab-container">
87
+ <el-tabs ${vModel} type="${ctn.displayType}" ${tabClassAttr}>
88
+ ${ctn.tabs.map(tab => {
89
+ const tabOpt = tab.options
90
+ const disabledAttr = (tabOpt.disabled === true) ? `disabled` : ''
91
+ return `<el-tab-pane name="${tabOpt.name}" label="${tabOpt.label}" ${disabledAttr}>
92
+ ${tab.widgetList.map(tw => {
93
+ if (tw.category === 'container') {
94
+ return buildContainerWidget(tw, formConfig)
95
+ } else {
96
+ return buildFieldWidget(tw, formConfig)
97
+ }
98
+ }).join('')
99
+ }</el-tab-pane>`
100
+ }).join('')}
101
+ </el-tabs>
102
+ </div>`
103
+
104
+ return tabTemplate
105
+ },
106
+
107
+ 'sub-form': (ctn, formConfig) => {
108
+ //TODO:
109
+ },
110
+
111
+ }
112
+
113
+ export function buildContainerWidget(widget, formConfig) {
114
+ return containerTemplates[widget.type] ? containerTemplates[widget.type](widget, formConfig) : null
115
+ }
116
+
117
+ function getElAttrs(widget, formConfig) { //获取El组件属性
118
+ let wop = widget.options
119
+ return {
120
+ vModel: `v-model="${formConfig.modelName}.${wop.name}"`,
121
+ readonly: wop.readonly ? `readonly="true"` : '',
122
+ disabled: wop.disabled ? `:disabled="true"` : '',
123
+ size: !!wop.size ? `size="${wop.size}"` : '',
124
+ type: !!wop.type ? `type="${wop.type === 'number' ? 'text' : wop.type}"` : '',
125
+ showPassword: !!wop.showPassword ? `:show-password="${wop.showPassword}"` : '',
126
+ placeholder: !!wop.placeholder ? `placeholder="${wop.placeholder}"` : '',
127
+ rows: (isNotNull(wop.rows) && !isNaN(wop.rows)) ? `rows="${wop.rows}"` : '',
128
+ clearable: !!wop.clearable ? 'clearable' : '',
129
+ minlength: (isNotNull(wop.minLength) && !isNaN(wop.minLength)) ? `:minlength="${wop.minLength}"` : '',
130
+ maxlength: (isNotNull(wop.maxLength) && !isNaN(wop.maxLength)) ? `:maxlength="${wop.maxLength}"` : '',
131
+ showWordLimit: !!wop.showWordLimit ? `:show-word-limit="true"`: '',
132
+ prefixIcon: !!wop.prefixIcon ? `prefix-icon="${wop.prefixIcon}"` : '',
133
+ suffixIcon: !!wop.suffixIcon ? `suffix-icon="${wop.suffixIcon}"` : '',
134
+ controlsPosition: wop.controlsPosition === 'right' ? `controls-position="right"` : '',
135
+ min: (isNotNull(wop.min) && !isNaN(wop.min)) ? `:min="${wop.min}"` : '',
136
+ max: (isNotNull(wop.max) && !isNaN(wop.max)) ? `:max="${wop.max}"` : '',
137
+ precision: (isNotNull(wop.precision) && !isNaN(wop.precision)) ? `:precision="${wop.precision}"` : '',
138
+ step: (isNotNull(wop.step) && !isNaN(wop.step)) ? `:step="${wop.step}"` : '',
139
+ filterable: !!wop.filterable ? `filterable` : '',
140
+ allowCreate: !!wop.allowCreate ? `allow-create` : '',
141
+ defaultFirstOption: (!!wop.filterable && !!wop.allowCreate) ? `default-first-option` : '',
142
+ multiple: !!wop.multiple ? `multiple` : '',
143
+ multipleLimit: (!isNaN(wop.multipleLimit) && (wop.multipleLimit > 0)) ? `:multiple-limit="${wop.multipleLimit}"` : '',
144
+ automaticDropdown: !!wop.automaticDropdown ? `automatic-dropdown` : '',
145
+ remote: !!wop.remote ? `remote` : '',
146
+ format: !!wop.format ? `format="${wop.format}"` : '',
147
+ valueFormat: !!wop.valueFormat ? `value-format="${wop.valueFormat}"` : '',
148
+ editable: !!wop.editable ? `:editable="${wop.editable}"` : '',
149
+ startPlaceholder: !!wop.startPlaceholder ? `start-placeholder="${wop.startPlaceholder}"` : '',
150
+ endPlaceholder: !!wop.endPlaceholder ? `end-placeholder="${wop.endPlaceholder}"` : '',
151
+
152
+ activeText: !!wop.activeText ? `active-text="${wop.activeText}"` : '',
153
+ inactiveText: !!wop.inactiveText ? `inactive-text="${wop.inactiveText}"` : '',
154
+ activeColor: !!wop.activeColor ? `active-color="${wop.activeColor}"` : '',
155
+ inactiveColor: !!wop.inactiveColor ? `inactive-color="${wop.inactiveColor}"` : '',
156
+ switchWidth: (!isNaN(wop.switchWidth) && (wop.switchWidth !== 40)) ? `:width="${wop.switchWidth}"` : '',
157
+
158
+ rateMax: (!isNaN(wop.max) && (wop.max !== 5)) ? `:max="${wop.max}"` : '',
159
+ lowThreshold: (!isNaN(wop.lowThreshold) && (wop.lowThreshold !== 2)) ? `:low-threshold="${wop.lowThreshold}"` : '',
160
+ highThreshold: (!isNaN(wop.highThreshold) && (wop.highThreshold !== 4)) ? `:high-threshold="${wop.highThreshold}"` : '',
161
+ allowHalf: !!wop.allowHalf ? `allow-half` : '',
162
+ showText: !!wop.showText ? `show-text` : '',
163
+ showScore: !!wop.showScore ? `show-score` : '',
164
+
165
+ sliderMin: (!isNaN(wop.min) && (wop.min !== 0)) ? `:min="${wop.min}"` : '',
166
+ sliderMax: (!isNaN(wop.max) && (wop.max !== 100)) ? `:max="${wop.max}"` : '',
167
+ sliderStep: (!isNaN(wop.step) && (wop.step !== 1)) ? `:step="${wop.step}"` : '',
168
+ sliderRange: !!wop.range ? `range` : '',
169
+ sliderVertical: !!wop.vertical ? `vertical` : '',
170
+
171
+ uploadAction: !!wop.uploadURL ? `action="${wop.uploadURL}"` : '',
172
+ withCredentials: !!wop.withCredentials ? `with-credentials` : '',
173
+ multipleSelect: !!wop.multipleSelect ? `multiple` : '',
174
+ showFileList: !!wop.showFileList ? `show-file-list` : '',
175
+ limit: !isNaN(wop.limit) ? `:limit="${wop.limit}"` : '',
176
+ uploadTipSlotChild: !!wop.uploadTip ? `<template #tip><div class="el-upload__tip">${wop.uploadTip}</div></template>` : '',
177
+ pictureUploadIconChild: `<template #default><i class="el-icon-plus"></i></template>`,
178
+ fileUploadIconChild: `<template #default><i class="el-icon-plus"></i></template>`,
179
+
180
+ buttonType: !!wop.type ? `type="${wop.type}` : '',
181
+ buttonPlain: !!wop.plain ? `plain` : '',
182
+ buttonRound: !!wop.round ? `round` : '',
183
+ buttonCircle: !!wop.circle ? `circle` : '',
184
+ buttonIcon: !!wop.icon ? `icon="${wop.icon}"` : '',
185
+
186
+ contentPosition: (!!wop.contentPosition && (wop.contentPosition !== 'center')) ? `content-position="${wop.contentPosition}"` : '',
187
+
188
+ appendButtonChild: !!wop.appendButton ? `<template #append><el-button class="${wop.buttonIcon}" ${!!wop.appendButtonDisabled ? 'disabled' : ''}></el-button></template>` : '',
189
+ }
190
+ }
191
+
192
+ function buildRadioChildren(widget, formConfig) {
193
+ let wop = widget.options
194
+ const childTag = !!wop.buttonStyle ? 'el-radio-button' : 'el-radio'
195
+ const borderAttr = !!wop.border ? `border` : ''
196
+ const styleAttr = `style="{display: ${wop.displayStyle}}"`
197
+ return `<${childTag} v-for="(item, index) in ${wop.name}Options" :key="index" :label="item.value"
198
+ :disabled="item.disabled" ${borderAttr} ${styleAttr}>{{item.label}}</${childTag}>`
199
+ }
200
+
201
+ function buildCheckboxChildren(widget, formConfig) {
202
+ let wop = widget.options
203
+ const childTag = !!wop.buttonStyle ? 'el-checkbox-button' : 'el-checkbox'
204
+ const borderAttr = !!wop.border ? `border` : ''
205
+ const styleAttr = `style="{display: ${wop.displayStyle}}"`
206
+ return `<${childTag} v-for="(item, index) in ${wop.name}Options" :key="index" :label="item.value"
207
+ :disabled="item.disabled" ${borderAttr} ${styleAttr}>{{item.label}}</${childTag}>`
208
+ }
209
+
210
+ function buildSelectChildren(widget, formConfig) {
211
+ let wop = widget.options
212
+ const childTag = 'el-option'
213
+ return `<${childTag} v-for="(item, index) in ${wop.name}Options" :key="index" :label="item.value"
214
+ :value="item.value" :disabled="item.disabled"></${childTag}>`
215
+ }
216
+
217
+ const elTemplates = { //字段组件属性
218
+ 'input': (widget, formConfig) => {
219
+ const {vModel, readonly, disabled, size, type, showPassword, placeholder, clearable,
220
+ minlength, maxlength, showWordLimit, prefixIcon, suffixIcon, appendButtonChild} = getElAttrs(widget, formConfig)
221
+ return `<el-input ${vModel} ${readonly} ${disabled} ${size} ${type} ${showPassword} ${placeholder} ${clearable}
222
+ ${minlength} ${maxlength} ${showWordLimit} ${prefixIcon} ${suffixIcon}>${appendButtonChild}</el-input>`
223
+ },
224
+
225
+ 'textarea': (widget, formConfig) => {
226
+ const {vModel, readonly, disabled, size, type, showPassword, placeholder, rows, clearable,
227
+ minlength, maxlength, showWordLimit} = getElAttrs(widget, formConfig)
228
+ return `<el-input type="textarea" ${vModel} ${readonly} ${disabled} ${size} ${type} ${showPassword} ${placeholder}
229
+ ${rows} ${clearable} ${minlength} ${maxlength} ${showWordLimit}></el-input>`
230
+ },
231
+
232
+ 'number': (widget, formConfig) => {
233
+ const {vModel, disabled, size, type, showPassword, placeholder, controlsPosition, min, max, precision, step
234
+ } = getElAttrs(widget, formConfig)
235
+ return `<el-input-number ${vModel} class="full-width-input" ${disabled} ${size} ${type} ${showPassword}
236
+ ${placeholder} ${controlsPosition} ${min} ${max} ${precision} ${step}></el-input-number>`
237
+ },
238
+
239
+ 'radio': (widget, formConfig) => {
240
+ const {vModel, disabled, size} = getElAttrs(widget, formConfig)
241
+ const radioOptions = buildRadioChildren(widget, formConfig)
242
+ return `<el-radio-group ${vModel} ${disabled} ${size}>${radioOptions}</el-radio-group>`
243
+ },
244
+
245
+ 'checkbox': (widget, formConfig) => {
246
+ const {vModel, disabled, size} = getElAttrs(widget, formConfig)
247
+ const checkboxOptions = buildCheckboxChildren(widget, formConfig)
248
+ return `<el-checkbox-group ${vModel} ${disabled} ${size}>${checkboxOptions}</el-checkbox-group>`
249
+ },
250
+
251
+ 'select': (widget, formConfig) => {
252
+ const {vModel, disabled, size, clearable, filterable, allowCreate, defaultFirstOption, automaticDropdown,
253
+ multiple, multipleLimit, remote, placeholder} = getElAttrs(widget, formConfig)
254
+ const selectOptions = buildSelectChildren(widget, formConfig)
255
+ return `<el-select ${vModel} class="full-width-input" ${disabled} ${size} ${clearable} ${filterable}
256
+ ${allowCreate} ${defaultFirstOption} ${automaticDropdown} ${multiple} ${multipleLimit} ${placeholder}
257
+ ${remote}>${selectOptions}</el-select>`
258
+ },
259
+
260
+ 'time': (widget, formConfig) => {
261
+ const {vModel, readonly, disabled, size, placeholder, clearable, format, editable
262
+ } = getElAttrs(widget, formConfig)
263
+ return `<el-input ${vModel} class="full-width-input" ${readonly} ${disabled} ${size} ${format}
264
+ value-format="HH:mm:ss" ${placeholder} ${clearable} ${editable}></el-input>`
265
+ },
266
+
267
+ 'time-range': (widget, formConfig) => {
268
+ const {vModel, readonly, disabled, size, startPlaceholder, endPlaceholder, clearable, format, editable
269
+ } = getElAttrs(widget, formConfig)
270
+ return `<el-input is-range ${vModel} class="full-width-input" ${readonly} ${disabled} ${size} ${format}
271
+ value-format="HH:mm:ss" ${startPlaceholder} ${endPlaceholder} ${clearable} ${editable}></el-input>`
272
+ },
273
+
274
+ 'date': (widget, formConfig) => {
275
+ const {vModel, readonly, disabled, size, type, placeholder, clearable, format, valueFormat, editable
276
+ } = getElAttrs(widget, formConfig)
277
+ return `<el-input ${vModel} ${type} class="full-width-input" ${readonly} ${disabled} ${size} ${format}
278
+ ${valueFormat} ${placeholder} ${clearable} ${editable}></el-input>`
279
+ },
280
+
281
+ 'date-range': (widget, formConfig) => {
282
+ const {vModel, readonly, disabled, size, type, startPlaceholder, endPlaceholder, clearable, format, valueFormat, editable
283
+ } = getElAttrs(widget, formConfig)
284
+ return `<el-input is-range ${vModel} ${type} class="full-width-input" ${readonly} ${disabled} ${size} ${format}
285
+ ${valueFormat} ${startPlaceholder} ${endPlaceholder} ${clearable} ${editable}></el-input>`
286
+ },
287
+
288
+ 'switch': (widget, formConfig) => {
289
+ const {vModel, disabled, activeText, inactiveText, activeColor, inactiveColor, switchWidth
290
+ } = getElAttrs(widget, formConfig)
291
+ return `<el-switch ${vModel} ${disabled} ${activeText} ${inactiveText} ${activeColor} ${inactiveColor}
292
+ ${switchWidth}></el-switch>`
293
+ },
294
+
295
+ 'rate': (widget, formConfig) => {
296
+ const {vModel, disabled, rateMax, lowThreshold, highThreshold, allowHalf, showText,
297
+ showScore} = getElAttrs(widget, formConfig)
298
+ return `<el-rate ${vModel} ${disabled} ${rateMax} ${lowThreshold} ${highThreshold} ${allowHalf}
299
+ ${showText} ${showScore}></el-rate>`
300
+ },
301
+
302
+ 'color': (widget, formConfig) => {
303
+ const {vModel, disabled, size
304
+ } = getElAttrs(widget, formConfig)
305
+ return `<el-color-picker ${vModel} ${disabled} ${size}></el-color-picker>`
306
+ },
307
+
308
+ 'slider': (widget, formConfig) => {
309
+ const {vModel, disabled, sliderMin, sliderMax, sliderStep, sliderRange, sliderVertical
310
+ } = getElAttrs(widget, formConfig)
311
+ return `<el-slider ${vModel} ${disabled} ${sliderMin} ${sliderMax} ${sliderStep} ${sliderRange}
312
+ ${sliderVertical}></el-slider>`
313
+ },
314
+
315
+ 'picture-upload': (widget, formConfig) => {
316
+ const {vModel, disabled, uploadAction, withCredentials, multipleSelect, showFileList, limit,
317
+ uploadTipSlotChild, pictureUploadIconChild} = getElAttrs(widget, formConfig)
318
+ let wop = widget.options
319
+ return `<el-upload :file-list="${wop.name}FileList" :headers="${wop.name}UploadHeaders" :data="${wop.name}UploadData"
320
+ ${disabled} ${uploadAction} list-type="picture-card" ${withCredentials} ${multipleSelect} ${showFileList}
321
+ ${limit}>${uploadTipSlotChild} ${pictureUploadIconChild}</el-upload>`
322
+ },
323
+
324
+ 'file-upload': (widget, formConfig) => {
325
+ const {vModel, disabled, uploadAction, withCredentials, multipleSelect, showFileList, limit,
326
+ uploadTipSlotChild, fileUploadIconChild} = getElAttrs(widget, formConfig)
327
+ let wop = widget.options
328
+ return `<el-upload :file-list="${wop.name}FileList" :headers="${wop.name}UploadHeaders" :data="${wop.name}UploadData"
329
+ ${disabled} ${uploadAction} list-type="picture-card" ${withCredentials} ${multipleSelect} ${showFileList}
330
+ ${limit}>${uploadTipSlotChild} ${fileUploadIconChild}</el-upload>`
331
+ },
332
+
333
+ 'rich-editor': (widget, formConfig) => {
334
+ const {vModel, disabled, placeholder
335
+ } = getElAttrs(widget, formConfig)
336
+ return `<vue-editor ${vModel} ${disabled} ${placeholder}></vue-editor>`
337
+ },
338
+
339
+ 'cascader': (widget, formConfig) => {
340
+ const {vModel, disabled, size, clearable, filterable, placeholder} = getElAttrs(widget, formConfig)
341
+ let wop = widget.options
342
+ const optionsAttr = `:options="${wop.name}Options"`
343
+ return `<el-cascader ${vModel} class="full-width-input" ${optionsAttr} ${disabled} ${size} ${clearable}
344
+ ${filterable} ${placeholder}></el-cascader>`
345
+ },
346
+
347
+ 'static-text': (widget, formConfig) => {
348
+ return `<div>${widget.options.textContent}</div>`
349
+ },
350
+
351
+ 'html-text': (widget, formConfig) => {
352
+ return `<div v-html="${widget.options.htmlContent}"></div>`
353
+ },
354
+
355
+ 'button': (widget, formConfig) => {
356
+ const {buttonType, buttonPlain, buttonRound, buttonCircle, buttonIcon, disabled} = getElAttrs(widget, formConfig)
357
+ return `<el-button ${buttonType} ${buttonPlain} ${buttonRound} ${buttonCircle} ${buttonIcon}
358
+ ${disabled}>${widget.options.label}</el-button>`
359
+ },
360
+
361
+ 'divider': (widget, formConfig) => {
362
+ const {contentPosition} = getElAttrs(widget, formConfig)
363
+ return `<el-divider direction="horizontal" ${contentPosition}></el-divider>`
364
+ },
365
+
366
+ }
367
+
368
+ export function buildFieldWidget(widget, formConfig) {
369
+ let wop = widget.options
370
+ const label = wop.labelHidden ? '' : wop.label
371
+ const labelWidthAttr = wop.labelHidden ? `label-width="0"` : (!!wop.labelWidth ? `label-width="${wop.labelWidth}px"` : '')
372
+ const labelTooltipAttr = wop.labelTooltip ? `title="${wop.labelTooltip}"` : ''
373
+ const propAttr = `prop="${wop.name}"`
374
+
375
+ let classArray = []
376
+ !!wop.required && classArray.push('required')
377
+ !!wop.customClass && (wop.customClass.length > 0) && classArray.push(wop.customClass.join(' '))
378
+ if (!!wop.labelAlign) {
379
+ wop.labelAlign !== 'label-left-align' && classArray.push(wop.labelAlign)
380
+ } else if (!!widget.formItemFlag) {
381
+ //classArray.push(formConfig.labelAlign || 'label-left-align')
382
+ formConfig.labelAlign !== 'label-left-align' && classArray.push(formConfig.labelAlign)
383
+ }
384
+ if (!widget.formItemFlag) {
385
+ classArray.push('static-content-item')
386
+ }
387
+ const classAttr = (classArray.length > 0) ? `class="${classArray.join(' ')}"` : ''
388
+
389
+ let customLabelDom =
390
+ `<template #label><span class="custom-label">${wop.labelIconPosition === 'front' ?
391
+ (!!wop.labelTooltip ?
392
+ `<el-tooltip content="${wop.labelTooltip}" effect="light"><i class="${wop.labelIconClass}"></i></el-tooltip>${wop.label}` :
393
+ `<i class="${wop.labelIconClass}"></i>${wop.label}`
394
+ )
395
+ :
396
+ (!!wop.labelTooltip ?
397
+ `${wop.label}<el-tooltip content="${wop.labelTooltip}" effect="light"><i class="${wop.labelIconClass}"></i></el-tooltip>` :
398
+ `${wop.label}<i class="${wop.labelIconClass}"></i>`
399
+ )
400
+ }
401
+ </span></template>`
402
+ !wop.labelIconClass && (customLabelDom = '')
403
+
404
+ const fwDom = elTemplates[widget.type] ? elTemplates[widget.type](widget, formConfig) : null
405
+ const isFormItem = !!widget.formItemFlag
406
+ const vShowAttr = !!wop.hidden ? `v-show="false"` : ''
407
+ return isFormItem ?
408
+ `<el-form-item label="${label}" ${labelWidthAttr} ${labelTooltipAttr} ${propAttr} ${classAttr}>
409
+ ${customLabelDom}
410
+ ${fwDom}
411
+ </el-form-item>`
412
+ :
413
+ `<div ${classAttr} ${vShowAttr}>${fwDom}</div>`
414
+ }
415
+
416
+ function genTemplate(formConfig, widgetList, vue3Flag = false) {
417
+ const submitAttr = !!vue3Flag ? `@submit.prevent` : `@submit.native.prevent`
418
+ let childrenList = []
419
+ widgetList.forEach(wgt => {
420
+ if (wgt.category === 'container') {
421
+ childrenList.push( buildContainerWidget(wgt, formConfig) )
422
+ } else {
423
+ childrenList.push( buildFieldWidget(wgt, formConfig) )
424
+ }
425
+ })
426
+
427
+ const formTemplate =
428
+ ` <el-form :model="${formConfig.modelName}" ref="${formConfig.refName}" :rules="${formConfig.rulesName}"
429
+ label-position="${formConfig.labelPosition}" label-width="${formConfig.labelWidth}px" size="${formConfig.size || 'medium'}"
430
+ ${submitAttr}>
431
+ ${!!childrenList ? childrenList.join('\n') : ''}
432
+ </el-form>`
433
+
434
+ return formTemplate
435
+ }
436
+
437
+ const genGlobalCSS = function (formConfig) {
438
+ const globalCssTemplate =
439
+ ` .el-input-number.full-width-input, .el-cascader.full-width-input {
440
+ width: 100% !important;
441
+ }
442
+
443
+ .el-form-item--medium {
444
+ .el-radio {
445
+ line-height: 36px !important;
446
+ }
447
+
448
+ .el-rate{
449
+ margin-top: 8px;
450
+ }
451
+ }
452
+
453
+ .el-form-item--small {
454
+ .el-radio {
455
+ line-height: 32px !important;
456
+ }
457
+
458
+ .el-rate{
459
+ margin-top: 6px;
460
+ }
461
+ }
462
+
463
+ .el-form-item--mini {
464
+ .el-radio {
465
+ line-height: 28px !important;
466
+ }
467
+
468
+ .el-rate{
469
+ margin-top: 4px;
470
+ }
471
+ }
472
+
473
+ .clear-fix:before, .clear-fix:after {
474
+ display: table;
475
+ content: "";
476
+ }
477
+
478
+ .clear-fix:after {
479
+ clear: both;
480
+ }
481
+
482
+ .float-right {
483
+ float: right;
484
+ }
485
+
486
+ ${formConfig.cssCode}`
487
+
488
+ return globalCssTemplate
489
+ }
490
+
491
+ const genScopedCSS = function (formConfig, vue3Flag = false) {
492
+ //const vDeep = !!vue3Flag ? `::v-deep` : `:deep`
493
+ const cssTemplate =
494
+ ` div.table-container {
495
+ table.table-layout {
496
+ width: 100%;
497
+ table-layout: fixed;
498
+ border-collapse: collapse;
499
+
500
+ td.table-cell {
501
+ display: table-cell;
502
+ height: 36px;
503
+ border: 1px solid #e1e2e3;
504
+ }
505
+ }
506
+ }
507
+
508
+ div.tab-container {
509
+ }
510
+
511
+ .label-left-align ${!!vue3Flag ? `:deep(.el-form-item__label)` : `::v-deep .el-form-item__label`} {
512
+ text-align: left;
513
+ }
514
+
515
+ .label-center-align ${!!vue3Flag ? `:deep(.el-form-item__label)` : `::v-deep .el-form-item__label`} {
516
+ text-align: center;
517
+ }
518
+
519
+ .label-right-align ${!!vue3Flag ? `:deep(.el-form-item__label)` : `::v-deep .el-form-item__label`} {
520
+ text-align: right;
521
+ }
522
+
523
+ .custom-label {
524
+ }
525
+
526
+ .static-content-item {
527
+ min-height: 20px;
528
+ display: flex;
529
+ align-items: center;
530
+
531
+ ${!!vue3Flag ? `:deep(.el-divider--horizontal)` : `::v-deep .el-divider--horizontal`} {
532
+ margin: 0;
533
+ }
534
+ }`
535
+
536
+ return cssTemplate
537
+ }
538
+
539
+ /**
540
+ * 注册容器组件的代码生成器
541
+ * @param containerType 容器类型,必须唯一
542
+ * @param ctGenerator 代码生成器函数,接收两个参数(containerWidget, formConfig),返回生成的容器组件代码
543
+ */
544
+ export const registerCWGenerator = function (containerType, ctGenerator) {
545
+ containerTemplates[containerType] = ctGenerator
546
+ }
547
+
548
+ /**
549
+ * 注册字段组件的代码生成器
550
+ * @param fieldType 字段类型,必须唯一
551
+ * @param ftGenerator 代码生成器函数,接收两个参数(fieldWidget, formConfig),返回生成的字段组件代码
552
+ */
553
+ export const registerFWGenerator = function (fieldType, ftGenerator) {
554
+ elTemplates[fieldType] = ftGenerator
555
+ }
556
+
557
+ export const genSFC = function (formConfig, widgetList, beautifier, vue3Flag = false) {
558
+ const html = beautifier.html(genTemplate(formConfig, widgetList, vue3Flag), beautifierOpts.html)
559
+ const js = beautifier.js(!!vue3Flag ? genVue3JS(formConfig, widgetList): genVue2JS(formConfig, widgetList), beautifierOpts.js)
560
+ const globalCss = beautifier.css(genGlobalCSS(formConfig), beautifierOpts.css)
561
+ const scopedCss = beautifier.css(genScopedCSS(formConfig, vue3Flag), beautifierOpts.css)
562
+
563
+ return `<!--
564
+ Codes Generated By VForm:
565
+ https://www.vform666.com
566
+ -->
567
+
568
+ <template>
569
+ ${html}
570
+ </template>
571
+
572
+ <script>
573
+ ${js}
574
+ </script>
575
+
576
+ <style lang="scss">
577
+ ${globalCss}
578
+ </style>
579
+
580
+ <style lang="scss" scoped>
581
+ ${scopedCss}
582
+ </style>`
583
+ }