From f0c87eaef69160f92bc45c770b638cb779a58904 Mon Sep 17 00:00:00 2001
From: xuliangzhan
-
-
@@ -332,27 +333,28 @@ export default { demoCodes: [ `
-
-
diff --git a/helper/vetur/attributes.json b/helper/vetur/attributes.json index a9bec07e8..a72a6075a 100644 --- a/helper/vetur/attributes.json +++ b/helper/vetur/attributes.json @@ -1667,6 +1667,10 @@ "type": "boolean", "description": "是否允许窗口边缘拖动调整窗口大小" }, + "vxe-modal/margin-size": { + "type": "number", + "description": "只对 resize 启用后有效,用于设置可拖动界限范围,如果为负数则允许拖动超出屏幕边界" + }, "vxe-modal/show-close": { "type": "boolean", "description": "是否显示关闭按钮" @@ -1715,6 +1719,10 @@ "type": "boolean", "description": "默认最大化显示" }, + "vxe-modal/draggable": { + "type": "boolean", + "description": "是否启用窗口拖动" + }, "vxe-modal/dblclick-zoom": { "type": "boolean", "description": "只对 type=modal 有效,是否允许通过双击头部放大或还原窗口" diff --git a/helper/vetur/tags.json b/helper/vetur/tags.json index 1fb6b00b2..d072fe2a7 100644 --- a/helper/vetur/tags.json +++ b/helper/vetur/tags.json @@ -544,6 +544,7 @@ "esc-closable", "show-zoom", "resize", + "margin-size", "show-close", "duration", "width", @@ -556,6 +557,7 @@ "show-title-overflow", "transfer", "fullscreen", + "draggable", "dblclick-zoom", "remember", "destroy-on-close", diff --git a/package.json b/package.json index f3eeee95a..bde5c82d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "3.3.12", + "version": "3.3.13-beta.0", "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、弹窗、自定义模板、渲染器、贼灵活的配置项、扩展接口等...", "scripts": { "serve": "vue-cli-service serve", diff --git a/packages/modal/src/modal.js b/packages/modal/src/modal.js index 6349128f9..a8f478525 100644 --- a/packages/modal/src/modal.js +++ b/packages/modal/src/modal.js @@ -44,6 +44,7 @@ export default { zIndex: Number, marginSize: { type: [Number, String], default: () => GlobalConfig.modal.marginSize }, fullscreen: Boolean, + draggable: { type: Boolean, default: () => GlobalConfig.modal.draggable }, remember: { type: Boolean, default: () => GlobalConfig.modal.remember }, destroyOnClose: { type: Boolean, default: () => GlobalConfig.modal.destroyOnClose }, showTitleOverflow: { type: Boolean, default: () => GlobalConfig.modal.showTitleOverflow }, @@ -115,14 +116,15 @@ export default { } }, render (h) { - const { _e, $scopedSlots, slots = {}, inited, vSize, className, type, resize, showClose, showZoom, animat, loading, status, iconStatus, showFooter, zoomLocat, modalTop, dblclickZoom, contentVisible, visible, title, lockScroll, lockView, mask, isMsg, showTitleOverflow, destroyOnClose } = this + const { _e, $scopedSlots, slots = {}, inited, vSize, className, type, resize, showClose, showZoom, animat, draggable, loading, status, iconStatus, showFooter, zoomLocat, modalTop, dblclickZoom, contentVisible, visible, title, lockScroll, lockView, mask, isMsg, showTitleOverflow, destroyOnClose } = this const content = this.content || this.message const defaultSlot = $scopedSlots.default || slots.default const footerSlot = $scopedSlots.footer || slots.footer const headerSlot = $scopedSlots.header || slots.header const titleSlot = $scopedSlots.title || slots.title - const headerOns = { - mousedown: this.mousedownEvent + const headerOns = {} + if (draggable) { + headerOns.mousedown = this.mousedownEvent } if (showZoom && dblclickZoom && type === 'modal') { headerOns.dblclick = this.toggleZoomEvent @@ -157,7 +159,10 @@ export default { ref: 'modalBox' }, [ this.showHeader ? h('div', { - class: ['vxe-modal--header', !isMsg && showTitleOverflow ? 'is--ellipsis' : ''], + class: ['vxe-modal--header', { + 'is--drag': draggable, + 'is--ellipsis': !isMsg && showTitleOverflow + }], on: headerOns }, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : headerSlot.call(this, { $modal: this }, h)) : [ titleSlot ? titleSlot.call(this, { $modal: this }, h) : h('span', { diff --git a/packages/v-x-e-table/src/conf.js b/packages/v-x-e-table/src/conf.js index 37d2ad8ce..3c6744280 100644 --- a/packages/v-x-e-table/src/conf.js +++ b/packages/v-x-e-table/src/conf.js @@ -308,6 +308,7 @@ export default { showTitleOverflow: true, animat: true, showClose: true, + draggable: true, // storage: false, storageKey: 'VXE_MODAL_POSITION' }, diff --git a/styles/modal.scss b/styles/modal.scss index 1dc4d4c21..fa972c013 100644 --- a/styles/modal.scss +++ b/styles/modal.scss @@ -141,9 +141,6 @@ left: 50%; top: 0; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2); - .vxe-modal--header { - cursor: move; - } } .vxe-modal--body { overflow: auto; @@ -249,6 +246,9 @@ background-color: $vxe-modal-header-background-color; border-radius: $vxe-border-radius $vxe-border-radius 0 0; user-select: none; + &.is--drag { + cursor: move; + } &.is--ellipsis { overflow: hidden; text-overflow: ellipsis;