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,232 @@
1
+ import Clipboard from 'clipboard'
2
+
3
+ export function isNull(value) {
4
+ return (value === null) || (value === undefined);
5
+ }
6
+
7
+ export function isNotNull(value) {
8
+ return (value !== null) && (value !== undefined);
9
+ }
10
+
11
+ export function isEmptyStr(str) {
12
+ //return (str === undefined) || (!str) || (!/[^\s]/.test(str));
13
+ return (str === undefined) || (!str && (str !== 0) && (str !== '0')) || (!/[^\s]/.test(str));
14
+ }
15
+
16
+ export const generateId = function() {
17
+ return Math.floor(Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000);
18
+ };
19
+
20
+ export const deepClone = function (origin) {
21
+ if (origin === undefined) {
22
+ return undefined
23
+ }
24
+
25
+ return JSON.parse(JSON.stringify(origin))
26
+ }
27
+
28
+ export const overwriteObj = function(obj1, obj2) { /* 浅拷贝对象属性,obj2覆盖obj1 */
29
+ // for (let prop in obj2) {
30
+ // if (obj2.hasOwnProperty(prop)) {
31
+ // obj1[prop] = obj2[prop]
32
+ // }
33
+ // }
34
+
35
+ Object.keys(obj2).forEach(prop => {
36
+ obj1[prop] = obj2[prop]
37
+ })
38
+ }
39
+
40
+ export const addWindowResizeHandler = function (handler) {
41
+ let oldHandler = window.onresize
42
+ if (typeof window.onresize != 'function') {
43
+ window.onresize = handler
44
+ } else {
45
+ window.onresize = function () {
46
+ oldHandler()
47
+ handler()
48
+ }
49
+ }
50
+ }
51
+
52
+ const createStyleSheet = function() {
53
+ let head = document.head || document.getElementsByTagName('head')[0];
54
+ let style = document.createElement('style');
55
+ style.type = 'text/css';
56
+ head.appendChild(style);
57
+ return style.sheet;
58
+ }
59
+
60
+ export const insertCustomCssToHead = function (cssCode) {
61
+ let head = document.getElementsByTagName('head')[0]
62
+ let oldStyle = document.getElementById('vform-custom-css')
63
+ if (!!oldStyle) {
64
+ head.removeChild(oldStyle) //应该先清除后插入!!
65
+ }
66
+
67
+ let newStyle = document.createElement('style')
68
+ newStyle.type = 'text/css'
69
+ newStyle.rel = 'stylesheet'
70
+ newStyle.id = 'vform-custom-css'
71
+ try {
72
+ newStyle.appendChild(document.createTextNode(cssCode))
73
+ } catch(ex) {
74
+ newStyle.styleSheet.cssText = cssCode
75
+ }
76
+
77
+ head.appendChild(newStyle)
78
+ }
79
+
80
+ export const insertGlobalFunctionsToHtml = function (functionsCode) {
81
+ let bodyEle = document.getElementsByTagName('body')[0]
82
+ let oldScriptEle = document.getElementById('v_form_global_functions')
83
+ !!oldScriptEle && bodyEle.removeChild(oldScriptEle)
84
+
85
+ let newScriptEle = document.createElement('script')
86
+ newScriptEle.id = 'v_form_global_functions'
87
+ newScriptEle.type = 'text/javascript'
88
+ newScriptEle.innerHTML = functionsCode
89
+ bodyEle.appendChild(newScriptEle)
90
+ }
91
+
92
+ export const optionExists = function(optionsObj, optionName) {
93
+ if (!optionsObj) {
94
+ return false
95
+ }
96
+
97
+ return Object.keys(optionsObj).indexOf(optionName) > -1
98
+ }
99
+
100
+ export const loadRemoteScript = function(srcPath, callback) { /*加载远程js,加载成功后执行回调函数*/
101
+ let sid = encodeURIComponent(srcPath)
102
+ let oldScriptEle = document.getElementById(sid)
103
+
104
+ if (!oldScriptEle) {
105
+ let s = document.createElement('script')
106
+ s.src = srcPath
107
+ s.id = sid
108
+ document.body.appendChild(s)
109
+
110
+ s.onload = s.onreadystatechange = function (_, isAbort) { /* 借鉴自ace.js */
111
+ if (isAbort || !s.readyState || s.readyState === "loaded" || s.readyState === "complete") {
112
+ s = s.onload = s.onreadystatechange = null
113
+ if (!isAbort) {
114
+ callback()
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ export function traverseFieldWidgets(widgetList, handler) {
122
+ widgetList.map(w => {
123
+ if (w.formItemFlag) {
124
+ handler(w)
125
+ } else if (w.type === 'grid') {
126
+ w.cols.map(col => {
127
+ traverseFieldWidgets(col.widgetList, handler)
128
+ })
129
+ } else if (w.type === 'table') {
130
+ w.rows.map(row => {
131
+ row.cols.map(cell => {
132
+ traverseFieldWidgets(cell.widgetList, handler)
133
+ })
134
+ })
135
+ } else if (w.type === 'tab') {
136
+ w.tabs.map(tab => {
137
+ traverseFieldWidgets(tab.widgetList, handler)
138
+ })
139
+ } else if (w.type === 'sub-form') {
140
+ traverseFieldWidgets(w.widgetList, handler)
141
+ } else if (w.category === 'container') { //自定义容器
142
+ traverseFieldWidgets(w.widgetList, handler)
143
+ }
144
+ })
145
+ }
146
+
147
+ export function traverseContainWidgets(widgetList, handler) {
148
+ widgetList.map(w => {
149
+ if (w.category === 'container') {
150
+ handler(w)
151
+ }
152
+
153
+ if (w.type === 'grid') {
154
+ w.cols.map(col => {
155
+ traverseContainWidgets(col.widgetList, handler)
156
+ })
157
+ } else if (w.type === 'table') {
158
+ w.rows.map(row => {
159
+ row.cols.map(cell => {
160
+ traverseContainWidgets(cell.widgetList, handler)
161
+ })
162
+ })
163
+ } else if (w.type === 'tab') {
164
+ w.tabs.map(tab => {
165
+ traverseContainWidgets(tab.widgetList, handler)
166
+ })
167
+ } else if (w.type === 'sub-form') {
168
+ traverseContainWidgets(w.widgetList, handler)
169
+ } else if (w.category === 'container') { //自定义容器
170
+ traverseContainWidgets(w.widgetList, handler)
171
+ }
172
+ })
173
+ }
174
+
175
+ export function traverseAllWidgets(widgetList, handler) {
176
+ widgetList.map(w => {
177
+ handler(w)
178
+
179
+ if (w.type === 'grid') {
180
+ w.cols.map(col => {
181
+ handler(col)
182
+ traverseAllWidgets(col.widgetList, handler)
183
+ })
184
+ } else if (w.type === 'table') {
185
+ w.rows.map(row => {
186
+ row.cols.map(cell => {
187
+ handler(cell)
188
+ traverseAllWidgets(cell.widgetList, handler)
189
+ })
190
+ })
191
+ } else if (w.type === 'tab') {
192
+ w.tabs.map(tab => {
193
+ traverseAllWidgets(tab.widgetList, handler)
194
+ })
195
+ } else if (w.type === 'sub-form') {
196
+ traverseAllWidgets(w.widgetList, handler)
197
+ } else if (w.category === 'container') { //自定义容器
198
+ traverseAllWidgets(w.widgetList, handler)
199
+ }
200
+ })
201
+ }
202
+
203
+ export function copyToClipboard(content, clickEvent, $message, successMsg, errorMsg) {
204
+ const clipboard = new Clipboard(clickEvent.target, {
205
+ text: () => content
206
+ })
207
+
208
+ clipboard.on('success', () => {
209
+ $message.success(successMsg)
210
+ clipboard.destroy()
211
+ })
212
+
213
+ clipboard.on('error', () => {
214
+ $message.error(errorMsg)
215
+ clipboard.destroy()
216
+ })
217
+
218
+ clipboard.onClick(clickEvent)
219
+ }
220
+
221
+ export function getQueryParam(variable) {
222
+ let query = window.location.search.substring(1);
223
+ let vars = query.split("&")
224
+ for (let i=0; i<vars.length; i++) {
225
+ let pair = vars[i].split("=")
226
+ if(pair[0] == variable) {
227
+ return pair[1]
228
+ }
229
+ }
230
+
231
+ return undefined;
232
+ }
@@ -0,0 +1,127 @@
1
+ import {isEmptyStr, isNull} from "./util";
2
+
3
+ export const getRegExp = function (validatorName) {
4
+ const commonRegExp = {
5
+ number: '/^\\d+(\\.\\d+)?$/',
6
+ letter: '/^[A-Za-z]$/',
7
+ letterAndNumber: '/^[A-Za-z0-9]+$/',
8
+ mobilePhone: '/^[1][3-9][0-9]{9}$/',
9
+ letterStartNumberIncluded: '/^[A-Za-z]+[A-Za-z\\d]*$/',
10
+ noChinese: '/^[^\u4e00-\u9fa5]$/',
11
+ chinese: '/^[\u4e00-\u9fa5]$/',
12
+ email: '/^([-_A-Za-z0-9.]+)@([_A-Za-z0-9]+\\.)+[A-Za-z0-9]{2,3}$/',
13
+ url: '/^([hH][tT]{2}[pP]:\\/\\/|[hH][tT]{2}[pP][sS]:\\/\\/)(([A-Za-z0-9-~]+)\\.)+([A-Za-z0-9-~\\/])+$/',
14
+ }
15
+
16
+ return commonRegExp[validatorName]
17
+ }
18
+
19
+ const validateFn = function (validatorName, rule, value, callback, defaultErrorMsg) {
20
+ //空值不校验
21
+ if (isNull(value) || (value.length <= 0)) {
22
+ callback()
23
+ return
24
+ }
25
+
26
+ const reg = eval(getRegExp(validatorName))
27
+
28
+ if (!reg.test(value)) {
29
+ let errTxt = rule.errorMsg || defaultErrorMsg
30
+ callback(new Error(errTxt))
31
+ } else {
32
+ callback()
33
+ }
34
+ }
35
+
36
+ const FormValidators = {
37
+
38
+ /* 数字 */
39
+ number(rule, value, callback) {
40
+ validateFn('number', rule, value, callback, '[' + rule.label + ']包含非数字字符')
41
+ },
42
+
43
+ /* 字母 */
44
+ letter(rule, value, callback) {
45
+ validateFn('letter', rule, value, callback, '[' + rule.label + ']包含非字母字符')
46
+ },
47
+
48
+ /* 字母和数字 */
49
+ letterAndNumber(rule, value, callback) {
50
+ validateFn('letterAndNumber', rule, value, callback, '[' + rule.label + ']只能输入字母或数字')
51
+ },
52
+
53
+ /* 手机号码 */
54
+ mobilePhone(rule, value, callback) {
55
+ validateFn('mobilePhone', rule, value, callback, '[' + rule.label + ']手机号码格式有误')
56
+ },
57
+
58
+ /* 禁止空白字符开头 */
59
+ noBlankStart(rule, value, callback) {
60
+ //暂未实现
61
+ },
62
+
63
+ /* 禁止空白字符结尾 */
64
+ noBlankEnd(rule, value, callback) {
65
+ //暂未实现
66
+ },
67
+
68
+ /* 字母开头,仅可包含数字 */
69
+ letterStartNumberIncluded(rule, value, callback) {
70
+ validateFn('letterStartNumberIncluded', rule, value, callback, '[' + rule.label + ']必须以字母开头,可包含数字')
71
+ },
72
+
73
+ /* 禁止中文输入 */
74
+ noChinese(rule, value, callback) {
75
+ validateFn('noChinese', rule, value, callback, '[' + rule.label + ']不可输入中文字符')
76
+ },
77
+
78
+ /* 必须中文输入 */
79
+ chinese(rule, value, callback) {
80
+ validateFn('chinese', rule, value, callback, '[' + rule.label + ']只能输入中文字符')
81
+ },
82
+
83
+ /* 电子邮箱 */
84
+ email(rule, value, callback) {
85
+ validateFn('email', rule, value, callback, '[' + rule.label + ']邮箱格式有误')
86
+ },
87
+
88
+ /* URL网址 */
89
+ url(rule, value, callback) {
90
+ validateFn('url', rule, value, callback, '[' + rule.label + ']URL格式有误')
91
+ },
92
+
93
+ /*测试
94
+ test(rule, value, callback, errorMsg) {
95
+ //空值不校验
96
+ if (isNull(value) || (value.length <= 0)) {
97
+ callback()
98
+ return
99
+ }
100
+
101
+ if (value < 100) {
102
+ callback(new Error('[' + rule.label + ']不能小于100'))
103
+ } else {
104
+ callback()
105
+ }
106
+ },
107
+ */
108
+
109
+ regExp(rule, value, callback) {
110
+ //空值不校验
111
+ if (isNull(value) || (value.length <= 0)) {
112
+ callback()
113
+ return
114
+ }
115
+
116
+ const pattern = eval(rule.regExp)
117
+ if (!pattern.test(value)) {
118
+ let errTxt = rule.errorMsg || '[' + rule.label + ']invalid value'
119
+ callback(new Error(errTxt))
120
+ } else {
121
+ callback()
122
+ }
123
+ },
124
+
125
+ }
126
+
127
+ export default FormValidators
@@ -0,0 +1,144 @@
1
+ import {isNotNull, traverseContainWidgets, traverseFieldWidgets} from "@/utils/util";
2
+ import {translate} from "@/utils/i18n";
3
+ import FormValidators, {getRegExp} from "@/utils/validators";
4
+
5
+ export function buildDefaultValueListFn(formConfig, widgetList, resultList) {
6
+ return function(fieldWidget) {
7
+ const fop = fieldWidget.options
8
+ const fd = fop.defaultValue
9
+ if (isNotNull(fd)) {
10
+ resultList.push(`${fop.name}: ${JSON.stringify(fd)},`)
11
+ } else {
12
+ resultList.push(`${fop.name}: null,`)
13
+ }
14
+ }
15
+ }
16
+
17
+ export function buildRulesListFn(formConfig, widgetList, resultList) {
18
+ return function(fieldWidget) {
19
+ const fop = fieldWidget.options
20
+ let fieldRules = []
21
+ if (!!fop.required) {
22
+ fieldRules.push(`{
23
+ required: true,
24
+ message: '${translate('render.hint.fieldRequired')}',
25
+ }`)
26
+ }
27
+
28
+ if (!!fop.validation) {
29
+ let vldName = fop.validation
30
+ if (!!FormValidators[vldName]) {
31
+ fieldRules.push(`{
32
+ pattern: ${eval( getRegExp(vldName) )},
33
+ trigger: ['blur', 'change'],
34
+ message: '${fop.validationHint}'
35
+ }`)
36
+ } else {
37
+ fieldRules.push(`{
38
+ pattern: '${eval(vldName)}',
39
+ trigger: ['blur', 'change'],
40
+ message: '${fop.validationHint}'
41
+ }`)
42
+ }
43
+ }
44
+
45
+ //TODO: 自定义校验函数
46
+
47
+ fieldRules.length > 0 && resultList.push(`${fop.name}: [${fieldRules.join(',')}],`)
48
+ }
49
+ }
50
+
51
+ export function buildFieldOptionsFn(formConfig, widgetList, resultList) {
52
+ return function(fieldWidget) {
53
+ const fop = fieldWidget.options
54
+ const ft = fieldWidget.type
55
+ if ((ft === 'radio') || (ft === 'checkbox') || (ft === 'select') || (ft === 'cascader')) {
56
+ resultList.push(`${fop.name}Options: ${JSON.stringify(fop.optionItems)},`)
57
+ }
58
+ }
59
+ }
60
+
61
+ export function buildUploadDataFn(formConfig, widgetList, resultList) {
62
+ return function(fieldWidget) {
63
+ const fop = fieldWidget.options
64
+ const ft = fieldWidget.type
65
+ if ((ft === 'picture-upload') || (ft === 'file-upload')) {
66
+ resultList.push(`${fop.name}FileList: [],`)
67
+ resultList.push(`${fop.name}UploadHeaders: {},`)
68
+ resultList.push(`${fop.name}UploadData: {},`)
69
+ }
70
+ }
71
+ }
72
+
73
+ export function buildActiveTabs(formConfig, widgetList) {
74
+ let resultList = []
75
+ const handlerFn = function (cw) {
76
+ const cop = cw.options
77
+ const ct = cw.type
78
+ if (ct === 'tab') {
79
+ cw.tabs.length > 0 && resultList.push(`'${cop.name}ActiveTab': '${cw.tabs[0].options.name}',`)
80
+ }
81
+ }
82
+ traverseContainWidgets(widgetList, handlerFn)
83
+
84
+ return resultList
85
+ }
86
+
87
+ export const genVue2JS = function (formConfig, widgetList) {
88
+ let defaultValueList = []
89
+ let rulesList = []
90
+ let fieldOptions = []
91
+ let uploadData = []
92
+ traverseFieldWidgets(widgetList, (widget) => {
93
+ buildDefaultValueListFn(formConfig, widgetList, defaultValueList)(widget)
94
+ buildRulesListFn(formConfig, widgetList, rulesList)(widget)
95
+ buildFieldOptionsFn(formConfig, widgetList, fieldOptions)(widget)
96
+ buildUploadDataFn(formConfig, widgetList, uploadData)(widget)
97
+ })
98
+
99
+ const activeTabs = buildActiveTabs(formConfig, widgetList)
100
+
101
+ const v2JSTemplate =
102
+ ` export default {
103
+ components: {},
104
+ props: {},
105
+ data() {
106
+ return {
107
+ ${formConfig.modelName}: {
108
+ ${defaultValueList.join('\n')}
109
+ },
110
+
111
+ ${formConfig.rulesName}: {
112
+ ${rulesList.join('\n')}
113
+ },
114
+
115
+ ${activeTabs.join('\n')}
116
+
117
+ ${fieldOptions.join('\n')}
118
+
119
+ ${uploadData.join('\n')}
120
+ }
121
+ },
122
+ computed: {},
123
+ watch: {},
124
+ created() {
125
+ },
126
+ mounted() {
127
+ },
128
+ methods: {
129
+ submitForm() {
130
+ this.$refs['vForm'].validate(valid => {
131
+ if (!valid) return
132
+
133
+ //TODO: 提交表单
134
+ })
135
+ },
136
+
137
+ resetForm() {
138
+ this.$refs['vForm'].resetFields()
139
+ }
140
+ }
141
+ }`
142
+
143
+ return v2JSTemplate
144
+ }
@@ -0,0 +1,70 @@
1
+ import {
2
+ buildActiveTabs,
3
+ buildDefaultValueListFn,
4
+ buildFieldOptionsFn,
5
+ buildRulesListFn, buildUploadDataFn
6
+ } from "@/utils/vue2js-generator";
7
+ import {traverseFieldWidgets} from "@/utils/util";
8
+
9
+ export const genVue3JS = function (formConfig, widgetList) {
10
+ let defaultValueList = []
11
+ let rulesList = []
12
+ let fieldOptions = []
13
+ let uploadData = []
14
+ traverseFieldWidgets(widgetList, (widget) => {
15
+ buildDefaultValueListFn(formConfig, widgetList, defaultValueList)(widget)
16
+ buildRulesListFn(formConfig, widgetList, rulesList)(widget)
17
+ buildFieldOptionsFn(formConfig, widgetList, fieldOptions)(widget)
18
+ buildUploadDataFn(formConfig, widgetList, uploadData)(widget)
19
+ })
20
+
21
+ const activeTabs = buildActiveTabs(formConfig, widgetList)
22
+
23
+ const v3JSTemplate =
24
+ ` import { defineComponent, toRefs, reactive, getCurrentInstance } from 'vue'
25
+
26
+ export default defineComponent({
27
+ components: {},
28
+ props: {},
29
+ setup() {
30
+ const state = reactive({
31
+ ${formConfig.modelName}: {
32
+ ${defaultValueList.join('\n')}
33
+ },
34
+
35
+ ${formConfig.rulesName}: {
36
+ ${rulesList.join('\n')}
37
+ },
38
+
39
+ ${activeTabs.join('\n')}
40
+
41
+ ${fieldOptions.join('\n')}
42
+
43
+ ${uploadData.join('\n')}
44
+ })
45
+
46
+ const instance = getCurrentInstance()
47
+
48
+ const submitForm = () => {
49
+ instance.ctx.$refs['vForm'].validate(valid => {
50
+ if (!valid) return
51
+
52
+ //TODO: 提交表单
53
+ })
54
+ }
55
+
56
+ const resetForm = () => {
57
+ instance.ctx.$refs['vForm'].resetFields()
58
+ }
59
+
60
+ return {
61
+ ...toRefs(state),
62
+ submitForm,
63
+ resetForm
64
+ }
65
+ }
66
+ })`
67
+
68
+ return v3JSTemplate
69
+ }
70
+
package/vue.config.js ADDED
@@ -0,0 +1,92 @@
1
+ 'use strict'
2
+
3
+ const path = require('path')
4
+ const IS_PROD = process.env.NODE_ENV === 'production'
5
+
6
+ function resolve (dir) {
7
+ return path.join(__dirname, dir)
8
+ }
9
+
10
+ const npmConfigArgv = (process.env.npm_config_argv === undefined) ? null : JSON.parse(process.env.npm_config_argv)
11
+ /*
12
+ console.log('npm config: ', npmConfigArgv)
13
+ const procArgv = process.argv
14
+ console.log('npm config: ', procArgv)
15
+ */
16
+ let buildProdFlag = false
17
+ if (!!npmConfigArgv) {
18
+ npmConfigArgv.original.forEach(cItem => {
19
+ if (cItem === 'build') {
20
+ buildProdFlag = true
21
+ }
22
+ })
23
+ }
24
+
25
+ const mvdir = require('mvdir');
26
+ if (IS_PROD && buildProdFlag) {
27
+ mvdir('index_template/index_prod.html', 'public/index.html', { copy: true });
28
+ } else {
29
+ mvdir('index_template/index_dev.html', 'public/index.html', { copy: true });
30
+ }
31
+
32
+
33
+ module.exports = {
34
+ assetsDir: './',
35
+
36
+ /* 开启vue运行时模板编译功能!! */
37
+ runtimeCompiler: true,
38
+
39
+ lintOnSave: false,
40
+
41
+ productionSourceMap: false,
42
+
43
+ /* 指定node_modules目录中需要做babel转译的依赖库 */
44
+ transpileDependencies: [
45
+ 'element-ui', 'vuedraggable',
46
+ ],
47
+
48
+ css: {
49
+ loaderOptions: {
50
+ scss: {
51
+ /* 自动引入全局scss文件 */
52
+ prependData: `
53
+ @import "./src/styles/global.scss";
54
+ `
55
+ }
56
+ }
57
+ },
58
+
59
+ configureWebpack: (config) => {
60
+ config.devtool = 'source-map'
61
+ config.output.libraryExport = 'default' /* 解决import UMD打包文件时, 组件install方法执行报错的问题!! */
62
+
63
+ if (IS_PROD && buildProdFlag) { /* 仅生产环境使用 */
64
+ /* CDN打包,需要修改index.html加入CDN资源 */
65
+ config.externals = {
66
+ 'vue': 'Vue',
67
+ 'element-ui': 'ELEMENT',
68
+ //'quill': 'Quill',
69
+ }
70
+ }
71
+ },
72
+
73
+ chainWebpack: config => {
74
+ /* 配置svg图标自动加载 begin */
75
+ config.module
76
+ .rule('svg')
77
+ .exclude.add(resolve('src/icons'))
78
+ .end()
79
+ config.module
80
+ .rule('icons')
81
+ .test(/\.svg$/)
82
+ .include.add(resolve('src/icons'))
83
+ .end()
84
+ .use('svg-sprite-loader')
85
+ .loader('svg-sprite-loader')
86
+ .options({
87
+ symbolId: 'icon-[name]'
88
+ })
89
+ /* 配置svg图标自动加载 end */
90
+ },
91
+
92
+ }