mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
优化重构
This commit is contained in:
@@ -13,4 +13,4 @@
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();</script><link href=/vxe-table/static/css/advanced.494c8a78.css rel=prefetch><link href=/vxe-table/static/css/api.3b477dc1.css rel=prefetch><link href=/vxe-table/static/css/base.66df2255.css rel=prefetch><link href=/vxe-table/static/css/edit.dc1a434e.css rel=prefetch><link href=/vxe-table/static/css/grid.ff4f2cc4.css rel=prefetch><link href=/vxe-table/static/css/module.300ea7d7.css rel=prefetch><link href=/vxe-table/static/css/other.68b39f76.css rel=prefetch><link href=/vxe-table/static/css/scroll.c0725010.css rel=prefetch><link href=/vxe-table/static/css/start.5d992dc3.css rel=prefetch><link href=/vxe-table/static/css/tree.5f6af821.css rel=prefetch><link href=/vxe-table/static/css/virtual-tree.da294a30.css rel=prefetch><link href=/vxe-table/static/js/advanced.d4b1f411.js rel=prefetch><link href=/vxe-table/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree~virtual-tree.9c6eb998.js rel=prefetch><link href=/vxe-table/static/js/api.cad62d48.js rel=prefetch><link href=/vxe-table/static/js/base.aa8ffc39.js rel=prefetch><link href=/vxe-table/static/js/edit.92f2655e.js rel=prefetch><link href=/vxe-table/static/js/excel.19038720.js rel=prefetch><link href=/vxe-table/static/js/grid.ed1fe325.js rel=prefetch><link href=/vxe-table/static/js/module.739bfbb9.js rel=prefetch><link href=/vxe-table/static/js/other.45a31678.js rel=prefetch><link href=/vxe-table/static/js/plugin.f6e10cf3.js rel=prefetch><link href=/vxe-table/static/js/scroll.b6d66f2b.js rel=prefetch><link href=/vxe-table/static/js/start.0e355a44.js rel=prefetch><link href=/vxe-table/static/js/tree.888e93fa.js rel=prefetch><link href=/vxe-table/static/js/virtual-tree.8db0a874.js rel=prefetch><link href=/vxe-table/static/css/chunk-vendors.a65ebb63.css rel=preload as=style><link href=/vxe-table/static/css/index.d76085b5.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.fb1983f6.js rel=preload as=script><link href=/vxe-table/static/js/index.bac8d494.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.a65ebb63.css rel=stylesheet><link href=/vxe-table/static/css/index.d76085b5.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/static/js/chunk-vendors.fb1983f6.js></script><script src=/vxe-table/static/js/index.bac8d494.js></script></body></html>
|
||||
})();</script><link href=/vxe-table/static/css/advanced.494c8a78.css rel=prefetch><link href=/vxe-table/static/css/api.3b477dc1.css rel=prefetch><link href=/vxe-table/static/css/base.66df2255.css rel=prefetch><link href=/vxe-table/static/css/edit.dc1a434e.css rel=prefetch><link href=/vxe-table/static/css/grid.ff4f2cc4.css rel=prefetch><link href=/vxe-table/static/css/module.300ea7d7.css rel=prefetch><link href=/vxe-table/static/css/other.68b39f76.css rel=prefetch><link href=/vxe-table/static/css/scroll.c0725010.css rel=prefetch><link href=/vxe-table/static/css/start.5d992dc3.css rel=prefetch><link href=/vxe-table/static/css/tree.5f6af821.css rel=prefetch><link href=/vxe-table/static/css/virtual-tree.da294a30.css rel=prefetch><link href=/vxe-table/static/js/advanced.adb0e19d.js rel=prefetch><link href=/vxe-table/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree~virtual-tree.9c6eb998.js rel=prefetch><link href=/vxe-table/static/js/api.ab823d24.js rel=prefetch><link href=/vxe-table/static/js/base.d9142ad6.js rel=prefetch><link href=/vxe-table/static/js/edit.4e1bb74e.js rel=prefetch><link href=/vxe-table/static/js/excel.5e96b9cd.js rel=prefetch><link href=/vxe-table/static/js/grid.21c72f38.js rel=prefetch><link href=/vxe-table/static/js/module.246d53d0.js rel=prefetch><link href=/vxe-table/static/js/other.14464401.js rel=prefetch><link href=/vxe-table/static/js/plugin.15bb617c.js rel=prefetch><link href=/vxe-table/static/js/scroll.99afdb52.js rel=prefetch><link href=/vxe-table/static/js/start.6f1e4be2.js rel=prefetch><link href=/vxe-table/static/js/tree.84b19356.js rel=prefetch><link href=/vxe-table/static/js/virtual-tree.9f15f417.js rel=prefetch><link href=/vxe-table/static/css/chunk-vendors.a65ebb63.css rel=preload as=style><link href=/vxe-table/static/css/index.d76085b5.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.88069f72.js rel=preload as=script><link href=/vxe-table/static/js/index.9b5262cf.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.a65ebb63.css rel=stylesheet><link href=/vxe-table/static/css/index.d76085b5.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/static/js/chunk-vendors.88069f72.js></script><script src=/vxe-table/static/js/index.9b5262cf.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -13,4 +13,4 @@
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();</script><link href=/vxe-table/v1/static/css/advanced.494c8a78.css rel=prefetch><link href=/vxe-table/v1/static/css/api.c7b35ffb.css rel=prefetch><link href=/vxe-table/v1/static/css/base.66df2255.css rel=prefetch><link href=/vxe-table/v1/static/css/edit.5ed65c61.css rel=prefetch><link href=/vxe-table/v1/static/css/grid.ff4f2cc4.css rel=prefetch><link href=/vxe-table/v1/static/css/module.300ea7d7.css rel=prefetch><link href=/vxe-table/v1/static/css/other.68b39f76.css rel=prefetch><link href=/vxe-table/v1/static/css/scroll.c0725010.css rel=prefetch><link href=/vxe-table/v1/static/css/start.5d992dc3.css rel=prefetch><link href=/vxe-table/v1/static/css/tree.5f6af821.css rel=prefetch><link href=/vxe-table/v1/static/css/virtual-tree.da294a30.css rel=prefetch><link href=/vxe-table/v1/static/js/advanced.ed3f922b.js rel=prefetch><link href=/vxe-table/v1/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree~virtual-tree.9c6eb998.js rel=prefetch><link href=/vxe-table/v1/static/js/api.48d81dcb.js rel=prefetch><link href=/vxe-table/v1/static/js/base.5b83cdd6.js rel=prefetch><link href=/vxe-table/v1/static/js/edit.d224367e.js rel=prefetch><link href=/vxe-table/v1/static/js/excel.b722bf23.js rel=prefetch><link href=/vxe-table/v1/static/js/grid.0d324c27.js rel=prefetch><link href=/vxe-table/v1/static/js/module.180103d2.js rel=prefetch><link href=/vxe-table/v1/static/js/other.00fead4e.js rel=prefetch><link href=/vxe-table/v1/static/js/plugin.7f37fbcf.js rel=prefetch><link href=/vxe-table/v1/static/js/scroll.5693e025.js rel=prefetch><link href=/vxe-table/v1/static/js/start.70cf6517.js rel=prefetch><link href=/vxe-table/v1/static/js/tree.8b552a40.js rel=prefetch><link href=/vxe-table/v1/static/js/virtual-tree.c7667df8.js rel=prefetch><link href=/vxe-table/v1/static/css/chunk-vendors.6232b7e0.css rel=preload as=style><link href=/vxe-table/v1/static/css/index.7c47b249.css rel=preload as=style><link href=/vxe-table/v1/static/js/chunk-vendors.223936f5.js rel=preload as=script><link href=/vxe-table/v1/static/js/index.57c461c1.js rel=preload as=script><link href=/vxe-table/v1/static/css/chunk-vendors.6232b7e0.css rel=stylesheet><link href=/vxe-table/v1/static/css/index.7c47b249.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v1/static/js/chunk-vendors.223936f5.js></script><script src=/vxe-table/v1/static/js/index.57c461c1.js></script></body></html>
|
||||
})();</script><link href=/vxe-table/v1/static/css/advanced.494c8a78.css rel=prefetch><link href=/vxe-table/v1/static/css/api.c7b35ffb.css rel=prefetch><link href=/vxe-table/v1/static/css/base.66df2255.css rel=prefetch><link href=/vxe-table/v1/static/css/edit.5ed65c61.css rel=prefetch><link href=/vxe-table/v1/static/css/grid.ff4f2cc4.css rel=prefetch><link href=/vxe-table/v1/static/css/module.300ea7d7.css rel=prefetch><link href=/vxe-table/v1/static/css/other.68b39f76.css rel=prefetch><link href=/vxe-table/v1/static/css/scroll.c0725010.css rel=prefetch><link href=/vxe-table/v1/static/css/start.5d992dc3.css rel=prefetch><link href=/vxe-table/v1/static/css/tree.5f6af821.css rel=prefetch><link href=/vxe-table/v1/static/css/virtual-tree.da294a30.css rel=prefetch><link href=/vxe-table/v1/static/js/advanced.ed3f922b.js rel=prefetch><link href=/vxe-table/v1/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree~virtual-tree.9c6eb998.js rel=prefetch><link href=/vxe-table/v1/static/js/api.661e9195.js rel=prefetch><link href=/vxe-table/v1/static/js/base.5b83cdd6.js rel=prefetch><link href=/vxe-table/v1/static/js/edit.d224367e.js rel=prefetch><link href=/vxe-table/v1/static/js/excel.b722bf23.js rel=prefetch><link href=/vxe-table/v1/static/js/grid.0d324c27.js rel=prefetch><link href=/vxe-table/v1/static/js/module.180103d2.js rel=prefetch><link href=/vxe-table/v1/static/js/other.00fead4e.js rel=prefetch><link href=/vxe-table/v1/static/js/plugin.7f37fbcf.js rel=prefetch><link href=/vxe-table/v1/static/js/scroll.5693e025.js rel=prefetch><link href=/vxe-table/v1/static/js/start.70cf6517.js rel=prefetch><link href=/vxe-table/v1/static/js/tree.8b552a40.js rel=prefetch><link href=/vxe-table/v1/static/js/virtual-tree.c7667df8.js rel=prefetch><link href=/vxe-table/v1/static/css/chunk-vendors.6232b7e0.css rel=preload as=style><link href=/vxe-table/v1/static/css/index.7c47b249.css rel=preload as=style><link href=/vxe-table/v1/static/js/chunk-vendors.223936f5.js rel=preload as=script><link href=/vxe-table/v1/static/js/index.2ef1b49f.js rel=preload as=script><link href=/vxe-table/v1/static/css/chunk-vendors.6232b7e0.css rel=stylesheet><link href=/vxe-table/v1/static/css/index.7c47b249.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v1/static/js/chunk-vendors.223936f5.js></script><script src=/vxe-table/v1/static/js/index.2ef1b49f.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -13,4 +13,4 @@
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
}
|
||||
})();</script><link href=/vxe-table/v2/static/css/advanced.494c8a78.css rel=prefetch><link href=/vxe-table/v2/static/css/api.c7b35ffb.css rel=prefetch><link href=/vxe-table/v2/static/css/base.66df2255.css rel=prefetch><link href=/vxe-table/v2/static/css/edit.dc1a434e.css rel=prefetch><link href=/vxe-table/v2/static/css/grid.ff4f2cc4.css rel=prefetch><link href=/vxe-table/v2/static/css/module.300ea7d7.css rel=prefetch><link href=/vxe-table/v2/static/css/other.68b39f76.css rel=prefetch><link href=/vxe-table/v2/static/css/scroll.c0725010.css rel=prefetch><link href=/vxe-table/v2/static/css/start.5d992dc3.css rel=prefetch><link href=/vxe-table/v2/static/css/tree.5f6af821.css rel=prefetch><link href=/vxe-table/v2/static/css/virtual-tree.da294a30.css rel=prefetch><link href=/vxe-table/v2/static/js/advanced.7e43657e.js rel=prefetch><link href=/vxe-table/v2/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree~virtual-tree.d9ecbab9.js rel=prefetch><link href=/vxe-table/v2/static/js/api.21391dfb.js rel=prefetch><link href=/vxe-table/v2/static/js/base.5cc81770.js rel=prefetch><link href=/vxe-table/v2/static/js/edit.ce14b9e2.js rel=prefetch><link href=/vxe-table/v2/static/js/excel.d650563b.js rel=prefetch><link href=/vxe-table/v2/static/js/grid.224fafa0.js rel=prefetch><link href=/vxe-table/v2/static/js/module.bd05d98a.js rel=prefetch><link href=/vxe-table/v2/static/js/other.0dc799ab.js rel=prefetch><link href=/vxe-table/v2/static/js/plugin.3b95ca80.js rel=prefetch><link href=/vxe-table/v2/static/js/scroll.7a495484.js rel=prefetch><link href=/vxe-table/v2/static/js/start.cd781c15.js rel=prefetch><link href=/vxe-table/v2/static/js/tree.e73ec058.js rel=prefetch><link href=/vxe-table/v2/static/js/virtual-tree.86824fd3.js rel=prefetch><link href=/vxe-table/v2/static/css/chunk-vendors.cea76c77.css rel=preload as=style><link href=/vxe-table/v2/static/css/index.83a21b05.css rel=preload as=style><link href=/vxe-table/v2/static/js/chunk-vendors.3fd62823.js rel=preload as=script><link href=/vxe-table/v2/static/js/index.ac3a7c59.js rel=preload as=script><link href=/vxe-table/v2/static/css/chunk-vendors.cea76c77.css rel=stylesheet><link href=/vxe-table/v2/static/css/index.83a21b05.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v2/static/js/chunk-vendors.3fd62823.js></script><script src=/vxe-table/v2/static/js/index.ac3a7c59.js></script></body></html>
|
||||
})();</script><link href=/vxe-table/v2/static/css/advanced.494c8a78.css rel=prefetch><link href=/vxe-table/v2/static/css/api.c7b35ffb.css rel=prefetch><link href=/vxe-table/v2/static/css/base.66df2255.css rel=prefetch><link href=/vxe-table/v2/static/css/edit.dc1a434e.css rel=prefetch><link href=/vxe-table/v2/static/css/grid.ff4f2cc4.css rel=prefetch><link href=/vxe-table/v2/static/css/module.300ea7d7.css rel=prefetch><link href=/vxe-table/v2/static/css/other.68b39f76.css rel=prefetch><link href=/vxe-table/v2/static/css/scroll.c0725010.css rel=prefetch><link href=/vxe-table/v2/static/css/start.5d992dc3.css rel=prefetch><link href=/vxe-table/v2/static/css/tree.5f6af821.css rel=prefetch><link href=/vxe-table/v2/static/css/virtual-tree.da294a30.css rel=prefetch><link href=/vxe-table/v2/static/js/advanced.7aaa974c.js rel=prefetch><link href=/vxe-table/v2/static/js/advanced~base~edit~excel~grid~module~other~plugin~scroll~start~tree~virtual-tree.d9ecbab9.js rel=prefetch><link href=/vxe-table/v2/static/js/api.d0ac64e0.js rel=prefetch><link href=/vxe-table/v2/static/js/base.9d691e0c.js rel=prefetch><link href=/vxe-table/v2/static/js/edit.45c24292.js rel=prefetch><link href=/vxe-table/v2/static/js/excel.5d46cceb.js rel=prefetch><link href=/vxe-table/v2/static/js/grid.92c69e90.js rel=prefetch><link href=/vxe-table/v2/static/js/module.f7df5e10.js rel=prefetch><link href=/vxe-table/v2/static/js/other.f56f8def.js rel=prefetch><link href=/vxe-table/v2/static/js/plugin.61cc0722.js rel=prefetch><link href=/vxe-table/v2/static/js/scroll.e53324e1.js rel=prefetch><link href=/vxe-table/v2/static/js/start.6933b1b0.js rel=prefetch><link href=/vxe-table/v2/static/js/tree.fd526878.js rel=prefetch><link href=/vxe-table/v2/static/js/virtual-tree.210ac55c.js rel=prefetch><link href=/vxe-table/v2/static/css/chunk-vendors.cea76c77.css rel=preload as=style><link href=/vxe-table/v2/static/css/index.83a21b05.css rel=preload as=style><link href=/vxe-table/v2/static/js/chunk-vendors.db2e11bc.js rel=preload as=script><link href=/vxe-table/v2/static/js/index.42999df9.js rel=preload as=script><link href=/vxe-table/v2/static/css/chunk-vendors.cea76c77.css rel=stylesheet><link href=/vxe-table/v2/static/css/index.83a21b05.css rel=stylesheet></head><body><noscript><strong>We're sorry but vxe-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/vxe-table/v2/static/js/chunk-vendors.db2e11bc.js></script><script src=/vxe-table/v2/static/js/index.42999df9.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -74,7 +74,7 @@
|
||||
"vxe-table-plugin-iview": "^1.8.7",
|
||||
"vxe-table-plugin-menus": "^1.3.3",
|
||||
"vxe-table-plugin-shortcut-key": "^1.2.6",
|
||||
"vxe-table-plugin-virtual-tree": "0.1.2",
|
||||
"vxe-table-plugin-virtual-tree": "0.1.4",
|
||||
"xe-ajax": "^4.0.3",
|
||||
"xe-ajax-mock": "^1.9.4",
|
||||
"xe-clipboard": "^1.7.2",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import XEUtils from 'xe-utils/methods/xe-utils'
|
||||
import GlobalConfig from '../../conf'
|
||||
import { DomTools } from '../../tools'
|
||||
|
||||
export default {
|
||||
name: 'VxeList',
|
||||
@@ -157,6 +158,7 @@ export default {
|
||||
if (XEUtils.isNumber(scrollTop)) {
|
||||
scrollBodyElem.scrollTop = scrollTop
|
||||
}
|
||||
DomTools.triggerEvent(scrollBodyElem, 'scroll')
|
||||
if (this.scrollYLoad) {
|
||||
return new Promise(resolve => setTimeout(() => resolve(this.$nextTick()), 50))
|
||||
}
|
||||
|
||||
@@ -306,31 +306,34 @@ export default {
|
||||
if (optionGroups || options) {
|
||||
const { optionProps = {}, optionGroupProps = {} } = this
|
||||
const disabledProp = optionProps.disabled || 'disabled'
|
||||
const labelProp = optionProps.label || 'label'
|
||||
const valueProp = optionProps.value || 'value'
|
||||
if (optionGroups) {
|
||||
const groupOptions = optionGroupProps.options || 'options'
|
||||
const groupLabel = optionGroupProps.label || 'label'
|
||||
const groupDisabled = optionGroupProps.disabled || 'disabled'
|
||||
optionGroups.forEach(group => {
|
||||
const optChilds = []
|
||||
const allOptChilds = []
|
||||
group[groupOptions].forEach(option => {
|
||||
const isDisabled = (group && group[groupDisabled]) || option[disabledProp]
|
||||
const item = { label: option.label, value: option.value, disabled: isDisabled, id: getOptid(this, option) }
|
||||
const item = { label: option[labelProp], value: option[valueProp], disabled: isDisabled, id: getOptid(this, option) }
|
||||
if (!isDisabled) {
|
||||
optChilds.push(item)
|
||||
}
|
||||
allOptChilds.push(item)
|
||||
})
|
||||
if (optChilds.length) {
|
||||
oList.push({ label: group.label, disabled: group[groupDisabled], options: optChilds, id: getOptid(this, group) })
|
||||
oList.push({ label: group[groupLabel], disabled: group[groupDisabled], options: optChilds, id: getOptid(this, group) })
|
||||
}
|
||||
if (allOptChilds.length) {
|
||||
allList.push({ label: group.label, disabled: group[groupDisabled], options: allOptChilds, id: getOptid(this, group) })
|
||||
allList.push({ label: group[groupLabel], disabled: group[groupDisabled], options: allOptChilds, id: getOptid(this, group) })
|
||||
}
|
||||
})
|
||||
} else {
|
||||
options.forEach(option => {
|
||||
const isDisabled = option[disabledProp]
|
||||
const item = { label: option.label, value: option.value, disabled: isDisabled, id: getOptid(this, option) }
|
||||
const item = { label: option[labelProp], value: option[valueProp], disabled: isDisabled, id: getOptid(this, option) }
|
||||
if (!isDisabled) {
|
||||
oList.push(item)
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ const Methods = {
|
||||
handleTableData (force) {
|
||||
const { scrollYLoad, scrollYStore } = this
|
||||
const fullData = force ? this.updateAfterFullData() : this.afterFullData
|
||||
this.tableData = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.startIndex + scrollYStore.renderSize) : fullData.slice(0)
|
||||
this.tableData = scrollYLoad ? fullData.slice(scrollYStore.startIndex, Math.max(scrollYStore.startIndex + scrollYStore.renderSize, 1)) : fullData.slice(0)
|
||||
return this.$nextTick()
|
||||
},
|
||||
/**
|
||||
@@ -3145,21 +3145,31 @@ const Methods = {
|
||||
* @param {Number} scrollTop 上距离
|
||||
*/
|
||||
scrollTo (scrollLeft, scrollTop) {
|
||||
const bodyElem = this.$refs.tableBody.$el
|
||||
const { $refs } = this
|
||||
const bodyElem = $refs.tableBody.$el
|
||||
let istriggerBody
|
||||
if (XEUtils.isNumber(scrollLeft)) {
|
||||
const tableFooter = this.$refs.tableFooter
|
||||
if (tableFooter) {
|
||||
tableFooter.$el.scrollLeft = scrollLeft
|
||||
const footerElem = $refs.tableFooter ? $refs.tableFooter.$el : null
|
||||
if (footerElem) {
|
||||
footerElem.scrollLeft = scrollLeft
|
||||
DomTools.triggerEvent(footerElem, 'scroll')
|
||||
} else {
|
||||
istriggerBody = true
|
||||
bodyElem.scrollLeft = scrollLeft
|
||||
}
|
||||
}
|
||||
if (XEUtils.isNumber(scrollTop)) {
|
||||
const rightBody = this.$refs.rightBody
|
||||
if (rightBody) {
|
||||
rightBody.$el.scrollTop = scrollTop
|
||||
const rightBodyElem = $refs.rightBody ? $refs.rightBody.$el : null
|
||||
if (rightBodyElem) {
|
||||
rightBodyElem.scrollTop = scrollTop
|
||||
DomTools.triggerEvent(rightBodyElem, 'scroll')
|
||||
} else {
|
||||
istriggerBody = true
|
||||
bodyElem.scrollTop = scrollTop
|
||||
}
|
||||
bodyElem.scrollTop = scrollTop
|
||||
}
|
||||
if (istriggerBody) {
|
||||
DomTools.triggerEvent(bodyElem, 'scroll')
|
||||
}
|
||||
if (this.scrollXLoad || this.scrollYLoad) {
|
||||
return new Promise(resolve => setTimeout(() => resolve(this.$nextTick()), 50))
|
||||
|
||||
@@ -171,6 +171,16 @@ export const DomTools = {
|
||||
elem[scrollIntoView]()
|
||||
}
|
||||
}
|
||||
},
|
||||
triggerEvent (targetElem, type) {
|
||||
let evnt
|
||||
if (typeof Event === 'function') {
|
||||
evnt = new Event(type)
|
||||
} else {
|
||||
evnt = document.createEvent('Event')
|
||||
evnt.initEvent(type, true, true)
|
||||
}
|
||||
targetElem.dispatchEvent(evnt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -213,8 +213,9 @@ function renderNativeOptgroups (h, renderOpts, params, renderOptionsMethods) {
|
||||
const { optionGroups, optionGroupProps = {} } = renderOpts
|
||||
const groupOptions = optionGroupProps.options || 'options'
|
||||
const groupLabel = optionGroupProps.label || 'label'
|
||||
return optionGroups.map(group => {
|
||||
return optionGroups.map((group, gIndex) => {
|
||||
return h('optgroup', {
|
||||
key: gIndex,
|
||||
domProps: {
|
||||
label: group[groupLabel]
|
||||
}
|
||||
@@ -222,19 +223,6 @@ function renderNativeOptgroups (h, renderOpts, params, renderOptionsMethods) {
|
||||
})
|
||||
}
|
||||
|
||||
function renderDefaultOptgroups (h, renderOpts, params, renderOptionsMethods) {
|
||||
const { optionGroups, optionGroupProps = {} } = renderOpts
|
||||
const groupOptions = optionGroupProps.options || 'options'
|
||||
const groupLabel = optionGroupProps.label || 'label'
|
||||
return optionGroups.map(group => {
|
||||
return h('vxe-optgroup', {
|
||||
props: {
|
||||
label: group[groupLabel]
|
||||
}
|
||||
}, renderOptionsMethods(h, group[groupOptions], renderOpts, params))
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染原生的 option 标签
|
||||
*/
|
||||
@@ -245,37 +233,18 @@ function renderNativeOptions (h, options, renderOpts, params) {
|
||||
const valueProp = optionProps.value || 'value'
|
||||
const disabledProp = optionProps.disabled || 'disabled'
|
||||
const cellValue = isSyncCell(renderOpts, params) ? UtilTools.getCellValue(row, column) : column.model.value
|
||||
return options.map(item => {
|
||||
return options.map((option, oIndex) => {
|
||||
return h('option', {
|
||||
key: oIndex,
|
||||
attrs: {
|
||||
value: item[valueProp],
|
||||
disabled: item[disabledProp]
|
||||
value: option[valueProp],
|
||||
disabled: option[disabledProp]
|
||||
},
|
||||
domProps: {
|
||||
/* eslint-disable eqeqeq */
|
||||
selected: item[valueProp] == cellValue
|
||||
selected: option[valueProp] == cellValue
|
||||
}
|
||||
}, item[labelProp])
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染内置组件的下拉选项
|
||||
*/
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
function renderDefaultOptions (h, options, renderOpts, params) {
|
||||
const { optionProps = {} } = renderOpts
|
||||
const labelProp = optionProps.label || 'label'
|
||||
const valueProp = optionProps.value || 'value'
|
||||
const disabledProp = optionProps.disabled || 'disabled'
|
||||
return options.map(item => {
|
||||
return h('vxe-option', {
|
||||
props: {
|
||||
value: item[valueProp],
|
||||
label: item[labelProp],
|
||||
disabled: item[disabledProp]
|
||||
}
|
||||
})
|
||||
}, option[labelProp])
|
||||
})
|
||||
}
|
||||
|
||||
@@ -283,8 +252,9 @@ function nativeFilterRender (h, renderOpts, params) {
|
||||
const { column } = params
|
||||
const { name } = renderOpts
|
||||
const attrs = getNativeAttrs(renderOpts)
|
||||
return column.filters.map(option => {
|
||||
return column.filters.map((option, oIndex) => {
|
||||
return h(name, {
|
||||
key: oIndex,
|
||||
class: `vxe-default-${name}`,
|
||||
attrs,
|
||||
domProps: {
|
||||
@@ -297,9 +267,10 @@ function nativeFilterRender (h, renderOpts, params) {
|
||||
|
||||
function defaultFilterRender (h, renderOpts, params) {
|
||||
const { column } = params
|
||||
return column.filters.map(option => {
|
||||
return column.filters.map((option, oIndex) => {
|
||||
const optionValue = option.data
|
||||
return h(getDefaultComponentName(renderOpts), {
|
||||
key: oIndex,
|
||||
props: getCellEditFilterProps(renderOpts, renderOpts, optionValue),
|
||||
on: getFilterOns(renderOpts, params, option)
|
||||
})
|
||||
@@ -326,13 +297,13 @@ function nativeSelectEditRender (h, renderOpts, params) {
|
||||
|
||||
function defaultSelectEditRender (h, renderOpts, params) {
|
||||
const { row, column } = params
|
||||
const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
|
||||
const cellValue = UtilTools.getCellValue(row, column)
|
||||
return [
|
||||
h(getDefaultComponentName(renderOpts), {
|
||||
props: getCellEditFilterProps(renderOpts, params, cellValue),
|
||||
props: getCellEditFilterProps(renderOpts, params, cellValue, { options, optionProps, optionGroups, optionGroupProps }),
|
||||
on: getEditOns(renderOpts, params)
|
||||
},
|
||||
renderOpts.optionGroups ? renderDefaultOptgroups(h, renderOpts, params, renderDefaultOptions) : renderDefaultOptions(h, renderOpts.options, renderOpts, params))
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
@@ -413,8 +384,9 @@ function renderNativeFormOptions (h, options, renderOpts, params) {
|
||||
const valueProp = optionProps.value || 'value'
|
||||
const disabledProp = optionProps.disabled || 'disabled'
|
||||
const cellValue = XEUtils.get(data, property)
|
||||
return options.map((item, index) => {
|
||||
return options.map((item, oIndex) => {
|
||||
return h('option', {
|
||||
key: oIndex,
|
||||
attrs: {
|
||||
value: item[valueProp],
|
||||
disabled: item[disabledProp]
|
||||
@@ -422,8 +394,7 @@ function renderNativeFormOptions (h, options, renderOpts, params) {
|
||||
domProps: {
|
||||
/* eslint-disable eqeqeq */
|
||||
selected: item[valueProp] == cellValue
|
||||
},
|
||||
key: index
|
||||
}
|
||||
}, item[labelProp])
|
||||
})
|
||||
}
|
||||
@@ -451,12 +422,13 @@ function defaultFormItemRadioAndCheckboxRender (h, renderOpts, params) {
|
||||
h(`${name}-group`, {
|
||||
props: getItemProps(renderOpts, params, itemValue),
|
||||
on: getItemOns(renderOpts, params)
|
||||
}, options.map(option => {
|
||||
}, options.map((item, index) => {
|
||||
return h(name, {
|
||||
key: index,
|
||||
props: {
|
||||
label: option[valueProp],
|
||||
content: option[labelProp],
|
||||
disabled: option[disabledProp]
|
||||
label: item[valueProp],
|
||||
content: item[labelProp],
|
||||
disabled: item[disabledProp]
|
||||
}
|
||||
})
|
||||
}))
|
||||
@@ -488,8 +460,9 @@ const renderMap = {
|
||||
},
|
||||
renderFilter (h, renderOpts, params) {
|
||||
const { column } = params
|
||||
return column.filters.map(option => {
|
||||
return column.filters.map((option, oIndex) => {
|
||||
return h('select', {
|
||||
key: oIndex,
|
||||
class: 'vxe-default-select',
|
||||
attrs: getNativeAttrs(renderOpts),
|
||||
on: getNativeFilterOns(renderOpts, params, option)
|
||||
@@ -559,25 +532,26 @@ const renderMap = {
|
||||
},
|
||||
renderFilter (h, renderOpts, params) {
|
||||
const { column } = params
|
||||
return column.filters.map(option => {
|
||||
const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
|
||||
return column.filters.map((option, oIndex) => {
|
||||
const optionValue = option.data
|
||||
return h(getDefaultComponentName(renderOpts), {
|
||||
props: getCellEditFilterProps(renderOpts, params, optionValue),
|
||||
key: oIndex,
|
||||
props: getCellEditFilterProps(renderOpts, params, optionValue, { options, optionProps, optionGroups, optionGroupProps }),
|
||||
on: getFilterOns(renderOpts, params, option)
|
||||
},
|
||||
renderOpts.optionGroups ? renderDefaultOptgroups(h, renderOpts, params, renderDefaultOptions) : renderDefaultOptions(h, renderOpts.options, renderOpts, params))
|
||||
})
|
||||
})
|
||||
},
|
||||
filterMethod: handleFilterMethod,
|
||||
renderItem (h, renderOpts, params) {
|
||||
const { data, property } = params
|
||||
const { options, optionProps, optionGroups, optionGroupProps } = renderOpts
|
||||
const itemValue = XEUtils.get(data, property)
|
||||
return [
|
||||
h(getDefaultComponentName(renderOpts), {
|
||||
props: getItemProps(renderOpts, params, itemValue),
|
||||
props: getItemProps(renderOpts, params, itemValue, { options, optionProps, optionGroups, optionGroupProps }),
|
||||
on: getItemOns(renderOpts, params)
|
||||
},
|
||||
renderOpts.optionGroups ? renderDefaultOptgroups(h, renderOpts, params, renderDefaultOptions) : renderDefaultOptions(h, renderOpts.options, renderOpts, params))
|
||||
})
|
||||
]
|
||||
},
|
||||
editCellExportMethod: createExportMethod(getSelectCellValue, true),
|
||||
|
||||
Reference in New Issue
Block a user