mirror of
https://github.com/vform666/variant-form3-vite.git
synced 2024-11-10 09:39:20 +08:00
3.0.3(2022.03.02)更新:
1. 修复Pad/H5布局预览的样式显示问题; 2. 修复升级新版element-plus后事件代码编辑弹窗无法显示的问题; 3. 修复provide传递的formConfig属性不能获取最新值的问题,改用provide函数实现; 4. element-plus版本升级到2.0.4。
This commit is contained in:
parent
8766345ceb
commit
471c979abb
@ -14,7 +14,7 @@
|
|||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"clipboard": "^2.0.8",
|
"clipboard": "^2.0.8",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"element-plus": "^1.3.0-beta.9",
|
"element-plus": "^2.0.4",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
"sortablejs": "1.14.0",
|
"sortablejs": "1.14.0",
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
export default {
|
export default {
|
||||||
|
inject: ['getFormConfig'],
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
formConfig() {
|
||||||
|
return this.getFormConfig()
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
appendTableRow(widget) {
|
appendTableRow(widget) {
|
||||||
this.designer.appendTableRow(widget)
|
this.designer.appendTableRow(widget)
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -58,7 +58,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -3,9 +3,13 @@ import FormValidators from '@/utils/validators'
|
|||||||
import eventBus from "@/utils/event-bus"
|
import eventBus from "@/utils/event-bus"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel', 'getOptionData'],
|
inject: ['refList', 'getFormConfig', 'globalOptionData', 'globalModel', 'getOptionData'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
formConfig() {
|
||||||
|
return this.getFormConfig()
|
||||||
|
},
|
||||||
|
|
||||||
widgetSize() {
|
widgetSize() {
|
||||||
return this.field.options.size || 'default'
|
return this.field.options.size || 'default'
|
||||||
},
|
},
|
||||||
|
@ -77,7 +77,6 @@
|
|||||||
SvgIcon,
|
SvgIcon,
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -93,8 +93,12 @@
|
|||||||
|
|
||||||
rules: Array,
|
rules: Array,
|
||||||
},
|
},
|
||||||
inject: ['formConfig'],
|
inject: ['getFormConfig'],
|
||||||
computed: {
|
computed: {
|
||||||
|
formConfig() {
|
||||||
|
return this.getFormConfig()
|
||||||
|
},
|
||||||
|
|
||||||
selected() {
|
selected() {
|
||||||
return !!this.designer && this.field.id === this.designer.selectedId
|
return !!this.designer && this.field.id === this.designer.selectedId
|
||||||
},
|
},
|
||||||
|
@ -61,7 +61,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -60,7 +60,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
@ -180,8 +179,12 @@
|
|||||||
handlePictureRemove(file, fileList) {
|
handlePictureRemove(file, fileList) {
|
||||||
this.fileList = deepClone(fileList) //this.fileList = fileList
|
this.fileList = deepClone(fileList) //this.fileList = fileList
|
||||||
this.updateUploadFieldModelAndEmitDataChange(fileList)
|
this.updateUploadFieldModelAndEmitDataChange(fileList)
|
||||||
|
|
||||||
this.uploadBtnHidden = fileList.length >= this.field.options.limit
|
this.uploadBtnHidden = fileList.length >= this.field.options.limit
|
||||||
|
|
||||||
|
if (!!this.field.options.onFileRemove) {
|
||||||
|
let customFn = new Function('file', 'fileList', this.field.options.onFileRemove)
|
||||||
|
customFn.call(this, file, fileList)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handelUploadError(err, file, fileList) {
|
handelUploadError(err, file, fileList) {
|
||||||
|
@ -58,7 +58,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -52,7 +52,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
// }
|
// }
|
||||||
quillEditor,
|
quillEditor,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -61,7 +61,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -57,7 +57,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
components: {
|
components: {
|
||||||
FormItemWrapper,
|
FormItemWrapper,
|
||||||
},
|
},
|
||||||
inject: ['refList', 'formConfig', 'globalOptionData', 'globalModel'],
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oldFieldValue: null, //field组件change之前的值
|
oldFieldValue: null, //field组件change之前的值
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
provide() {
|
provide() {
|
||||||
return {
|
return {
|
||||||
refList: this.widgetRefList,
|
refList: this.widgetRefList,
|
||||||
formConfig: this.formConfig,
|
getFormConfig: () => this.formConfig, /* 解决provide传递formConfig属性的响应式更新问题!! */
|
||||||
globalOptionData: this.optionData,
|
globalOptionData: this.optionData,
|
||||||
getOptionData: () => this.optionData,
|
getOptionData: () => this.optionData,
|
||||||
globalModel: {
|
globalModel: {
|
||||||
@ -172,7 +172,6 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.container-scroll-bar {
|
.container-scroll-bar {
|
||||||
|
|
||||||
:deep(.el-scrollbar__wrap), :deep(.el-scrollbar__view) {
|
:deep(.el-scrollbar__wrap), :deep(.el-scrollbar__view) {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
@ -186,14 +185,6 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
.el-form.full-height-width {
|
.el-form.full-height-width {
|
||||||
/*
|
|
||||||
margin: 0 auto;
|
|
||||||
width: 420px;
|
|
||||||
border-radius: 15px;
|
|
||||||
//border-width: 10px;
|
|
||||||
box-shadow: 0 0 1px 10px #495060;
|
|
||||||
*/
|
|
||||||
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
|
@ -180,14 +180,6 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// eventBus.$on('editEventHandler', (eventName, eventParams) => {
|
|
||||||
// this.editEventHandler(eventName, eventParams)
|
|
||||||
// })
|
|
||||||
|
|
||||||
// eventBus.$on('editEventHandler', (eventParams) => {
|
|
||||||
// this.editEventHandler(eventParams[0], eventParams[1])
|
|
||||||
// })
|
|
||||||
|
|
||||||
this.on$('editEventHandler', (eventParams) => {
|
this.on$('editEventHandler', (eventParams) => {
|
||||||
//debugger
|
//debugger
|
||||||
this.editEventHandler(eventParams[0], eventParams[1])
|
this.editEventHandler(eventParams[0], eventParams[1])
|
||||||
|
@ -7,7 +7,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
editEventHandler(eventName, eventParams) {
|
editEventHandler(eventName, eventParams) {
|
||||||
this.dispatch('SettingPanel', 'editEventHandler', [eventName, [...eventParams]])
|
this.dispatch('SettingPanel', 'editEventHandler', [eventName, [...eventParams]])
|
||||||
// eventBus.$emit('editEventHandler', [eventName, [...eventParams]])
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,10 @@
|
|||||||
<div v-if="showPreviewDialogFlag" class="" v-drag="['.drag-dialog.el-dialog', '.drag-dialog .el-dialog__header']">
|
<div v-if="showPreviewDialogFlag" class="" v-drag="['.drag-dialog.el-dialog', '.drag-dialog .el-dialog__header']">
|
||||||
<el-dialog :title="i18nt('designer.toolbar.preview')" v-model="showPreviewDialogFlag"
|
<el-dialog :title="i18nt('designer.toolbar.preview')" v-model="showPreviewDialogFlag"
|
||||||
:show-close="true" :close-on-click-modal="false" :close-on-press-escape="false" center
|
:show-close="true" :close-on-click-modal="false" :close-on-press-escape="false" center
|
||||||
:destroy-on-close="true" custom-class="drag-dialog small-padding-dialog" width="75%" :fullscreen="layoutType === 'H5'">
|
:destroy-on-close="true" custom-class="drag-dialog small-padding-dialog" width="75%"
|
||||||
|
:fullscreen="(layoutType === 'H5') || (layoutType === 'Pad')">
|
||||||
<div>
|
<div>
|
||||||
<div class="form-render-wrapper" :class="[layoutType === 'H5' ? 'h5-layout' : '']">
|
<div class="form-render-wrapper" :class="[layoutType === 'H5' ? 'h5-layout' : (layoutType === 'Pad' ? 'pad-layout' : '')]">
|
||||||
<VFormRender ref="preForm" :form-json="formJson" :form-data="testFormData" :preview-state="true"
|
<VFormRender ref="preForm" :form-json="formJson" :form-data="testFormData" :preview-state="true"
|
||||||
:option-data="testOptionData"
|
:option-data="testOptionData"
|
||||||
@appendButtonClick="testOnAppendButtonClick" @buttonClick="testOnButtonClick"
|
@appendButtonClick="testOnAppendButtonClick" @buttonClick="testOnButtonClick"
|
||||||
@ -705,7 +706,7 @@
|
|||||||
|
|
||||||
.form-render-wrapper {
|
.form-render-wrapper {
|
||||||
//height: calc(100vh - 142px);
|
//height: calc(100vh - 142px);
|
||||||
all: revert !important; /* 防止表单继承el-dialog等外部样式,未生效,原因不明?? */
|
//all: revert !important; /* 防止表单继承el-dialog等外部样式,未生效,原因不明?? */
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-render-wrapper.h5-layout {
|
.form-render-wrapper.h5-layout {
|
||||||
@ -714,7 +715,16 @@
|
|||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
//border-width: 10px;
|
//border-width: 10px;
|
||||||
box-shadow: 0 0 1px 10px #495060;
|
box-shadow: 0 0 1px 10px #495060;
|
||||||
height: calc(100vh - 142px);
|
height: calc(100vh - 175px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-render-wrapper.pad-layout {
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 960px;
|
||||||
|
border-radius: 15px;
|
||||||
|
//border-width: 10px;
|
||||||
|
box-shadow: 0 0 1px 10px #495060;
|
||||||
|
height: calc(100vh - 175px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.node-tree-drawer {
|
.node-tree-drawer {
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
inject: ['refList', 'globalModel', 'formConfig', 'previewState'],
|
inject: ['refList', 'globalModel', 'getFormConfig', 'previewState'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
layoutProps: {
|
layoutProps: {
|
||||||
@ -70,6 +70,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
formConfig() {
|
||||||
|
return this.getFormConfig()
|
||||||
|
},
|
||||||
|
|
||||||
customClass() {
|
customClass() {
|
||||||
return this.widget.options.customClass || ''
|
return this.widget.options.customClass || ''
|
||||||
},
|
},
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
return {
|
return {
|
||||||
refList: this.widgetRefList,
|
refList: this.widgetRefList,
|
||||||
sfRefList: this.subFormRefList, //收集SubForm引用
|
sfRefList: this.subFormRefList, //收集SubForm引用
|
||||||
formConfig: this.formConfig,
|
getFormConfig: () => this.formJsonObj.formConfig, /* 解决provide传递formConfig属性的响应式更新问题!! */
|
||||||
globalOptionData: this.optionData,
|
globalOptionData: this.optionData,
|
||||||
getOptionData: () => this.optionData, /* 该方法用于在异步更新option-data之后重新获取到最新值 */
|
getOptionData: () => this.optionData, /* 该方法用于在异步更新option-data之后重新获取到最新值 */
|
||||||
globalModel: {
|
globalModel: {
|
||||||
@ -357,7 +357,6 @@
|
|||||||
this.buildFormModel(newFormJsonObj.widgetList)
|
this.buildFormModel(newFormJsonObj.widgetList)
|
||||||
|
|
||||||
this.formJsonObj['formConfig'] = newFormJsonObj.formConfig
|
this.formJsonObj['formConfig'] = newFormJsonObj.formConfig
|
||||||
// this._provided.formConfig = newFormJsonObj.formConfig //强制更新provide的formConfig对象
|
|
||||||
this.formJsonObj['widgetList'] = newFormJsonObj.widgetList
|
this.formJsonObj['widgetList'] = newFormJsonObj.widgetList
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -11,6 +11,7 @@ export function addDirective(app) {
|
|||||||
mounted(el, binding) {
|
mounted(el, binding) {
|
||||||
if (!binding.value) return false;
|
if (!binding.value) return false;
|
||||||
|
|
||||||
|
binding.instance.$nextTick(() => {
|
||||||
const dragDom = document.querySelector(binding.value[0])
|
const dragDom = document.querySelector(binding.value[0])
|
||||||
const dragHeader = document.querySelector(binding.value[1])
|
const dragHeader = document.querySelector(binding.value[1])
|
||||||
|
|
||||||
@ -119,14 +120,15 @@ export function addDirective(app) {
|
|||||||
document.ontouchend = null;
|
document.ontouchend = null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
// v-dialogDragWidth: 弹窗宽度拖大 拖小
|
// v-dialogDragWidth: 弹窗宽度拖大 拖小
|
||||||
app.directive('dialogDragWidth', {
|
app.directive('dialogDragWidth', {
|
||||||
mounted(el, binding) {
|
mounted(el, binding) {
|
||||||
|
binding.instance.$nextTick(() => {
|
||||||
const dragDom = binding.value.$el.querySelector('.el-dialog')
|
const dragDom = binding.value.$el.querySelector('.el-dialog')
|
||||||
|
|
||||||
el.onmousedown = (e) => {
|
el.onmousedown = (e) => {
|
||||||
// 鼠标按下,计算当前元素距离可视区的距离
|
// 鼠标按下,计算当前元素距离可视区的距离
|
||||||
const disX = e.clientX - el.offsetLeft
|
const disX = e.clientX - el.offsetLeft
|
||||||
@ -144,6 +146,7 @@ export function addDirective(app) {
|
|||||||
document.onmouseup = null
|
document.onmouseup = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user