Skip to content

Commit

Permalink
fix input 修复定位问题 #2383
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed May 9, 2024
1 parent a396faa commit 996a742
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/style/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ html,
body,
#app {
height: 100%;
overflow: hidden;
// overflow: auto;
}
#app {
display: flex;
Expand Down Expand Up @@ -216,7 +216,7 @@ body,
display: flex;
flex-grow: 1;
border-bottom: 1px solid #dcdfe6;
overflow: hidden;
// overflow: hidden;
> .aside {
position: relative;
display: flex;
Expand Down
4 changes: 4 additions & 0 deletions examples/views/input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
</vxe-input>
</p>

<p>
<vxe-input v-model="value603" placeholder="日期选择" type="date" transfer></vxe-input>
</p>

<pre>
<pre-code>
| Tab | 切换到上一个 |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
"version": "3.8.6-beta.0",
"version": "3.8.6-beta.1",
"description": "一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式...",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
2 changes: 2 additions & 0 deletions packages/all.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import XEUtils from 'xe-utils'
import { VXETable } from './v-x-e-table'
import { setTheme } from './v-x-e-table/src/theme'

import { Filter } from './filter'
import { Menu } from './menu'
Expand Down Expand Up @@ -84,6 +85,7 @@ const components = [
export function install (Vue, options) {
if (XEUtils.isPlainObject(options)) {
VXETable.config(options)
setTheme(options)
}
components.map(component => component.install(Vue))
}
Expand Down
15 changes: 14 additions & 1 deletion packages/custom/src/panel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import VXETable from '../../v-x-e-table'
import UtilTools from '../../tools/utils'
import DomTools from '../../tools/dom'
import GlobalConfig from '../../v-x-e-table/src/conf'
Expand Down Expand Up @@ -457,7 +458,19 @@ export default {
$xetable.emitCustomEvent('reset', evnt)
},
resetPopupCustomEvent (evnt) {
this.resetCustomEvent(evnt)
if (VXETable.modal) {
VXETable.modal.confirm({
content: GlobalConfig.i18n('vxe.custom.cstmConfirmRestore'),
className: 'vxe-table--ignore-clear',
escClosable: true
}).then(type => {
if (type === 'confirm') {
this.resetCustomEvent(evnt)
}
})
} else {
this.resetCustomEvent(evnt)
}
},
handleOptionCheck (column) {
const { $xetable } = this
Expand Down
1 change: 1 addition & 0 deletions packages/input/src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -1995,6 +1995,7 @@ export default {
}
const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = DomTools.getAbsolutePos(targetElem)
let panelPlacement = 'bottom'
console.log(DomTools.getAbsolutePos(targetElem))
if (transfer) {
let left = boundingLeft
let top = boundingTop + targetHeight
Expand Down
6 changes: 2 additions & 4 deletions packages/tools/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@ export const DomTools = {
return getNodeOffset(elem, container, { left: 0, top: 0 })
},
getAbsolutePos (elem) {
// 当主页面嵌套在iframe时,elem.getBoundingClientRect()仅计算在当前body内的边界距离,忽略了body所在的边界距离
const bodyBounding = document.body.getBoundingClientRect()
const bounding = elem.getBoundingClientRect()
const boundingTop = bounding.top - bodyBounding.top
const boundingLeft = bounding.left - bodyBounding.left
const boundingTop = bounding.top
const boundingLeft = bounding.left
const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
},
Expand Down
3 changes: 3 additions & 0 deletions packages/v-x-e-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { menus } from './src/menus'
import { formats } from './src/formats'
import { validators } from './src/validators'
import { config } from './src/config'
import { setTheme } from './src/theme'
import { UtilTools } from '../tools/utils'
import { errLog } from '../tools/log'

Expand Down Expand Up @@ -114,6 +115,8 @@ export const VXETable = {
globalConfs
}

setTheme(globalStore)

export * from './src/interceptor'
export * from './src/renderer'
export * from './src/commands'
Expand Down
8 changes: 6 additions & 2 deletions packages/v-x-e-table/src/config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import GlobalConfig from './conf'
import DomZIndex from 'dom-zindex'
import XEUtils from 'xe-utils'
import { setTheme } from './theme'

/**
* 全局参数设置
*/
export function config (options) {
if (options && options.zIndex) {
DomZIndex.setCurrent(options.zIndex)
if (options) {
setTheme(options)
if (options.zIndex) {
DomZIndex.setCurrent(options.zIndex)
}
}
return XEUtils.merge(GlobalConfig, options)
}
11 changes: 11 additions & 0 deletions packages/v-x-e-table/src/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import GlobalConfig from '../../v-x-e-table/src/conf'

export function setTheme (options) {
const theme = (options ? options.theme : null) || GlobalConfig.theme || 'default'
if (typeof document !== 'undefined') {
const documentElement = document.documentElement
if (documentElement) {
documentElement.setAttribute('data-vxe-table-theme', theme)
}
}
}
1 change: 1 addition & 0 deletions styles/export.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
outline: 0;
border-radius: $vxe-border-radius;
background-color: $vxe-input-background-color;
color: inherit;
user-select: none;
cursor: pointer;
&:focus {
Expand Down
8 changes: 8 additions & 0 deletions styles/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
border: 0;
}

.vxe-table--render-wrapper {
background-color: $vxe-table-body-background-color;
}
.vxe-table--body-wrapper {
scroll-behavior: auto;
}
Expand Down Expand Up @@ -610,6 +613,11 @@
user-select: none;
}
}
&.drag--range {
.vxe-cell--checkbox {
user-select: none;
}
}
.vxe-header--column,
.vxe-body--column,
.vxe-footer--column {
Expand Down

0 comments on commit 996a742

Please sign in to comment.