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