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,1070 @@
1
+ <template>
2
+ <div class="toolbar-container">
3
+ <div class="left-toolbar">
4
+ <el-button
5
+ type="text"
6
+ :disabled="undoDisabled"
7
+ :title="i18nt('designer.toolbar.undoHint')"
8
+ @click="undoHistory"
9
+ >
10
+ <svg-icon icon-class="undo"
11
+ /></el-button>
12
+ <el-button
13
+ type="text"
14
+ :disabled="redoDisabled"
15
+ :title="i18nt('designer.toolbar.redoHint')"
16
+ @click="redoHistory"
17
+ >
18
+ <svg-icon icon-class="redo"
19
+ /></el-button>
20
+ <el-button-group style="margin-left: 20px">
21
+ <el-button
22
+ :type="layoutType === 'PC' ? 'info' : ''"
23
+ @click="changeLayoutType('PC')"
24
+ >
25
+ {{ i18nt("designer.toolbar.pcLayout") }}</el-button
26
+ >
27
+ <el-button
28
+ :type="layoutType === 'Pad' ? 'info' : ''"
29
+ @click="changeLayoutType('Pad')"
30
+ >
31
+ {{ i18nt("designer.toolbar.padLayout") }}</el-button
32
+ >
33
+ <el-button
34
+ :type="layoutType === 'H5' ? 'info' : ''"
35
+ @click="changeLayoutType('H5')"
36
+ >
37
+ {{ i18nt("designer.toolbar.mobileLayout") }}</el-button
38
+ >
39
+ </el-button-group>
40
+ <el-button
41
+ type=""
42
+ style="margin-left: 20px"
43
+ :title="i18nt('designer.toolbar.nodeTreeHint')"
44
+ @click="showNodeTreeDrawer"
45
+ >
46
+ <svg-icon icon-class="node-tree"
47
+ /></el-button>
48
+ </div>
49
+
50
+ <el-drawer
51
+ :title="i18nt('designer.toolbar.nodeTreeTitle')"
52
+ direction="ltr"
53
+ :visible.sync="showNodeTreeDrawerFlag"
54
+ :modal="false"
55
+ :size="280"
56
+ :destroy-on-close="true"
57
+ class="node-tree-drawer"
58
+ >
59
+ <el-tree
60
+ ref="nodeTree"
61
+ :data="nodeTreeData"
62
+ node-key="id"
63
+ default-expand-all
64
+ highlight-current
65
+ class="node-tree"
66
+ icon-class="el-icon-arrow-right"
67
+ @node-click="onNodeTreeClick"
68
+ ></el-tree>
69
+ </el-drawer>
70
+
71
+ <div class="right-toolbar">
72
+ <el-button
73
+ v-if="showToolButton('clearDesignerButton')"
74
+ type="text"
75
+ @click="clearFormWidget"
76
+ >
77
+ <i class="el-icon-delete" />{{
78
+ i18nt("designer.toolbar.clear")
79
+ }}</el-button
80
+ >
81
+ <el-button
82
+ v-if="showToolButton('previewFormButton')"
83
+ type="text"
84
+ @click="previewForm"
85
+ >
86
+ <i class="el-icon-view" />{{
87
+ i18nt("designer.toolbar.preview")
88
+ }}</el-button
89
+ >
90
+ <el-button
91
+ v-if="showToolButton('importJsonButton')"
92
+ type="text"
93
+ @click="importJson"
94
+ >
95
+ {{ i18nt("designer.toolbar.importJson") }}</el-button
96
+ >
97
+ <el-button
98
+ v-if="showToolButton('exportJsonButton')"
99
+ type="text"
100
+ @click="exportJson"
101
+ >
102
+ {{ i18nt("designer.toolbar.exportJson") }}</el-button
103
+ >
104
+ <el-button
105
+ v-if="showToolButton('exportCodeButton')"
106
+ type="text"
107
+ @click="exportCode"
108
+ >
109
+ {{ i18nt("designer.toolbar.exportCode") }}</el-button
110
+ >
111
+ <el-button
112
+ v-if="showToolButton('generateSFCButton')"
113
+ type="text"
114
+ @click="generateSFC"
115
+ >
116
+ <svg-icon icon-class="vue-sfc" />{{
117
+ i18nt("designer.toolbar.generateSFC")
118
+ }}</el-button
119
+ >
120
+ <slot name="toolButton"></slot>
121
+ </div>
122
+
123
+ <el-dialog
124
+ :title="i18nt('designer.toolbar.preview')"
125
+ :visible.sync="showPreviewDialogFlag"
126
+ v-if="showPreviewDialogFlag"
127
+ :show-close="true"
128
+ :close-on-click-modal="false"
129
+ :close-on-press-escape="false"
130
+ center
131
+ v-dialog-drag
132
+ :destroy-on-close="true"
133
+ class="small-padding-dialog"
134
+ width="75%"
135
+ :fullscreen="layoutType === 'H5'"
136
+ >
137
+ <div>
138
+ <div
139
+ class="form-render-wrapper"
140
+ :class="[layoutType === 'H5' ? 'h5-layout' : '']"
141
+ >
142
+ <VFormRender
143
+ ref="preForm"
144
+ :form-json="formJson"
145
+ :form-data="testFormData"
146
+ :preview-state="true"
147
+ :option-data="testOptionData"
148
+ @appendButtonClick="testOnAppendButtonClick"
149
+ @buttonClick="testOnButtonClick"
150
+ @formChange="handleFormChange"
151
+ ></VFormRender>
152
+ </div>
153
+ </div>
154
+ <code-editor v-model="testFunc" style="display: none"></code-editor>
155
+ <div slot="footer" class="dialog-footer">
156
+ <el-button type="primary" @click="getFormData">{{
157
+ i18nt("designer.hint.getFormData")
158
+ }}</el-button>
159
+ <el-button type="primary" @click="resetForm">{{
160
+ i18nt("designer.hint.resetForm")
161
+ }}</el-button>
162
+ <el-button type="primary" @click="setFormDisabled">{{
163
+ i18nt("designer.hint.disableForm")
164
+ }}</el-button>
165
+ <el-button type="primary" @click="setFormEnabled">{{
166
+ i18nt("designer.hint.enableForm")
167
+ }}</el-button>
168
+ <el-button type="" @click="showPreviewDialogFlag = false">{{
169
+ i18nt("designer.hint.closePreview")
170
+ }}</el-button>
171
+ </div>
172
+ </el-dialog>
173
+
174
+ <el-dialog
175
+ :title="i18nt('designer.toolbar.importJson')"
176
+ :visible.sync="showImportJsonDialogFlag"
177
+ v-if="showImportJsonDialogFlag"
178
+ :show-close="true"
179
+ class="small-padding-dialog"
180
+ center
181
+ v-dialog-drag
182
+ :close-on-click-modal="false"
183
+ :close-on-press-escape="false"
184
+ :destroy-on-close="true"
185
+ >
186
+ <el-alert
187
+ type="info"
188
+ :title="i18nt('designer.hint.importJsonHint')"
189
+ show-icon
190
+ class="alert-padding"
191
+ ></el-alert>
192
+ <code-editor
193
+ :mode="'json'"
194
+ :readonly="false"
195
+ v-model="importTemplate"
196
+ ></code-editor>
197
+ <div slot="footer" class="dialog-footer">
198
+ <el-button type="primary" @click="doJsonImport">
199
+ {{ i18nt("designer.hint.import") }}</el-button
200
+ >
201
+ <el-button @click="showImportJsonDialogFlag = false">
202
+ {{ i18nt("designer.hint.cancel") }}</el-button
203
+ >
204
+ </div>
205
+ </el-dialog>
206
+
207
+ <el-dialog
208
+ :title="i18nt('designer.toolbar.exportJson')"
209
+ :visible.sync="showExportJsonDialogFlag"
210
+ v-if="showExportJsonDialogFlag"
211
+ :show-close="true"
212
+ class="small-padding-dialog"
213
+ center
214
+ v-dialog-drag
215
+ :close-on-click-modal="false"
216
+ :close-on-press-escape="false"
217
+ :destroy-on-close="true"
218
+ >
219
+ <code-editor
220
+ :mode="'json'"
221
+ :readonly="true"
222
+ v-model="jsonContent"
223
+ ></code-editor>
224
+ <div slot="footer" class="dialog-footer">
225
+ <!-- <el-button type="primary" class="copy-json-btn" :data-clipboard-text="jsonRawContent" @click="copyFormJson">
226
+ {{i18nt('designer.hint.copyJson')}}</el-button> -->
227
+ <el-button @click="saveFormJson" type="primary">保存</el-button>
228
+ <el-button type="" @click="showExportJsonDialogFlag = false">
229
+ 取消</el-button
230
+ >
231
+ </div>
232
+ </el-dialog>
233
+
234
+ <el-dialog
235
+ :title="i18nt('designer.toolbar.exportCode')"
236
+ :visible.sync="showExportCodeDialogFlag"
237
+ v-if="showExportCodeDialogFlag"
238
+ :show-close="true"
239
+ class="small-padding-dialog"
240
+ center
241
+ v-dialog-drag
242
+ width="65%"
243
+ :close-on-click-modal="false"
244
+ :close-on-press-escape="false"
245
+ :destroy-on-close="true"
246
+ >
247
+ <el-tabs
248
+ type="border-card"
249
+ class="no-box-shadow no-padding"
250
+ v-model="activeCodeTab"
251
+ >
252
+ <el-tab-pane label="Vue" name="vue">
253
+ <code-editor
254
+ :mode="'html'"
255
+ :readonly="true"
256
+ v-model="vueCode"
257
+ :user-worker="false"
258
+ ></code-editor>
259
+ </el-tab-pane>
260
+ <el-tab-pane label="HTML" name="html">
261
+ <code-editor
262
+ :mode="'html'"
263
+ :readonly="true"
264
+ v-model="htmlCode"
265
+ :user-worker="false"
266
+ ></code-editor>
267
+ </el-tab-pane>
268
+ </el-tabs>
269
+ <div slot="footer" class="dialog-footer">
270
+ <el-button
271
+ type="primary"
272
+ class="copy-vue-btn"
273
+ :data-clipboard-text="vueCode"
274
+ @click="copyVueCode"
275
+ >
276
+ {{ i18nt("designer.hint.copyVueCode") }}</el-button
277
+ >
278
+ <el-button
279
+ type="primary"
280
+ class="copy-html-btn"
281
+ :data-clipboard-text="htmlCode"
282
+ @click="copyHtmlCode"
283
+ >
284
+ {{ i18nt("designer.hint.copyHtmlCode") }}</el-button
285
+ >
286
+ <el-button @click="saveVueCode">{{
287
+ i18nt("designer.hint.saveVueCode")
288
+ }}</el-button>
289
+ <el-button @click="saveHtmlCode">{{
290
+ i18nt("designer.hint.saveHtmlCode")
291
+ }}</el-button>
292
+ <el-button type="" @click="showExportCodeDialogFlag = false">
293
+ {{ i18nt("designer.hint.closePreview") }}</el-button
294
+ >
295
+ </div>
296
+ </el-dialog>
297
+
298
+ <el-dialog
299
+ :title="i18nt('designer.hint.exportFormData')"
300
+ :visible.sync="showFormDataDialogFlag"
301
+ v-if="showFormDataDialogFlag"
302
+ :show-close="true"
303
+ class="dialog-title-light-bg"
304
+ center
305
+ v-dialog-drag
306
+ :close-on-click-modal="false"
307
+ :close-on-press-escape="false"
308
+ :destroy-on-close="true"
309
+ :append-to-body="true"
310
+ >
311
+ <div style="border: 1px solid #dcdfe6">
312
+ <code-editor
313
+ :mode="'json'"
314
+ :readonly="true"
315
+ v-model="formDataJson"
316
+ ></code-editor>
317
+ </div>
318
+ <div slot="footer" class="dialog-footer">
319
+ <el-button
320
+ type="primary"
321
+ class="copy-form-data-json-btn"
322
+ :data-clipboard-text="formDataRawJson"
323
+ @click="copyFormDataJson"
324
+ >
325
+ {{ i18nt("designer.hint.copyFormData") }}</el-button
326
+ >
327
+ <el-button @click="saveFormData">{{
328
+ i18nt("designer.hint.saveFormData")
329
+ }}</el-button>
330
+ <el-button type="" @click="showFormDataDialogFlag = false">
331
+ {{ i18nt("designer.hint.closePreview") }}</el-button
332
+ >
333
+ </div>
334
+ </el-dialog>
335
+
336
+ <el-dialog
337
+ :title="i18nt('designer.toolbar.generateSFC')"
338
+ :visible.sync="showExportSFCDialogFlag"
339
+ v-if="showExportSFCDialogFlag"
340
+ :show-close="true"
341
+ class="small-padding-dialog"
342
+ center
343
+ v-dialog-drag
344
+ width="65%"
345
+ :close-on-click-modal="false"
346
+ :close-on-press-escape="false"
347
+ :destroy-on-close="true"
348
+ >
349
+ <el-tabs
350
+ type="border-card"
351
+ class="no-box-shadow no-padding"
352
+ v-model="activeSFCTab"
353
+ >
354
+ <el-tab-pane label="Vue2" name="vue2">
355
+ <code-editor
356
+ :mode="'html'"
357
+ :readonly="true"
358
+ v-model="sfcCode"
359
+ :user-worker="false"
360
+ ></code-editor>
361
+ </el-tab-pane>
362
+ <el-tab-pane label="Vue3" name="vue3">
363
+ <code-editor
364
+ :mode="'html'"
365
+ :readonly="true"
366
+ v-model="sfcCodeV3"
367
+ :user-worker="false"
368
+ ></code-editor>
369
+ </el-tab-pane>
370
+ </el-tabs>
371
+ <div slot="footer" class="dialog-footer">
372
+ <el-button
373
+ type="primary"
374
+ class="copy-vue2-sfc-btn"
375
+ :data-clipboard-text="sfcCode"
376
+ @click="copyV2SFC"
377
+ >
378
+ {{ i18nt("designer.hint.copyVue2SFC") }}</el-button
379
+ >
380
+ <el-button
381
+ type="primary"
382
+ class="copy-vue3-sfc-btn"
383
+ :data-clipboard-text="sfcCodeV3"
384
+ @click="copyV3SFC"
385
+ >
386
+ {{ i18nt("designer.hint.copyVue3SFC") }}</el-button
387
+ >
388
+ <el-button @click="saveV2SFC">{{
389
+ i18nt("designer.hint.saveVue2SFC")
390
+ }}</el-button>
391
+ <el-button @click="saveV3SFC">{{
392
+ i18nt("designer.hint.saveVue3SFC")
393
+ }}</el-button>
394
+ <el-button type="" @click="showExportSFCDialogFlag = false">
395
+ {{ i18nt("designer.hint.closePreview") }}</el-button
396
+ >
397
+ </div>
398
+ </el-dialog>
399
+ </div>
400
+ </template>
401
+
402
+ <script>
403
+ import VFormRender from "@/components/form-render/index";
404
+ import CodeEditor from "@/components/code-editor/index";
405
+ import Clipboard from "clipboard";
406
+ import {
407
+ deepClone,
408
+ copyToClipboard,
409
+ generateId,
410
+ getQueryParam,
411
+ traverseAllWidgets,
412
+ } from "@/utils/util";
413
+ import i18n from "@/utils/i18n";
414
+ import { generateCode } from "@/utils/code-generator";
415
+ import { genSFC } from "@/utils/sfc-generator";
416
+ import loadBeautifier from "@/utils/beautifierLoader";
417
+ import { saveAs } from "file-saver";
418
+ import axios from "axios";
419
+
420
+ export default {
421
+ name: "ToolbarPanel",
422
+ mixins: [i18n],
423
+ components: {
424
+ VFormRender,
425
+ CodeEditor,
426
+ Clipboard,
427
+ },
428
+ props: {
429
+ designer: Object,
430
+ //导出弹框是否显示
431
+ jsonIsShow: {
432
+ type: Boolean,
433
+ default: false,
434
+ },
435
+ },
436
+ inject: ["getDesignerConfig"],
437
+ watch: {
438
+ jsonIsShow(val) {
439
+ this.showExportJsonDialogFlag = val;
440
+ },
441
+ },
442
+ data() {
443
+ return {
444
+ designerConfig: this.getDesignerConfig(),
445
+
446
+ showPreviewDialogFlag: false,
447
+ showImportJsonDialogFlag: false,
448
+ showExportJsonDialogFlag: false,
449
+ showExportCodeDialogFlag: false,
450
+ showFormDataDialogFlag: false,
451
+ showExportSFCDialogFlag: false,
452
+ showNodeTreeDrawerFlag: false,
453
+
454
+ nodeTreeData: [],
455
+
456
+ testFunc: "",
457
+ importTemplate: "",
458
+ jsonContent: "",
459
+ jsonRawContent: "",
460
+
461
+ formDataJson: "",
462
+ formDataRawJson: "",
463
+
464
+ vueCode: "",
465
+ htmlCode: "",
466
+
467
+ sfcCode: "",
468
+ sfcCodeV3: "",
469
+
470
+ activeCodeTab: "vue",
471
+ activeSFCTab: "vue2",
472
+
473
+ testFormData: {
474
+ // 'userName': '666888',
475
+ // 'productItems': [
476
+ // {'pName': 'iPhone12', 'pNum': 10},
477
+ // {'pName': 'P50', 'pNum': 16},
478
+ // ]
479
+
480
+ select62173: 2,
481
+ },
482
+ testOptionData: {
483
+ select62173: [
484
+ { label: "01", value: 1 },
485
+ { label: "22", value: 2 },
486
+ { label: "333", value: 3 },
487
+ ],
488
+ },
489
+ };
490
+ },
491
+ computed: {
492
+ formJson() {
493
+ return {
494
+ widgetList: this.designer.widgetList,
495
+ formConfig: this.designer.formConfig,
496
+ };
497
+ },
498
+
499
+ undoDisabled() {
500
+ return !this.designer.undoEnabled();
501
+ },
502
+
503
+ redoDisabled() {
504
+ return !this.designer.redoEnabled();
505
+ },
506
+
507
+ layoutType() {
508
+ return this.designer.getLayoutType();
509
+ },
510
+ },
511
+ watch: {
512
+ "designer.widgetList": {
513
+ deep: true,
514
+ handler(val) {
515
+ //console.log('test-----', val)
516
+ //this.refreshNodeTree()
517
+ },
518
+ },
519
+ },
520
+ methods: {
521
+ showToolButton(configName) {
522
+ if (this.designerConfig[configName] === undefined) {
523
+ return true;
524
+ }
525
+
526
+ return !!this.designerConfig[configName];
527
+ },
528
+
529
+ buildTreeNodeOfWidget(widget, treeNode) {
530
+ let curNode = {
531
+ id: widget.id,
532
+ label: widget.options.label || widget.type,
533
+ //selectable: true,
534
+ };
535
+ treeNode.push(curNode);
536
+
537
+ if (widget.category === undefined) {
538
+ return;
539
+ }
540
+
541
+ curNode.children = [];
542
+ if (widget.type === "grid") {
543
+ widget.cols.map((col) => {
544
+ let colNode = {
545
+ id: col.id,
546
+ label: col.options.name || widget.type,
547
+ children: [],
548
+ };
549
+ curNode.children.push(colNode);
550
+ col.widgetList.map((wChild) => {
551
+ this.buildTreeNodeOfWidget(wChild, colNode.children);
552
+ });
553
+ });
554
+ } else if (widget.type === "table") {
555
+ //TODO: 需要考虑合并单元格!!
556
+ widget.rows.map((row) => {
557
+ let rowNode = {
558
+ id: row.id,
559
+ label: "table-row",
560
+ selectable: false,
561
+ children: [],
562
+ };
563
+ curNode.children.push(rowNode);
564
+
565
+ row.cols.map((cell) => {
566
+ if (!!cell.merged) {
567
+ //跳过合并单元格!!
568
+ return;
569
+ }
570
+
571
+ let rowChildren = rowNode.children;
572
+ let cellNode = {
573
+ id: cell.id,
574
+ label: "table-cell",
575
+ children: [],
576
+ };
577
+ rowChildren.push(cellNode);
578
+
579
+ cell.widgetList.map((wChild) => {
580
+ this.buildTreeNodeOfWidget(wChild, cellNode.children);
581
+ });
582
+ });
583
+ });
584
+ } else if (widget.type === "tab") {
585
+ widget.tabs.map((tab) => {
586
+ let tabNode = {
587
+ id: tab.id,
588
+ label: tab.options.name || widget.type,
589
+ selectable: false,
590
+ children: [],
591
+ };
592
+ curNode.children.push(tabNode);
593
+ tab.widgetList.map((wChild) => {
594
+ this.buildTreeNodeOfWidget(wChild, tabNode.children);
595
+ });
596
+ });
597
+ } else if (widget.type === "sub-form") {
598
+ widget.widgetList.map((wChild) => {
599
+ this.buildTreeNodeOfWidget(wChild, curNode.children);
600
+ });
601
+ } else if (widget.category === "container") {
602
+ //自定义容器
603
+ widget.widgetList.map((wChild) => {
604
+ this.buildTreeNodeOfWidget(wChild, curNode.children);
605
+ });
606
+ }
607
+ },
608
+
609
+ refreshNodeTree() {
610
+ this.nodeTreeData.length = 0;
611
+ this.designer.widgetList.forEach((wItem) => {
612
+ this.buildTreeNodeOfWidget(wItem, this.nodeTreeData);
613
+ });
614
+ },
615
+
616
+ showNodeTreeDrawer() {
617
+ this.refreshNodeTree();
618
+ this.showNodeTreeDrawerFlag = true;
619
+ this.$nextTick(() => {
620
+ if (!!this.designer.selectedId) {
621
+ //同步当前选中组件到节点树!!!
622
+ this.$refs.nodeTree.setCurrentKey(this.designer.selectedId);
623
+ }
624
+ });
625
+ },
626
+
627
+ undoHistory() {
628
+ this.designer.undoHistoryStep();
629
+ },
630
+
631
+ redoHistory() {
632
+ this.designer.redoHistoryStep();
633
+ },
634
+
635
+ changeLayoutType(newType) {
636
+ this.designer.changeLayoutType(newType);
637
+ },
638
+
639
+ clearFormWidget() {
640
+ this.designer.clearDesigner();
641
+ },
642
+
643
+ previewForm() {
644
+ this.showPreviewDialogFlag = true;
645
+ },
646
+
647
+ saveAsFile(fileContent, defaultFileName) {
648
+ this.$emit("sendModuleJson", {
649
+ formConfigJson: fileContent,
650
+ modelName: "",
651
+ });
652
+ // this.$prompt("模板名称", "保存模板名称", {
653
+ // inputValue: "",
654
+ // closeOnClickModal: false,
655
+ // inputPlaceholder: "请输入模板名称",
656
+ // })
657
+ // .then(({ value }) => {
658
+
659
+ // // if (!value) {
660
+ // // value = defaultFileName
661
+ // // }
662
+ // // debugger;
663
+ // // if (getQueryParam('vscode') == 1) {
664
+
665
+ // // this.vsSaveFile(value, fileContent)
666
+ // // return
667
+ // // }
668
+
669
+ // // const fileBlob = new Blob([fileContent], { type: 'text/plain;charset=utf-8' })
670
+ // // saveAs(fileBlob ,value)
671
+ // })
672
+ // .catch(() => {
673
+ // //
674
+ // });
675
+ },
676
+
677
+ vsSaveFile(fileName, fileContent) {
678
+ const msgObj = {
679
+ cmd: "writeFile",
680
+ data: {
681
+ fileName,
682
+ code: fileContent,
683
+ },
684
+ };
685
+ window.parent.postMessage(msgObj, "*");
686
+ },
687
+
688
+ importJson() {
689
+ this.importTemplate = JSON.stringify(
690
+ this.designer.getImportTemplate(),
691
+ null,
692
+ " "
693
+ );
694
+ this.showImportJsonDialogFlag = true;
695
+ },
696
+
697
+ doJsonImport() {
698
+ try {
699
+ let importObj = JSON.parse(this.importTemplate);
700
+ this.designer.loadFormJson(importObj);
701
+
702
+ this.showImportJsonDialogFlag = false;
703
+ this.$message.success(this.i18nt("designer.hint.importJsonSuccess"));
704
+
705
+ this.designer.emitHistoryChange();
706
+
707
+ this.designer.emitEvent("form-json-imported", []);
708
+ } catch (ex) {
709
+ this.$message.error(ex + "");
710
+ }
711
+ },
712
+
713
+ exportJson() {
714
+ let widgetList = deepClone(this.designer.widgetList);
715
+ let formConfig = deepClone(this.designer.formConfig);
716
+ this.jsonContent = JSON.stringify({ widgetList, formConfig }, null, " ");
717
+ this.jsonRawContent = JSON.stringify({ widgetList, formConfig });
718
+ this.showExportJsonDialogFlag = true;
719
+ },
720
+
721
+ copyFormJson(e) {
722
+ copyToClipboard(
723
+ this.jsonRawContent,
724
+ e,
725
+ this.$message,
726
+ this.i18nt("designer.hint.copyJsonSuccess"),
727
+ this.i18nt("designer.hint.copyJsonFail")
728
+ );
729
+ },
730
+
731
+ saveFormJson() {
732
+ this.saveAsFile(this.jsonContent, `vform${generateId()}.json`);
733
+ },
734
+
735
+ exportCode() {
736
+ this.vueCode = generateCode(this.formJson);
737
+ this.htmlCode = generateCode(this.formJson, "html");
738
+ this.showExportCodeDialogFlag = true;
739
+ },
740
+
741
+ copyVueCode(e) {
742
+ copyToClipboard(
743
+ this.vueCode,
744
+ e,
745
+ this.$message,
746
+ this.i18nt("designer.hint.copyVueCodeSuccess"),
747
+ this.i18nt("designer.hint.copyVueCodeFail")
748
+ );
749
+ },
750
+
751
+ copyHtmlCode(e) {
752
+ copyToClipboard(
753
+ this.htmlCode,
754
+ e,
755
+ this.$message,
756
+ this.i18nt("designer.hint.copyHtmlCodeSuccess"),
757
+ this.i18nt("designer.hint.copyHtmlCodeFail")
758
+ );
759
+ },
760
+
761
+ saveVueCode() {
762
+ this.saveAsFile(this.vueCode, `vform${generateId()}.vue`);
763
+ },
764
+
765
+ saveHtmlCode() {
766
+ this.saveAsFile(this.htmlCode, `vform${generateId()}.html`);
767
+ },
768
+
769
+ generateSFC() {
770
+ loadBeautifier((beautifier) => {
771
+ this.sfcCode = genSFC(
772
+ this.designer.formConfig,
773
+ this.designer.widgetList,
774
+ beautifier
775
+ );
776
+ this.sfcCodeV3 = genSFC(
777
+ this.designer.formConfig,
778
+ this.designer.widgetList,
779
+ beautifier,
780
+ true
781
+ );
782
+ this.showExportSFCDialogFlag = true;
783
+ });
784
+ },
785
+
786
+ copyV2SFC(e) {
787
+ copyToClipboard(
788
+ this.sfcCode,
789
+ e,
790
+ this.$message,
791
+ this.i18nt("designer.hint.copySFCSuccess"),
792
+ this.i18nt("designer.hint.copySFCFail")
793
+ );
794
+ },
795
+
796
+ copyV3SFC(e) {
797
+ copyToClipboard(
798
+ this.sfcCodeV3,
799
+ e,
800
+ this.$message,
801
+ this.i18nt("designer.hint.copySFCSuccess"),
802
+ this.i18nt("designer.hint.copySFCFail")
803
+ );
804
+ },
805
+
806
+ saveV2SFC() {
807
+ this.saveAsFile(this.sfcCode, `vformV2-${generateId()}.vue`);
808
+ },
809
+
810
+ saveV3SFC() {
811
+ this.saveAsFile(this.sfcCodeV3, `vformV3-${generateId()}.vue`);
812
+ },
813
+
814
+ getFormData() {
815
+ this.$refs["preForm"]
816
+ .getFormData()
817
+ .then((formData) => {
818
+ this.formDataJson = JSON.stringify(formData, null, " ");
819
+ this.formDataRawJson = JSON.stringify(formData);
820
+
821
+ this.showFormDataDialogFlag = true;
822
+ })
823
+ .catch((error) => {
824
+ this.$message.error(error);
825
+ });
826
+ },
827
+
828
+ copyFormDataJson(e) {
829
+ copyToClipboard(
830
+ this.formDataRawJson,
831
+ e,
832
+ this.$message,
833
+ this.i18nt("designer.hint.copyJsonSuccess"),
834
+ this.i18nt("designer.hint.copyJsonFail")
835
+ );
836
+ },
837
+
838
+ saveFormData() {
839
+ this.saveAsFile(this.htmlCode, `formData${generateId()}.json`);
840
+ },
841
+
842
+ resetForm() {
843
+ this.$refs["preForm"].resetForm();
844
+ },
845
+
846
+ setFormDisabled() {
847
+ this.$refs["preForm"].disableForm();
848
+ },
849
+
850
+ setFormEnabled() {
851
+ this.$refs["preForm"].enableForm();
852
+ },
853
+
854
+ handleFormChange(fieldName, newValue, oldValue, formModel) {
855
+ /*
856
+ console.log('---formChange start---')
857
+ console.log('fieldName', fieldName)
858
+ console.log('newValue', newValue)
859
+ console.log('oldValue', oldValue)
860
+ console.log('formModel', formModel)
861
+ console.log('---formChange end---')
862
+ */
863
+ },
864
+
865
+ testOnAppendButtonClick(clickedWidget) {
866
+ console.log("test", clickedWidget);
867
+ },
868
+
869
+ testOnButtonClick(button) {
870
+ console.log("test", button);
871
+ },
872
+
873
+ findWidgetById(wId) {
874
+ let foundW = null;
875
+ traverseAllWidgets(this.designer.widgetList, (w) => {
876
+ if (w.id === wId) {
877
+ foundW = w;
878
+ }
879
+ });
880
+
881
+ return foundW;
882
+ },
883
+
884
+ onNodeTreeClick(nodeData, node, nodeEl) {
885
+ //console.log('test', JSON.stringify(nodeData))
886
+
887
+ if (nodeData.selectable !== undefined && !nodeData.selectable) {
888
+ this.$message.info(
889
+ this.i18nt("designer.hint.currentNodeCannotBeSelected")
890
+ );
891
+ } else {
892
+ const selectedId = nodeData.id;
893
+ const foundW = this.findWidgetById(selectedId);
894
+ if (!!foundW) {
895
+ this.designer.setSelected(foundW);
896
+ }
897
+ }
898
+ },
899
+ },
900
+ };
901
+ </script>
902
+
903
+ <style lang="scss" scoped>
904
+ div.toolbar-container {
905
+ min-width: 728px; /* 解决工具按钮栏换行的问题!! */
906
+ }
907
+
908
+ .left-toolbar {
909
+ float: left;
910
+ font-size: 16px;
911
+ }
912
+
913
+ .right-toolbar {
914
+ float: right;
915
+
916
+ ::v-deep .el-button--text {
917
+ font-size: 14px !important;
918
+ }
919
+ }
920
+
921
+ .el-button i {
922
+ margin-right: 3px;
923
+ }
924
+
925
+ .small-padding-dialog {
926
+ ::v-deep .el-dialog__header {
927
+ //padding-top: 3px;
928
+ //padding-bottom: 3px;
929
+ background: #f1f2f3;
930
+ }
931
+
932
+ ::v-deep .el-dialog__body {
933
+ padding: 12px 15px 12px 15px;
934
+
935
+ .el-alert.alert-padding {
936
+ padding: 0 10px;
937
+ }
938
+ }
939
+
940
+ ::v-deep .ace-container {
941
+ border: 1px solid #dcdfe6;
942
+ }
943
+ }
944
+
945
+ .dialog-title-light-bg {
946
+ ::v-deep .el-dialog__header {
947
+ background: #f1f2f3;
948
+ }
949
+ }
950
+
951
+ .no-box-shadow {
952
+ box-shadow: none;
953
+ }
954
+
955
+ .no-padding.el-tabs--border-card {
956
+ ::v-deep .el-tabs__content {
957
+ padding: 0;
958
+ }
959
+ }
960
+
961
+ .form-render-wrapper {
962
+ //height: calc(100vh - 142px);
963
+ all: revert !important; /* 防止表单继承el-dialog等外部样式,未生效,原因不明?? */
964
+ }
965
+
966
+ .form-render-wrapper.h5-layout {
967
+ margin: 0 auto;
968
+ width: 420px;
969
+ border-radius: 15px;
970
+ //border-width: 10px;
971
+ box-shadow: 0 0 1px 10px #495060;
972
+ height: calc(100vh - 142px);
973
+ }
974
+
975
+ .node-tree-drawer ::v-deep {
976
+ .el-drawer {
977
+ padding: 10px;
978
+ overflow: auto;
979
+ }
980
+
981
+ .el-drawer__header {
982
+ margin-bottom: 12px;
983
+ padding: 5px 5px 0;
984
+ }
985
+
986
+ .el-drawer__body {
987
+ padding-left: 5px;
988
+ }
989
+ }
990
+
991
+ /*.node-tree-scroll-bar {*/
992
+ /* height: 100%;*/
993
+ /* overflow: auto;*/
994
+ /*}*/
995
+
996
+ .node-tree ::v-deep {
997
+ .el-tree > .el-tree-node:after {
998
+ border-top: none;
999
+ }
1000
+ .el-tree-node {
1001
+ position: relative;
1002
+ padding-left: 12px;
1003
+ }
1004
+
1005
+ .el-tree-node__content {
1006
+ padding-left: 0 !important;
1007
+ }
1008
+
1009
+ .el-tree-node__expand-icon.is-leaf {
1010
+ display: none;
1011
+ }
1012
+ .el-tree-node__children {
1013
+ padding-left: 12px;
1014
+ overflow: visible !important; /* 加入此行让el-tree宽度自动撑开,超出宽度el-draw自动出现水平滚动条! */
1015
+ }
1016
+
1017
+ .el-tree-node :last-child:before {
1018
+ height: 38px;
1019
+ }
1020
+
1021
+ .el-tree > .el-tree-node:before {
1022
+ border-left: none;
1023
+ }
1024
+
1025
+ .el-tree > .el-tree-node:after {
1026
+ border-top: none;
1027
+ }
1028
+
1029
+ .el-tree-node:before {
1030
+ content: "";
1031
+ left: -4px;
1032
+ position: absolute;
1033
+ right: auto;
1034
+ border-width: 1px;
1035
+ }
1036
+
1037
+ .el-tree-node:after {
1038
+ content: "";
1039
+ left: -4px;
1040
+ position: absolute;
1041
+ right: auto;
1042
+ border-width: 1px;
1043
+ }
1044
+
1045
+ .el-tree-node:before {
1046
+ border-left: 1px dashed #4386c6;
1047
+ bottom: 0px;
1048
+ height: 100%;
1049
+ top: -10px;
1050
+ width: 1px;
1051
+ }
1052
+
1053
+ .el-tree-node:after {
1054
+ border-top: 1px dashed #4386c6;
1055
+ height: 20px;
1056
+ top: 12px;
1057
+ width: 16px;
1058
+ }
1059
+
1060
+ .el-tree-node.is-current > .el-tree-node__content {
1061
+ background: #c2d6ea !important;
1062
+ }
1063
+
1064
+ .el-tree-node__expand-icon {
1065
+ margin-left: -3px;
1066
+ padding: 6px 6px 6px 0px;
1067
+ font-size: 16px;
1068
+ }
1069
+ }
1070
+ </style>