skhj-variant 2.1.12
Sign up to get free protection for your applications and to get access to all the features.
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/package.iml +12 -0
- package/README.md +180 -0
- package/babel.config.js +5 -0
- package/dist/build/css/app.9b74af27.css +1 -0
- package/dist/build/css/chunk-vendors.a16c4353.css +1 -0
- package/dist/build/favicon.ico +0 -0
- package/dist/build/fonts/element-icons.535877f5.woff +0 -0
- package/dist/build/fonts/element-icons.732389de.ttf +0 -0
- package/dist/build/img/t1.21b2c158.png +0 -0
- package/dist/build/img/t2.6991670f.png +0 -0
- package/dist/build/img/t3.49724600.png +0 -0
- package/dist/build/img/t4.4acb1808.png +0 -0
- package/dist/build/img/t5.e5e1948c.png +0 -0
- package/dist/build/img/t6.40836551.png +0 -0
- package/dist/build/img/t7.94cf1cc9.png +0 -0
- package/dist/build/img/t8.9291e9c1.png +0 -0
- package/dist/build/index.html +1 -0
- package/dist/build/js/app.dbcf7751.js +1 -0
- package/dist/build/js/chunk-1d66e3dd.7d669272.js +23 -0
- package/dist/build/js/chunk-vendors.be32fc27.js +24 -0
- package/dist/build/report.html +53 -0
- package/dist/lib/VFormDesigner.common-report.html +53 -0
- package/dist/lib/VFormDesigner.common.1.js +14583 -0
- package/dist/lib/VFormDesigner.common.1.js.map +1 -0
- package/dist/lib/VFormDesigner.common.js +71232 -0
- package/dist/lib/VFormDesigner.common.js.map +1 -0
- package/dist/lib/VFormDesigner.css +1 -0
- package/dist/lib/VFormDesigner.umd-report.html +53 -0
- package/dist/lib/VFormDesigner.umd.1.js +14583 -0
- package/dist/lib/VFormDesigner.umd.1.js.map +1 -0
- package/dist/lib/VFormDesigner.umd.js +71242 -0
- package/dist/lib/VFormDesigner.umd.js.map +1 -0
- package/dist/lib/VFormDesigner.umd.min-report.html +53 -0
- package/dist/lib/VFormDesigner.umd.min.1.js +23 -0
- package/dist/lib/VFormDesigner.umd.min.js +19 -0
- package/dist/lib/demo.html +10 -0
- package/dist/lib/img/t1.21b2c158.png +0 -0
- package/dist/lib/img/t2.6991670f.png +0 -0
- package/dist/lib/img/t3.49724600.png +0 -0
- package/dist/lib/img/t4.4acb1808.png +0 -0
- package/dist/lib/img/t5.e5e1948c.png +0 -0
- package/dist/lib/img/t6.40836551.png +0 -0
- package/dist/lib/img/t7.94cf1cc9.png +0 -0
- package/dist/lib/img/t8.9291e9c1.png +0 -0
- package/dist/lib-render/VFormRender.common-report.html +53 -0
- package/dist/lib-render/VFormRender.common.1.js +14583 -0
- package/dist/lib-render/VFormRender.common.1.js.map +1 -0
- package/dist/lib-render/VFormRender.common.js +32421 -0
- package/dist/lib-render/VFormRender.common.js.map +1 -0
- package/dist/lib-render/VFormRender.css +1 -0
- package/dist/lib-render/VFormRender.umd-report.html +53 -0
- package/dist/lib-render/VFormRender.umd.1.js +14583 -0
- package/dist/lib-render/VFormRender.umd.1.js.map +1 -0
- package/dist/lib-render/VFormRender.umd.js +32431 -0
- package/dist/lib-render/VFormRender.umd.js.map +1 -0
- package/dist/lib-render/VFormRender.umd.min-report.html +53 -0
- package/dist/lib-render/VFormRender.umd.min.1.js +23 -0
- package/dist/lib-render/VFormRender.umd.min.js +15 -0
- package/dist/lib-render/demo.html +10 -0
- package/index_template/index_dev.html +19 -0
- package/index_template/index_prod.html +28 -0
- package/index_template/vform_demo.gif +0 -0
- package/install-render.js +29 -0
- package/install.js +41 -0
- package/jsconfig.json +10 -0
- package/license.txt +8 -0
- package/package.json +58 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +28 -0
- package/src/App.vue +22 -0
- package/src/assets/ft-images/t1.png +0 -0
- package/src/assets/ft-images/t2.png +0 -0
- package/src/assets/ft-images/t3.png +0 -0
- package/src/assets/ft-images/t4.png +0 -0
- package/src/assets/ft-images/t5.png +0 -0
- package/src/assets/ft-images/t6.png +0 -0
- package/src/assets/ft-images/t7.png +0 -0
- package/src/assets/ft-images/t8.png +0 -0
- package/src/assets/style.scss +92 -0
- package/src/assets/vform-logo.png +0 -0
- package/src/components/code-editor/index.vue +130 -0
- package/src/components/form-designer/designer.js +926 -0
- package/src/components/form-designer/form-widget/container-widget/container-wrapper.vue +107 -0
- package/src/components/form-designer/form-widget/container-widget/containerMixin.js +85 -0
- package/src/components/form-designer/form-widget/container-widget/grid-col-widget.vue +310 -0
- package/src/components/form-designer/form-widget/container-widget/grid-widget.vue +89 -0
- package/src/components/form-designer/form-widget/container-widget/index.js +24 -0
- package/src/components/form-designer/form-widget/container-widget/tab-widget.vue +119 -0
- package/src/components/form-designer/form-widget/container-widget/table-cell-widget.vue +341 -0
- package/src/components/form-designer/form-widget/container-widget/table-widget.vue +111 -0
- package/src/components/form-designer/form-widget/field-widget/button-widget.vue +87 -0
- package/src/components/form-designer/form-widget/field-widget/cascader-widget.vue +104 -0
- package/src/components/form-designer/form-widget/field-widget/checkbox-widget.vue +105 -0
- package/src/components/form-designer/form-widget/field-widget/color-widget.vue +99 -0
- package/src/components/form-designer/form-widget/field-widget/date-range-widget.vue +104 -0
- package/src/components/form-designer/form-widget/field-widget/date-widget.vue +103 -0
- package/src/components/form-designer/form-widget/field-widget/divider-widget.vue +83 -0
- package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +535 -0
- package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue +271 -0
- package/src/components/form-designer/form-widget/field-widget/form-item-wrapper.vue +331 -0
- package/src/components/form-designer/form-widget/field-widget/html-text-widget.vue +82 -0
- package/src/components/form-designer/form-widget/field-widget/index.js +10 -0
- package/src/components/form-designer/form-widget/field-widget/input-widget.vue +112 -0
- package/src/components/form-designer/form-widget/field-widget/number-widget.vue +103 -0
- package/src/components/form-designer/form-widget/field-widget/picture-upload-widget.vue +226 -0
- package/src/components/form-designer/form-widget/field-widget/radio-widget.vue +105 -0
- package/src/components/form-designer/form-widget/field-widget/rate-widget.vue +102 -0
- package/src/components/form-designer/form-widget/field-widget/rich-editor-widget.vue +122 -0
- package/src/components/form-designer/form-widget/field-widget/select-widget.vue +115 -0
- package/src/components/form-designer/form-widget/field-widget/slider-widget.vue +100 -0
- package/src/components/form-designer/form-widget/field-widget/static-content-wrapper.vue +189 -0
- package/src/components/form-designer/form-widget/field-widget/static-text-widget.vue +82 -0
- package/src/components/form-designer/form-widget/field-widget/switch-widget.vue +101 -0
- package/src/components/form-designer/form-widget/field-widget/textarea-widget.vue +99 -0
- package/src/components/form-designer/form-widget/field-widget/time-range-widget.vue +104 -0
- package/src/components/form-designer/form-widget/field-widget/time-widget.vue +103 -0
- package/src/components/form-designer/form-widget/index.vue +260 -0
- package/src/components/form-designer/index.vue +448 -0
- package/src/components/form-designer/setting-panel/form-setting.vue +324 -0
- package/src/components/form-designer/setting-panel/index.vue +328 -0
- package/src/components/form-designer/setting-panel/option-items-setting.vue +234 -0
- package/src/components/form-designer/setting-panel/property-editor/allowCreate-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/appendButton-editor.vue +28 -0
- package/src/components/form-designer/setting-panel/property-editor/appendButtonDisabled-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/automaticDropdown-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/border-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/buttonIcon-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/buttonStyle-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/clearable-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/columnWidth-editor.vue +40 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid/colHeight-editor.vue +28 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid/gutter-editor.vue +81 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-offset-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-pull-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-push-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-responsive-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/container-grid-col/grid-col-span-editor.vue +48 -0
- package/src/components/form-designer/setting-panel/property-editor/container-sub-form/showBlankRow-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/container-sub-form/showRowNumber-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/container-sub-form/sub-form-labelAlign-editor.vue +36 -0
- package/src/components/form-designer/setting-panel/property-editor/container-tab/tab-customClass-editor.vue +119 -0
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellHeight-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/container-table-cell/cellWidth-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/customClass-editor.vue +40 -0
- package/src/components/form-designer/setting-panel/property-editor/defaultValue-editor.vue +25 -0
- package/src/components/form-designer/setting-panel/property-editor/disabled-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/displayStyle-editor.vue +26 -0
- package/src/components/form-designer/setting-panel/property-editor/editable-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/endPlaceholder-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/eventMixin.js +12 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onBeforeUpload-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onBlur-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onChange-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onClick-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onCreated-editor.vue +31 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onFocus-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onInput-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onMounted-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onRemoteQuery-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowAdd-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowChange-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowDelete-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onSubFormRowInsert-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onUploadError-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onUploadSuccess-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/event-handler/onValidate-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/field-button/button-type-editor.vue +32 -0
- package/src/components/form-designer/setting-panel/property-editor/field-button/circle-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-button/icon-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-button/plain-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-button/round-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-color/color-defaultValue-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-format-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-type-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date/date-valueFormat-editor.vue +26 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-format-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-type-editor.vue +27 -0
- package/src/components/form-designer/setting-panel/property-editor/field-date-range/date-range-valueFormat-editor.vue +26 -0
- package/src/components/form-designer/setting-panel/property-editor/field-divider/contentPosition-editor.vue +27 -0
- package/src/components/form-designer/setting-panel/property-editor/field-file-upload/file-upload-fileTypes-editor.vue +44 -0
- package/src/components/form-designer/setting-panel/property-editor/field-html-text/htmlContent-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-number/controlsPosition-editor.vue +27 -0
- package/src/components/form-designer/setting-panel/property-editor/field-picture-upload/picture-upload-fileTypes-editor.vue +43 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/allowHalf-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/highThreshold-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/lowThreshold-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-defaultValue-editor.vue +26 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/rate-max-editor.vue +25 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/showScore-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-rate/showText-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-slider/range-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-slider/showStops-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-slider/vertical-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-static-text/textContent-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-switch/activeColor-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-switch/activeText-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-switch/inactiveColor-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-switch/inactiveText-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-switch/switch-defaultValue-editor.vue +25 -0
- package/src/components/form-designer/setting-panel/property-editor/field-switch/switchWidth-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-time/time-format-editor.vue +27 -0
- package/src/components/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/field-time-range/time-range-format-editor.vue +27 -0
- package/src/components/form-designer/setting-panel/property-editor/fileMaxSize-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/filterable-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/hidden-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/index.js +10 -0
- package/src/components/form-designer/setting-panel/property-editor/label-editor.vue +30 -0
- package/src/components/form-designer/setting-panel/property-editor/labelAlign-editor.vue +42 -0
- package/src/components/form-designer/setting-panel/property-editor/labelHidden-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/labelIconClass-editor.vue +28 -0
- package/src/components/form-designer/setting-panel/property-editor/labelIconPosition-editor.vue +37 -0
- package/src/components/form-designer/setting-panel/property-editor/labelTooltip-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/labelWidth-editor.vue +25 -0
- package/src/components/form-designer/setting-panel/property-editor/limit-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/max-editor.vue +39 -0
- package/src/components/form-designer/setting-panel/property-editor/maxLength-editor.vue +40 -0
- package/src/components/form-designer/setting-panel/property-editor/min-editor.vue +40 -0
- package/src/components/form-designer/setting-panel/property-editor/minLength-editor.vue +41 -0
- package/src/components/form-designer/setting-panel/property-editor/multiple-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/multipleSelect-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/name-editor.vue +80 -0
- package/src/components/form-designer/setting-panel/property-editor/optionItems-editor.vue +28 -0
- package/src/components/form-designer/setting-panel/property-editor/placeholder-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/precision-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/prefixIcon-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/propertyMixin.js +47 -0
- package/src/components/form-designer/setting-panel/property-editor/readonly-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/remote-editor.vue +25 -0
- package/src/components/form-designer/setting-panel/property-editor/required-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/rows-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/showFileList-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/showPassword-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/showWordLimit-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/size-editor.vue +38 -0
- package/src/components/form-designer/setting-panel/property-editor/startPlaceholder-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/step-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/suffixIcon-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/type-editor.vue +33 -0
- package/src/components/form-designer/setting-panel/property-editor/uploadTip-editor.vue +24 -0
- package/src/components/form-designer/setting-panel/property-editor/uploadURL-editor.vue +28 -0
- package/src/components/form-designer/setting-panel/property-editor/validation-editor.vue +48 -0
- package/src/components/form-designer/setting-panel/property-editor/validationHint-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor/withCredentials-editor.vue +23 -0
- package/src/components/form-designer/setting-panel/property-editor-factory.js +173 -0
- package/src/components/form-designer/setting-panel/propertyRegister.js +198 -0
- package/src/components/form-designer/toolbar-panel/index.vue +1070 -0
- package/src/components/form-designer/widget-panel/index.vue +530 -0
- package/src/components/form-designer/widget-panel/templatesConfig.js +58 -0
- package/src/components/form-designer/widget-panel/widgetsConfig.js +966 -0
- package/src/components/form-render/container-item/container-item-wrapper.vue +34 -0
- package/src/components/form-render/container-item/containerItemMixin.js +136 -0
- package/src/components/form-render/container-item/grid-col-item.vue +115 -0
- package/src/components/form-render/container-item/grid-item.vue +54 -0
- package/src/components/form-render/container-item/index.js +24 -0
- package/src/components/form-render/container-item/sub-form-item.vue +405 -0
- package/src/components/form-render/container-item/tab-item.vue +89 -0
- package/src/components/form-render/container-item/table-cell-item.vue +61 -0
- package/src/components/form-render/container-item/table-item.vue +65 -0
- package/src/components/form-render/index.vue +712 -0
- package/src/components/form-render/refMixin.js +22 -0
- package/src/components/svg-icon/index.vue +49 -0
- package/src/components/v-table/index.vue +106 -0
- package/src/extension/extension-helper.js +23 -0
- package/src/extension/extension-loader.js +112 -0
- package/src/extension/samples/alert/alert-widget.vue +72 -0
- package/src/extension/samples/card/card-item.vue +90 -0
- package/src/extension/samples/card/card-widget.vue +119 -0
- package/src/extension/samples/extension-schema.js +36 -0
- package/src/extension/samples/extension-sfc-generator.js +50 -0
- package/src/iconfont/iconfont.css +29 -0
- package/src/iconfont/iconfont.eot +0 -0
- package/src/iconfont/iconfont.js +1 -0
- package/src/iconfont/iconfont.json +37 -0
- package/src/iconfont/iconfont.svg +35 -0
- package/src/iconfont/iconfont.ttf +0 -0
- package/src/iconfont/iconfont.woff +0 -0
- package/src/iconfont/iconfont.woff2 +0 -0
- package/src/icons/index.js +9 -0
- package/src/icons/svg/alert.svg +1 -0
- package/src/icons/svg/button.svg +1 -0
- package/src/icons/svg/card.svg +1 -0
- package/src/icons/svg/cascader-field.svg +1 -0
- package/src/icons/svg/checkbox-field.svg +1 -0
- package/src/icons/svg/color-field.svg +1 -0
- package/src/icons/svg/custom-component.svg +1 -0
- package/src/icons/svg/data-table.svg +1 -0
- package/src/icons/svg/date-field.svg +1 -0
- package/src/icons/svg/date-range-field.svg +1 -0
- package/src/icons/svg/divider.svg +1 -0
- package/src/icons/svg/document.svg +1 -0
- package/src/icons/svg/drag.svg +1 -0
- package/src/icons/svg/file-upload-field.svg +1 -0
- package/src/icons/svg/github.svg +1 -0
- package/src/icons/svg/grid.svg +1 -0
- package/src/icons/svg/html-text.svg +1 -0
- package/src/icons/svg/node-tree.svg +1 -0
- package/src/icons/svg/number-field.svg +1 -0
- package/src/icons/svg/picture-upload-field.svg +1 -0
- package/src/icons/svg/radio-field.svg +1 -0
- package/src/icons/svg/rate-field.svg +1 -0
- package/src/icons/svg/redo.svg +1 -0
- package/src/icons/svg/rich-editor-field.svg +1 -0
- package/src/icons/svg/section.svg +1 -0
- package/src/icons/svg/select-field.svg +1 -0
- package/src/icons/svg/slider-field.svg +1 -0
- package/src/icons/svg/slot-component.svg +1 -0
- package/src/icons/svg/static-text.svg +1 -0
- package/src/icons/svg/sub-form.svg +1 -0
- package/src/icons/svg/switch-field.svg +1 -0
- package/src/icons/svg/tab.svg +1 -0
- package/src/icons/svg/table.svg +1 -0
- package/src/icons/svg/text-field.svg +1 -0
- package/src/icons/svg/textarea-field.svg +1 -0
- package/src/icons/svg/time-field.svg +1 -0
- package/src/icons/svg/time-range-field.svg +1 -0
- package/src/icons/svg/undo.svg +1 -0
- package/src/icons/svg/vue-sfc.svg +1 -0
- package/src/index.js +41 -0
- package/src/lang/en-US.js +321 -0
- package/src/lang/en-US_extension.js +26 -0
- package/src/lang/en-US_render.js +38 -0
- package/src/lang/zh-CN.js +321 -0
- package/src/lang/zh-CN_extension.js +26 -0
- package/src/lang/zh-CN_render.js +38 -0
- package/src/main.js +29 -0
- package/src/styles/global.scss +103 -0
- package/src/styles/index.scss +15 -0
- package/src/utils/beautifierLoader.js +77 -0
- package/src/utils/code-generator.js +91 -0
- package/src/utils/config.js +19 -0
- package/src/utils/debug-console.js +7 -0
- package/src/utils/directive.js +74 -0
- package/src/utils/i18n.js +70 -0
- package/src/utils/sfc-generator.js +583 -0
- package/src/utils/util.js +232 -0
- package/src/utils/validators.js +127 -0
- package/src/utils/vue2js-generator.js +144 -0
- package/src/utils/vue3js-generator.js +70 -0
- 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
|
+
}
|