diff --git a/README.en.md b/README.en.md
index d51de0fac..d8dfbd138 100644
--- a/README.en.md
+++ b/README.en.md
@@ -82,7 +82,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
## Installing
-Dependent: [vue](https://www.npmjs.com/package/vue) 2.6.x, [xe-utils](https://www.npmjs.com/package/xe-utils) 3.x
+Version:[vue](https://www.npmjs.com/package/vue) 2.6.x, Dependent: [xe-utils](https://www.npmjs.com/package/xe-utils) 3.x
```shell
npm install xe-utils vxe-table
diff --git a/README.md b/README.md
index 6582cc476..ddfac39bf 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
## 安装
-依赖库:[vue](https://www.npmjs.com/package/vue) 2.6.x, [xe-utils](https://www.npmjs.com/package/xe-utils) 3.x
+版本:[vue](https://www.npmjs.com/package/vue) 2.6.x, 依赖库:[xe-utils](https://www.npmjs.com/package/xe-utils) 3.x
```shell
npm install xe-utils vxe-table
diff --git a/README.zh-TW.md b/README.zh-TW.md
index 41f7d3fd5..4093a1b92 100644
--- a/README.zh-TW.md
+++ b/README.zh-TW.md
@@ -82,7 +82,7 @@ Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
## 安裝
-依賴庫:[vue](https://www.npmjs.com/package/vue) 2.6.x, [xe-utils](https://www.npmjs.com/package/xe-utils) 3.x
+版本:[vue](https://www.npmjs.com/package/vue) 2.6.x, 依賴庫:[xe-utils](https://www.npmjs.com/package/xe-utils) 3.x
```shell
npm install xe-utils vxe-table
diff --git a/examples/App.vue b/examples/App.vue
index 72947d292..152491ac8 100644
--- a/examples/App.vue
+++ b/examples/App.vue
@@ -1991,6 +1991,15 @@ export default {
}
}
},
+ {
+ label: 'app.aside.nav.vxeTableColgroup',
+ locat: {
+ name: 'VXEAPI',
+ params: {
+ name: 'table-colgroup'
+ }
+ }
+ },
{
label: 'app.aside.nav.vxeTableColumn',
locat: {
diff --git a/examples/api/table-colgroup.js b/examples/api/table-colgroup.js
new file mode 100644
index 000000000..50cf52ad0
--- /dev/null
+++ b/examples/api/table-colgroup.js
@@ -0,0 +1,56 @@
+import XEUtils from 'xe-utils'
+import columnAPI from './column'
+
+const apis = [
+ {
+ name: 'Props',
+ descKey: 'app.api.title.props',
+ version: '',
+ type: '',
+ enum: '',
+ defVal: '',
+ list: XEUtils.clone(columnAPI.find(item => item.name === 'Props'), true).list.filter(item => [
+ 'field',
+ 'title',
+ 'width',
+ 'min-width',
+ 'resizable',
+ 'visible',
+ 'fixed',
+ 'align',
+ 'header-align',
+ 'show-overflow',
+ 'show-header-overflow',
+ 'header-class-name'
+ ].includes(item.name))
+ },
+ {
+ name: 'Slots',
+ descKey: 'app.api.title.slots',
+ version: '',
+ type: '',
+ enum: '',
+ defVal: '',
+ list: []
+ },
+ {
+ name: 'Events',
+ descKey: 'app.api.title.events',
+ version: '',
+ type: '',
+ enum: '',
+ defVal: '',
+ list: []
+ },
+ {
+ name: 'Methods',
+ descKey: 'app.api.title.methods',
+ version: '',
+ type: '',
+ enum: '',
+ defVal: '',
+ list: []
+ }
+]
+
+export default apis
diff --git a/examples/assets/style/layout.scss b/examples/assets/style/layout.scss
index 300ccf096..0e31b1dcf 100644
--- a/examples/assets/style/layout.scss
+++ b/examples/assets/style/layout.scss
@@ -10,6 +10,7 @@ body {
}
ul {
list-style: none;
+ padding: 0;
}
.link {
cursor: pointer;
diff --git a/examples/i18n/lang/en-US.js b/examples/i18n/lang/en-US.js
index 857fc28ba..fffe00762 100644
--- a/examples/i18n/lang/en-US.js
+++ b/examples/i18n/lang/en-US.js
@@ -235,6 +235,7 @@ export default {
api: 'API',
vxeTable: 'vxe-table',
+ vxeTableColgroup: 'vxe-table-colgroup',
vxeTableColumn: 'vxe-table-column',
vxeGrid: 'vxe-grid',
vxeVirtualTree: 'vxe-virtual-tree',
diff --git a/examples/i18n/lang/zh-CN.js b/examples/i18n/lang/zh-CN.js
index 634c96b43..c55d4d5d6 100644
--- a/examples/i18n/lang/zh-CN.js
+++ b/examples/i18n/lang/zh-CN.js
@@ -234,6 +234,7 @@ export default {
api: 'API',
vxeTable: 'vxe-table',
+ vxeTableColgroup: 'vxe-table-colgroup',
vxeTableColumn: 'vxe-table-column',
vxeGrid: 'vxe-grid',
vxeVirtualTree: 'vxe-virtual-tree',
diff --git a/examples/i18n/lang/zh-TC.js b/examples/i18n/lang/zh-TC.js
index 8a44d4187..4e472a842 100644
--- a/examples/i18n/lang/zh-TC.js
+++ b/examples/i18n/lang/zh-TC.js
@@ -234,6 +234,7 @@ export default {
api: 'API',
vxeTable: 'vxe-table',
+ vxeTableColgroup: 'vxe-table-colgroup',
vxeTableColumn: 'vxe-table-column',
vxeGrid: 'vxe-grid',
vxeVirtualTree: 'vxe-virtual-tree',
diff --git a/examples/plugins/xtable/renderer/components/FilterContent.vue b/examples/plugins/xtable/renderer/components/FilterContent.vue
index 974c1d1a8..2a4361873 100644
--- a/examples/plugins/xtable/renderer/components/FilterContent.vue
+++ b/examples/plugins/xtable/renderer/components/FilterContent.vue
@@ -116,6 +116,8 @@ export default {
}
.my-filter-content .my-fc-search-list {
margin: 0;
+ padding: 0;
+ list-style: none;
}
.my-filter-content .my-fc-search-list-body {
overflow: auto;
diff --git a/examples/plugins/xtable/renderer/components/FilterExcel.vue b/examples/plugins/xtable/renderer/components/FilterExcel.vue
index a38bdea01..0dabdcdd9 100644
--- a/examples/plugins/xtable/renderer/components/FilterExcel.vue
+++ b/examples/plugins/xtable/renderer/components/FilterExcel.vue
@@ -52,7 +52,6 @@
diff --git a/examples/plugins/xtable/renderer/toolbar.js b/examples/plugins/xtable/renderer/toolbar.js
index 5c54f8b41..2b8134c00 100644
--- a/examples/plugins/xtable/renderer/toolbar.js
+++ b/examples/plugins/xtable/renderer/toolbar.js
@@ -1,10 +1,5 @@
-import Vue from 'vue'
import VXETable from '../../../../packages/v-x-e-table'
-import ToolbarInput from './components/ToolbarInput.vue'
-
-Vue.component(ToolbarInput.name, ToolbarInput)
-
// 创建一个简单的工具栏-按钮渲染
VXETable.renderer.add('ToolbarButtonRefresh', {
renderButton (h, renderOpts, params) {
diff --git a/examples/views/api/API.vue b/examples/views/api/API.vue
index 60fda542a..66673c2dd 100644
--- a/examples/views/api/API.vue
+++ b/examples/views/api/API.vue
@@ -63,6 +63,7 @@ import XEUtils from 'xe-utils'
import pack from '../../../package.json'
import XEClipboard from 'xe-clipboard'
import tableAPI from '../../api/table'
+import tableColgroupAPI from '../../api/table-colgroup'
import tableColumnAPI from '../../api/column'
import toolbarAPI from '../../api/toolbar'
import gridAPI from '../../api/grid'
@@ -88,48 +89,49 @@ import switchAPI from '../../api/switch'
import listAPI from '../../api/list'
import pulldownAPI from '../../api/pulldown'
-// import i18n from '../../i18n'
-// const attributes = window.attributes = {}
-// const tags = window.tags = {}
+import i18n from '../../i18n'
+const attributes = window.attributes = {}
+const tags = window.tags = {}
-// const tagMaps = [
-// ['vxe-table', tableAPI, { subtags: ['vxe-table-column'], description: '基础表格' }],
-// ['vxe-table-column', tableColumnAPI, { description: '基础表格 - 列' }],
-// ['vxe-grid', gridAPI, { description: '高级表格' }],
-// ['vxe-toolbar', toolbarAPI, { description: '工具栏' }],
-// ['vxe-pager', pagerAPI, { description: '分页' }],
-// ['vxe-radio', radioAPI, { description: '单选框' }],
-// ['vxe-radio-group', radioGroupAPI, { description: '单选组' }],
-// ['vxe-radio-button', radioButtonAPI, { description: '单选按钮' }],
-// ['vxe-checkbox', checkboxAPI, { description: '复选框' }],
-// ['vxe-checkbox-group', checkboxGroupAPI, { description: '复选组' }],
-// ['vxe-switch', switchAPI, { description: '开关按钮' }],
-// ['vxe-input', inputAPI, { description: '输入框' }],
-// ['vxe-select', selectAPI, { subtags: ['vxe-optgroup', 'vxe-option'], description: '下拉框' }],
-// ['vxe-optgroup', optgroupAPI, { subtags: ['vxe-option'], description: '下拉框 - 分组' }],
-// ['vxe-option', optionAPI, { description: '下拉框 - 选项' }],
-// ['vxe-button', buttonAPI, { description: '按钮' }],
-// ['vxe-tooltip', tooltipAPI, { description: '工具提示' }],
-// ['vxe-modal', modalAPI, { description: '模态窗口' }],
-// ['vxe-form', formAPI, { subtags: ['vxe-form-item'], description: '表单' }],
-// ['vxe-form-item', formItemAPI, { description: '表单 - 项' }],
-// ['vxe-list', listAPI, { description: '列表' }],
-// ['vxe-pulldown', pulldownAPI, { description: '下拉容器' }]
-// ]
+const tagMaps = [
+ ['vxe-table', tableAPI, { subtags: ['vxe-table-column'], description: '基础表格' }],
+ ['vxe-table-colgroup', tableColgroupAPI, { description: '基础表格 - 分组列' }],
+ ['vxe-table-column', tableColumnAPI, { description: '基础表格 - 列' }],
+ ['vxe-grid', gridAPI, { description: '高级表格' }],
+ ['vxe-toolbar', toolbarAPI, { description: '工具栏' }],
+ ['vxe-pager', pagerAPI, { description: '分页' }],
+ ['vxe-radio', radioAPI, { description: '单选框' }],
+ ['vxe-radio-group', radioGroupAPI, { description: '单选组' }],
+ ['vxe-radio-button', radioButtonAPI, { description: '单选按钮' }],
+ ['vxe-checkbox', checkboxAPI, { description: '复选框' }],
+ ['vxe-checkbox-group', checkboxGroupAPI, { description: '复选组' }],
+ ['vxe-switch', switchAPI, { description: '开关按钮' }],
+ ['vxe-input', inputAPI, { description: '输入框' }],
+ ['vxe-select', selectAPI, { subtags: ['vxe-optgroup', 'vxe-option'], description: '下拉框' }],
+ ['vxe-optgroup', optgroupAPI, { subtags: ['vxe-option'], description: '下拉框 - 分组' }],
+ ['vxe-option', optionAPI, { description: '下拉框 - 选项' }],
+ ['vxe-button', buttonAPI, { description: '按钮' }],
+ ['vxe-tooltip', tooltipAPI, { description: '工具提示' }],
+ ['vxe-modal', modalAPI, { description: '模态窗口' }],
+ ['vxe-form', formAPI, { subtags: ['vxe-form-item'], description: '表单' }],
+ ['vxe-form-item', formItemAPI, { description: '表单 - 项' }],
+ ['vxe-list', listAPI, { description: '列表' }],
+ ['vxe-pulldown', pulldownAPI, { description: '下拉容器' }]
+]
-// tagMaps.forEach(confs => {
-// const props = confs[1].find(item => item.name === 'Props').list
-// const keys = []
-// props.forEach(item => {
-// const name = XEUtils.kebabCase(item.name)
-// attributes[`${confs[0]}/${name}`] = {
-// type: XEUtils.toString(item.type).toLowerCase(),
-// description: item.descKey ? i18n.t(item.descKey) : item.desc
-// }
-// keys.push(name)
-// })
-// tags[confs[0]] = Object.assign({ attributes: keys }, confs[2])
-// })
+tagMaps.forEach(confs => {
+ const props = confs[1].find(item => item.name === 'Props').list
+ const keys = []
+ props.forEach(item => {
+ const name = XEUtils.kebabCase(item.name)
+ attributes[`${confs[0]}/${name}`] = {
+ type: XEUtils.toString(item.type).toLowerCase(),
+ description: item.descKey ? i18n.t(item.descKey) : item.desc
+ }
+ keys.push(name)
+ })
+ tags[confs[0]] = Object.assign({ attributes: keys }, confs[2])
+})
export default {
data () {
@@ -232,6 +234,9 @@ export default {
case 'table':
apis = tableAPI
break
+ case 'table-colgroup':
+ apis = tableColgroupAPI
+ break
case 'table-column':
apis = tableColumnAPI
break
diff --git a/examples/views/table/advanced/Custom.vue b/examples/views/table/advanced/Custom.vue
index c0052833e..3e2592fb4 100644
--- a/examples/views/table/advanced/Custom.vue
+++ b/examples/views/table/advanced/Custom.vue
@@ -78,14 +78,14 @@
-
+
-
+
-
-
+
+
{{ $t('app.body.button.showCode') }}
@@ -266,14 +266,14 @@ export default {
-
+
-
+
-
-
+
+
`,
`
diff --git a/examples/views/table/advanced/Footer.vue b/examples/views/table/advanced/Footer.vue
index 92763a2d6..37c4e0ba5 100644
--- a/examples/views/table/advanced/Footer.vue
+++ b/examples/views/table/advanced/Footer.vue
@@ -73,10 +73,10 @@
:footer-cell-class-name="footerCellClassName3"
:data="tableData">
-
+
-
+
@@ -263,10 +263,10 @@ export default {
:footer-cell-class-name="footerCellClassName3"
:data="tableData">
-
+
-
+
diff --git a/examples/views/table/advanced/MergeCell.vue b/examples/views/table/advanced/MergeCell.vue
index 108f249a8..735dbbe0e 100644
--- a/examples/views/table/advanced/MergeCell.vue
+++ b/examples/views/table/advanced/MergeCell.vue
@@ -18,53 +18,53 @@
:footer-method="footerMethod"
:data="tableData">
-
+
-
-
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
+
+
{{ $t('app.body.button.showCode') }}
@@ -156,53 +156,53 @@ export default {
:footer-method="footerMethod"
:data="tableData">
-
+
-
-
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
+
+
`,
`
diff --git a/examples/views/table/advanced/Toolbar.vue b/examples/views/table/advanced/Toolbar.vue
index 09107c1e1..ba840979a 100644
--- a/examples/views/table/advanced/Toolbar.vue
+++ b/examples/views/table/advanced/Toolbar.vue
@@ -13,17 +13,17 @@
height="300"
:data="tableData1">
-
-
+
+
-
+
-
+
-
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -103,17 +103,17 @@ export default {
height="300"
:data="tableData1">
-
-
+
+
-
+
-
+
-
+
-
+
`,
`
diff --git a/examples/views/table/base/Data.vue b/examples/views/table/base/Data.vue
index 1cfcf9735..51e525f52 100644
--- a/examples/views/table/base/Data.vue
+++ b/examples/views/table/base/Data.vue
@@ -70,14 +70,14 @@ export default {
{ name: 'Test2', age: 28, sex: '男', role: '后端', content: '
' },
{ name: 'Test4', age: 26, sex: '男', role: '前端', content: '我是链接' },
{ name: 'Test3', age: 20, sex: '女', role: '程序员鼓励师', content: '
' },
- { name: 'Test1', age: 22, sex: '女', role: '设计师', content: '在线观看.avi
' }
+ { name: 'Test1', age: 22, sex: '女', role: '设计师', content: '我是 Htmp 片段
' }
],
tableData2: [
{
userInfo: { name: 'Test1', age: 22 },
other: [
{ sex: '女' },
- { more: { content: '在线观看.avi
' } }
+ { more: { content: '我是 Htmp 片段
' } }
],
role: '设计师'
},
@@ -109,7 +109,7 @@ export default {
tableData3: [
[101, 'Test4', '男', 26, '我是链接', '前端'],
[102, 'Test2', '男', 28, '
', '后端'],
- [103, 'Test1', '女', 22, '在线观看.avi
', '设计师'],
+ [103, 'Test1', '女', 22, '我是 Htmp 片段
', '设计师'],
[104, 'Test3', '女', 20, '
', '程序员鼓励师']
],
demoCodes: [
@@ -132,7 +132,7 @@ export default {
{ name: 'Test2', age: 28, sex: '男', role: '后端', content: '
' },
{ name: 'Test4', age: 26, sex: '男', role: '前端', content: '我是链接' },
{ name: 'Test3', age: 20, sex: '女', role: '程序员鼓励师', content: '
' },
- { name: 'Test1', age: 22, sex: '女', role: '设计师', content: '在线观看.avi
' }
+ { name: 'Test1', age: 22, sex: '女', role: '设计师', content: '我是 Htmp 片段
' }
]
}
}
@@ -158,7 +158,7 @@ export default {
userInfo: { name: 'Test1', age: 22 },
other: [
{ sex: '女' },
- { more: { content: '在线观看.avi
' } }
+ { more: { content: '我是 Htmp 片段
' } }
],
role: '设计师'
},
@@ -210,7 +210,7 @@ export default {
tableData: [
[101, 'Test4', '男', 26, '我是链接', '前端'],
[102, 'Test2', '男', 28, '
', '后端'],
- [103, 'Test1', '女', 22, '在线观看.avi
', '设计师'],
+ [103, 'Test1', '女', 22, '我是 Htmp 片段
', '设计师'],
[104, 'Test3', '女', 20, '
', '程序员鼓励师']
]
}
diff --git a/examples/views/table/base/Filter.vue b/examples/views/table/base/Filter.vue
index fdcb1083a..3e423e3c2 100644
--- a/examples/views/table/base/Filter.vue
+++ b/examples/views/table/base/Filter.vue
@@ -39,19 +39,19 @@
highlight-hover-row
:data="tableData">
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -121,19 +121,19 @@ export default {
highlight-hover-row
:data="tableData">
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
`,
diff --git a/examples/views/table/base/FixedFull.vue b/examples/views/table/base/FixedFull.vue
index b798ced84..29c7b6a75 100644
--- a/examples/views/table/base/FixedFull.vue
+++ b/examples/views/table/base/FixedFull.vue
@@ -74,22 +74,22 @@
border
height="400"
:data="tableData">
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -170,22 +170,24 @@ export default {
-
-
-
-
-
-
-
- 按钮1
- 按钮2
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`,
`
diff --git a/examples/views/table/base/Group.vue b/examples/views/table/base/Group.vue
index 8e31dbdd8..121f4ca30 100644
--- a/examples/views/table/base/Group.vue
+++ b/examples/views/table/base/Group.vue
@@ -6,20 +6,20 @@
border
height="400"
:data="tableData">
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
@@ -46,28 +46,28 @@
ref="xTable"
height="400"
:data="tableData">
-
+
-
-
+
+
-
-
+
+
-
+
-
-
-
+
+
+
-
-
+
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -102,20 +102,20 @@ export default {
border
height="400"
:data="tableData">
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
`,
@@ -152,28 +152,28 @@ export default {
ref="xTable"
height="400"
:data="tableData">
-
+
-
-
+
+
-
-
+
+
-
+
-
-
-
+
+
+
-
-
+
+
-
+
`,
`
diff --git a/examples/views/table/base/Overflow.vue b/examples/views/table/base/Overflow.vue
index 2699ac167..af8c7a3e7 100644
--- a/examples/views/table/base/Overflow.vue
+++ b/examples/views/table/base/Overflow.vue
@@ -48,16 +48,16 @@
-
-
+
+
标题溢出显示原生 title xxxxxxxxxxxxxxxxxxxxxxxxxxx
-
-
+
+
-
-
+
+
{{ $t('app.body.button.showCode') }}
@@ -155,16 +155,16 @@ export default {
-
-
+
+
标题溢出显示原生 title xxxxxxxxxxxxxxxxxxxxxxxxxxx
-
-
+
+
-
-
+
+
`,
`
diff --git a/examples/views/table/base/Resizable.vue b/examples/views/table/base/Resizable.vue
index 14b3874ac..c12be355e 100644
--- a/examples/views/table/base/Resizable.vue
+++ b/examples/views/table/base/Resizable.vue
@@ -126,18 +126,18 @@
border
resizable
:data="tableData">
-
+
-
-
+
+
-
+
-
-
+
+
@@ -154,22 +154,22 @@
border
resizable
:data="tableData">
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -373,18 +373,18 @@ export default {
border
resizable
:data="tableData">
-
+
-
-
+
+
-
+
-
-
+
+
`,
@@ -411,22 +411,22 @@ export default {
border
resizable
:data="tableData">
-
+
-
-
+
+
-
+
-
-
-
+
+
+
-
+
`,
`
diff --git a/examples/views/table/edit/CellDisable.vue b/examples/views/table/edit/CellDisable.vue
index 0fb9eeb83..62c8896a7 100644
--- a/examples/views/table/edit/CellDisable.vue
+++ b/examples/views/table/edit/CellDisable.vue
@@ -34,10 +34,10 @@
@edit-actived="editActivedEvent">
-
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -114,10 +114,10 @@ export default {
@edit-actived="editActivedEvent">
-
+
-
+
`,
`
diff --git a/examples/views/table/edit/CellValid.vue b/examples/views/table/edit/CellValid.vue
index 16f8a78a4..d4b99e3a9 100644
--- a/examples/views/table/edit/CellValid.vue
+++ b/examples/views/table/edit/CellValid.vue
@@ -31,17 +31,17 @@
:edit-config="{trigger: 'click', mode: 'cell', showStatus: true}">
-
+
-
-
-
+
+
+
-
-
+
+
{{ $t('app.body.button.showCode') }}
@@ -121,17 +121,17 @@ export default {
:edit-config="{trigger: 'click', mode: 'cell', showStatus: true}">
-
+
-
-
-
+
+
+
-
-
+
+
`,
`
diff --git a/examples/views/table/edit/Click.vue b/examples/views/table/edit/Click.vue
index 3e6fe9194..9bb01ddd7 100644
--- a/examples/views/table/edit/Click.vue
+++ b/examples/views/table/edit/Click.vue
@@ -33,16 +33,16 @@
:data="tableData"
:edit-config="{trigger: 'click', mode: 'row'}">
-
+
-
-
+
+
-
+
@@ -124,16 +124,16 @@ export default {
:data="tableData"
:edit-config="{trigger: 'click', mode: 'row'}">
-
+
-
-
+
+
-
+
`,
diff --git a/examples/views/table/edit/FooterImmediately.vue b/examples/views/table/edit/FooterImmediately.vue
index 19a2707c0..9f3c7fbc6 100644
--- a/examples/views/table/edit/FooterImmediately.vue
+++ b/examples/views/table/edit/FooterImmediately.vue
@@ -28,12 +28,12 @@
:data="tableData"
:edit-config="{trigger: 'click', mode: 'row'}">
-
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -77,12 +77,12 @@ export default {
:data="tableData"
:edit-config="{trigger: 'click', mode: 'row'}">
-
+
-
+
`,
`
diff --git a/examples/views/table/edit/Select.vue b/examples/views/table/edit/Select.vue
index 88eb34137..f9ae6fa3b 100644
--- a/examples/views/table/edit/Select.vue
+++ b/examples/views/table/edit/Select.vue
@@ -9,13 +9,13 @@
:data="tableData"
:edit-config="{trigger: 'click', mode: 'cell'}">
-
+
-
-
+
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -63,13 +63,13 @@ export default {
:data="tableData"
:edit-config="{trigger: 'click', mode: 'cell'}">
-
+
-
-
+
+
-
+
`,
`
diff --git a/examples/views/table/edit/Template.vue b/examples/views/table/edit/Template.vue
index 95e933275..6bcd32f6d 100644
--- a/examples/views/table/edit/Template.vue
+++ b/examples/views/table/edit/Template.vue
@@ -43,7 +43,7 @@
-
+
@@ -55,7 +55,7 @@
¥{{ row.num }}
-
+
@@ -174,7 +174,7 @@ export default {
-
+
@@ -186,7 +186,7 @@ export default {
¥{{ row.num }}
-
+
@@ -208,7 +208,7 @@ export default {
-
+
{
// 处理排序条件
const queryParams = Object.assign({
@@ -253,7 +253,7 @@ export default {
total: 'page.total'
},
ajax: {
- // 任何支持 Promise API 的库都可以对接(fetch、jquery、axios、xe-ajax)
+ // 接收 Promise 对象
query: ({ page, sort, filters, form }) => {
// 处理排序条件
const queryParams = Object.assign({
diff --git a/examples/views/table/grid/FullQuery.vue b/examples/views/table/grid/FullQuery.vue
index 4ad83ea59..0ef519b5c 100644
--- a/examples/views/table/grid/FullQuery.vue
+++ b/examples/views/table/grid/FullQuery.vue
@@ -92,7 +92,7 @@ export default {
total: 'page.total' // 配置响应结果总页数字段
},
ajax: {
- // 任何支持 Promise API 的库都可以对接(fetch、jquery、axios、xe-ajax)
+ // 接收 Promise 对象
query: ({ page, sort, filters }) => {
// 处理排序条件
const queryParams = Object.assign({
@@ -221,7 +221,7 @@ export default {
total: 'page.total' // 配置响应结果总页数字段
},
ajax: {
- // 任何支持 Promise API 的库都可以对接(fetch、jquery、axios、xe-ajax)
+ // 接收 Promise 对象
query: ({ page, sort, filters }) => {
// 处理排序条件
const queryParams = Object.assign({
diff --git a/examples/views/table/plugin/Menus.vue b/examples/views/table/plugin/Menus.vue
index 0cbfa2744..53d33451a 100644
--- a/examples/views/table/plugin/Menus.vue
+++ b/examples/views/table/plugin/Menus.vue
@@ -19,16 +19,16 @@
-
+
-
+
-
-
+
+
-
+
-
+
{{ $t('app.body.button.showCode') }}
@@ -122,16 +122,16 @@ export default {
-
+
-
+
-
-
+
+
-
+
-
+
`,
`
diff --git a/examples/views/table/renderer/Default.vue b/examples/views/table/renderer/Default.vue
index 7ad0f534f..f52036959 100644
--- a/examples/views/table/renderer/Default.vue
+++ b/examples/views/table/renderer/Default.vue
@@ -56,6 +56,11 @@ export default {
return [
events.click(params) }>{row[column.property]}
]
+ },
+ // 导出模板,例如导出插槽中自定义的内容
+ exportMethod (params) {
+ const { row, column } = params
+ return '自定义内容'
}
})
`,
diff --git a/examples/views/table/renderer/Edit.vue b/examples/views/table/renderer/Edit.vue
index 1651d098c..b3a200f27 100644
--- a/examples/views/table/renderer/Edit.vue
+++ b/examples/views/table/renderer/Edit.vue
@@ -65,6 +65,11 @@ export default {
return [
{ row[column.property] }
]
+ },
+ // 导出模板,例如导出插槽中自定义的内容
+ exportMethod (params) {
+ const { row, column } = params
+ return '自定义内容'
}
})
`,
diff --git a/examples/views/table/scroll/Group.vue b/examples/views/table/scroll/Group.vue
index 9efca5a47..a32d58ccb 100644
--- a/examples/views/table/scroll/Group.vue
+++ b/examples/views/table/scroll/Group.vue
@@ -12,21 +12,21 @@
:loading="loading"
:data="tableData">
-
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
@@ -61,21 +61,21 @@ export default {
:loading="loading"
:data="tableData">
-
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
diff --git a/examples/views/table/tree/Basic.vue b/examples/views/table/tree/Basic.vue
index a3110fdaf..232009faf 100644
--- a/examples/views/table/tree/Basic.vue
+++ b/examples/views/table/tree/Basic.vue
@@ -63,10 +63,10 @@
:tree-config="{children: 'children', expandAll: true}">
-
+
-
+
@@ -167,10 +167,10 @@ export default {
:tree-config="{children: 'children', expandAll: true}">
-
+
-
+
`,
diff --git a/gulpfile.js b/gulpfile.js
index 066215885..d63147079 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -10,11 +10,11 @@ const clean = require('gulp-clean')
const sass = require('gulp-sass')
const cleanCSS = require('gulp-clean-css')
const prefixer = require('gulp-autoprefixer')
+const merge = require('merge-stream');
const components = [
'table',
'column',
- 'body',
'toolbar',
'grid',
'pager',
@@ -32,7 +32,6 @@ const components = [
'pulldown',
'icon',
- 'cell',
'header',
'footer',
'filter',
@@ -54,6 +53,8 @@ const languages = [
'ja-JP'
]
+const styleCode = `require('./style.css')`
+
const commCode = `if (process.env.NODE_ENV === 'production') {
module.exports = require('./index.common.pro.js')
} else {
@@ -76,7 +77,7 @@ gulp.task('build_modules', () => {
})
gulp.task('build_i18n', () => {
- return Promise.all(languages.map(code => {
+ const rest = languages.map(code => {
const name = XEUtils.camelCase(code).replace(/^[a-z]/, firstChat => firstChat.toUpperCase())
const isZHTC = ['zh-HK', 'zh-MO', 'zh-TW'].includes(code)
return gulp.src(`packages/locale/lang/${isZHTC ? 'zh-TC' : code}.js`)
@@ -99,7 +100,8 @@ gulp.task('build_i18n', () => {
extname: '.js'
}))
.pipe(gulp.dest('lib/locale/lang'))
- }))
+ })
+ return merge(...rest)
})
gulp.task('copy_ts', () => {
@@ -109,7 +111,7 @@ gulp.task('copy_ts', () => {
gulp.task('build_lib', () => {
fs.writeFileSync('lib/index.common.js', commCode)
- return Promise.all([
+ return merge([
gulp.src('lib_pro/index.common.js')
.pipe(rename({
basename: 'index',
@@ -144,26 +146,29 @@ gulp.task('build_lib', () => {
})
gulp.task('build_style', gulp.series('build_modules', 'build_i18n', 'copy_ts', () => {
- return Promise.all(components.map(name => {
- Promise.all([
- gulp.src('styles/index.js')
- .pipe(gulp.dest(`lib/${name}/style`)),
- gulp.src(`styles/${name}.scss`)
- .pipe(replace(/(\/\*\*Variable\*\*\/)/, `@import './variable.scss';\n`))
- .pipe(sass())
- .pipe(prefixer({
- borwsers: ['last 1 version', '> 1%', 'not ie <= 8'],
- cascade: true,
- remove: true
- }))
- .pipe(cleanCSS())
- .pipe(rename({
- basename: 'style',
- extname: '.css'
- }))
- .pipe(gulp.dest(`lib/${name}/style`))
- ])
- }))
+ const rest = components.map(name => {
+ return gulp.src(`styles/${name}.scss`)
+ .pipe(replace(/(\/\*\*Variable\*\*\/)/, `@import './variable.scss';\n`))
+ .pipe(sass())
+ .pipe(prefixer({
+ borwsers: ['last 1 version', '> 1%', 'not ie <= 8'],
+ cascade: true,
+ remove: true
+ }))
+ .pipe(rename({
+ basename: 'style',
+ extname: '.css'
+ }))
+ .pipe(gulp.dest(`lib/${name}/style`))
+ .pipe(cleanCSS())
+ .pipe(rename({
+ basename: 'style',
+ suffix: '.min',
+ extname: '.css'
+ }))
+ .pipe(gulp.dest(`lib/${name}/style`))
+ })
+ return merge(...rest)
}))
gulp.task('build_clean', () => {
@@ -171,6 +176,9 @@ gulp.task('build_clean', () => {
})
gulp.task('build', gulp.series('build_clean', 'build_style', 'build_lib', () => {
+ components.forEach(name => {
+ fs.writeFileSync(`lib/${name}/style/index.js`, styleCode)
+ })
return del([
'lib_dev',
'lib_pro'
diff --git a/helper/vetur/attributes.json b/helper/vetur/attributes.json
index 344527d3d..cd04dd71c 100644
--- a/helper/vetur/attributes.json
+++ b/helper/vetur/attributes.json
@@ -275,10 +275,6 @@
"type": "boolean",
"description": "表格动画效果开关(关闭后视觉效果更快)"
},
- "vxe-table/cloak": {
- "type": "boolean",
- "description": "用于低性能的浏览器,可以设置为 true 来避免初始化渲染时的闪动"
- },
"vxe-table/delay-hover": {
"type": "number",
"description": "当表格发生拖动、滚动...等行为时,至少多少毫秒之后才允许触发 hover 事件"
@@ -295,6 +291,54 @@
"type": "any",
"description": "额外的参数(可以用来存放一些私有参数)"
},
+ "vxe-table-colgroup/field": {
+ "type": "string",
+ "description": "列字段名(注:属性层级越深,渲染性能就越差,例如:aa.bb.cc.dd.ee)"
+ },
+ "vxe-table-colgroup/title": {
+ "type": "string",
+ "description": "列标题(支持开启国际化)"
+ },
+ "vxe-table-colgroup/width": {
+ "type": "number | string",
+ "description": "列宽度(如果为空则均匀分配剩余宽度,如果全部列固定了,可能会存在宽屏下不会铺满,可以配合 \"%\" 或者 \"min-width\" 布局)"
+ },
+ "vxe-table-colgroup/min-width": {
+ "type": "number | string",
+ "description": "最小列宽度;会自动将剩余空间按比例分配"
+ },
+ "vxe-table-colgroup/resizable": {
+ "type": "boolean",
+ "description": "列是否允许拖动列宽调整大小"
+ },
+ "vxe-table-colgroup/visible": {
+ "type": "boolean",
+ "description": "列是否显示"
+ },
+ "vxe-table-colgroup/fixed": {
+ "type": "string",
+ "description": "将列固定在左侧或者右侧(注意:固定列应该放在左右两侧的位置)"
+ },
+ "vxe-table-colgroup/align": {
+ "type": "string",
+ "description": "列对齐方式"
+ },
+ "vxe-table-colgroup/header-align": {
+ "type": "string",
+ "description": "表头列的对齐方式"
+ },
+ "vxe-table-colgroup/show-overflow": {
+ "type": "string | boolean",
+ "description": "当内容过长时显示为省略号"
+ },
+ "vxe-table-colgroup/show-header-overflow": {
+ "type": "string | boolean",
+ "description": "当表头内容过长时显示为省略号"
+ },
+ "vxe-table-colgroup/header-class-name": {
+ "type": "string | function",
+ "description": "给表头的单元格附加 className,也可以是函数 Function({$rowIndex, column, columnIndex, $columnIndex})"
+ },
"vxe-table-column/type": {
"type": "string",
"description": "列的类型"
@@ -723,10 +767,6 @@
"type": "boolean",
"description": "表格动画效果开关(关闭后视觉效果更快)"
},
- "vxe-grid/cloak": {
- "type": "boolean",
- "description": "用于低性能的浏览器,可以设置为 true 来避免初始化渲染时的闪动"
- },
"vxe-grid/delay-hover": {
"type": "number",
"description": "当表格发生拖动、滚动...等行为时,至少多少毫秒之后才允许触发 hover 事件"
@@ -1159,11 +1199,11 @@
"type": "any",
"description": "下拉分组选项属性参数配置"
},
- "vxe-select/opt-id": {
+ "vxe-select/option-id": {
"type": "string",
"description": "自定义选项唯一主键的字段名(选项必须要有唯一主键,默认自动生成)"
},
- "vxe-select/opt-key": {
+ "vxe-select/option-key": {
"type": "boolean",
"description": "是否需要为每一行的 VNode 设置 key 属性(非特殊情况下没必要设置)"
},
diff --git a/helper/vetur/tags.json b/helper/vetur/tags.json
index bc0c6176f..28fa54317 100644
--- a/helper/vetur/tags.json
+++ b/helper/vetur/tags.json
@@ -70,7 +70,6 @@
"empty-render",
"custom-config",
"animat",
- "cloak",
"delay-hover",
"scroll-x",
"scroll-y",
@@ -81,6 +80,23 @@
],
"description": "基础表格"
},
+ "vxe-table-colgroup": {
+ "attributes": [
+ "field",
+ "title",
+ "width",
+ "min-width",
+ "resizable",
+ "visible",
+ "fixed",
+ "align",
+ "header-align",
+ "show-overflow",
+ "show-header-overflow",
+ "header-class-name"
+ ],
+ "description": "基础表格 - 分组列"
+ },
"vxe-table-column": {
"attributes": [
"type",
@@ -195,7 +211,6 @@
"empty-render",
"custom-config",
"animat",
- "cloak",
"delay-hover",
"scroll-x",
"scroll-y",
@@ -354,8 +369,8 @@
"option-props",
"option-groups",
"option-group-props",
- "opt-id",
- "opt-key",
+ "option-id",
+ "option-key",
"transfer"
],
"subtags": [
diff --git a/package.json b/package.json
index b4acb2884..a78b9865d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vxe-table",
- "version": "3.0.0-beta.1",
+ "version": "3.0.0-beta.2",
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、模态窗口、自定义模板、渲染器、贼灵活的配置项、扩展接口等...",
"scripts": {
"serve": "vue-cli-service serve",
diff --git a/packages/body/index.js b/packages/body/index.js
deleted file mode 100644
index a35d5cf8e..000000000
--- a/packages/body/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import VxeTableBody from './src/body'
-
-VxeTableBody.install = function (Vue) {
- Vue.component(VxeTableBody.name, VxeTableBody)
-}
-
-export const Body = VxeTableBody
-export default VxeTableBody
diff --git a/packages/cell/index.js b/packages/cell/index.js
deleted file mode 100644
index 87e56143c..000000000
--- a/packages/cell/index.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Cell from './src/cell'
-
-export * from './src/cell'
-export default Cell
diff --git a/packages/column/index.js b/packages/column/index.js
index e55ed8546..fb448ab31 100644
--- a/packages/column/index.js
+++ b/packages/column/index.js
@@ -1,7 +1,9 @@
import VxeTableColumn from './src/column'
+import VxeTableColgroup from './src/group'
VxeTableColumn.install = function (Vue) {
Vue.component(VxeTableColumn.name, VxeTableColumn)
+ Vue.component(VxeTableColgroup.name, VxeTableColgroup)
}
export const Column = VxeTableColumn
diff --git a/packages/column/src/column.js b/packages/column/src/column.js
index 5446cefcb..255db2faa 100644
--- a/packages/column/src/column.js
+++ b/packages/column/src/column.js
@@ -1,10 +1,10 @@
-import Cell from '../../cell'
+import Cell from '../../table/src/cell'
import { UtilTools } from '../../tools'
const props = {
// 列唯一主键
colId: [String, Number],
- // 渲染类型 index,radio,checkbox,expand,html
+ // 渲染类型 seq,radio,checkbox,expand,html
type: String,
// 列字段名
field: String,
diff --git a/packages/column/src/group.js b/packages/column/src/group.js
new file mode 100644
index 000000000..74eb356ca
--- /dev/null
+++ b/packages/column/src/group.js
@@ -0,0 +1,6 @@
+import VxeTableColumn from './column'
+
+export default {
+ name: 'VxeTableColgroup',
+ extends: VxeTableColumn
+}
diff --git a/packages/filter/src/mixin.js b/packages/filter/src/mixin.js
index 63f4508cd..7d2a63b1c 100644
--- a/packages/filter/src/mixin.js
+++ b/packages/filter/src/mixin.js
@@ -30,11 +30,10 @@ export default {
* @param {Object} params 参数
*/
triggerFilterEvent (evnt, column, params) {
- const { $refs, filterStore } = this
+ const { filterStore } = this
if (filterStore.column === column && filterStore.visible) {
filterStore.visible = false
} else {
- const bodyElem = $refs.tableBody.$el
const { target: targetElem, pageX } = evnt
const { visibleWidth } = DomTools.getDomNode()
Object.assign(filterStore, {
@@ -52,6 +51,8 @@ export default {
this.checkFilterOptions()
this.initStore.filter = true
this.$nextTick(() => {
+ const { $refs } = this
+ const bodyElem = $refs.tableBody.$el
const filterWrapperElem = $refs.filterWrapper.$el
const filterWidth = filterWrapperElem.offsetWidth
const centerWidth = filterWidth / 2
diff --git a/packages/filter/src/panel.js b/packages/filter/src/panel.js
index fa01dc993..54c550b18 100644
--- a/packages/filter/src/panel.js
+++ b/packages/filter/src/panel.js
@@ -42,7 +42,7 @@ export default {
return [
h('div', {
class: 'vxe-table--filter-template'
- }, compConf.renderFilter.call($xetable, h, filterRender, Object.assign({ $panel: this, context: this }, args), this))
+ }, compConf.renderFilter.call($xetable, h, filterRender, Object.assign({ $panel: this, context: this }, args)))
]
}
return [
diff --git a/packages/locale/lang/en-US.js b/packages/locale/lang/en-US.js
index ea28de0e5..7f5586ce8 100644
--- a/packages/locale/lang/en-US.js
+++ b/packages/locale/lang/en-US.js
@@ -3,6 +3,7 @@ export default {
error: {
groupFixed: 'If you use group headers, the fixed columns must be set by group.',
groupMouseRange: 'Grouping headers and "{0}" cannot be used at the same time, which may cause errors.',
+ groupTag: 'Grouping column header should use "{0}" instead of "{1}", which may cause errors.',
scrollErrProp: 'The parameter "{0}" is not supported when virtual scrolling is enabled.',
scrollXNotGroup: 'Horizontal virtual scrolling does not support grouping headers. Please modify the parameters of "scroll-x.gt" correctly, otherwise errors may occur.',
errConflicts: 'Argument "{0}" conflicts with "{1}"',
diff --git a/packages/locale/lang/ja-JP.js b/packages/locale/lang/ja-JP.js
index eb0f4bcaa..9cecaaa13 100644
--- a/packages/locale/lang/ja-JP.js
+++ b/packages/locale/lang/ja-JP.js
@@ -3,6 +3,7 @@ export default {
error: {
groupFixed: 'グループのヘッダを使用すると、固定列はグループで設定しなければなりません',
groupMouseRange: 'グループ化ヘッダーと「{0}」は同時に使用できません。これによりエラーが発生する可能性があります',
+ groupTag: '分组列头应该使用 "{0}" 而不是 "{1}",这可能会出现错误',
scrollErrProp: '启用虚拟滚动后不支持该参数 "{0}"',
scrollXNotGroup: '水平のバーチャルスクロールは、グループヘッダーをサポートしない。 "scroll-x.gt" のパラメータを正しく修正してください。そうしないとエラーが発生します。',
errConflicts: '参数 "{0}" 与 "{1}" 有冲突',
diff --git a/packages/locale/lang/zh-CN.js b/packages/locale/lang/zh-CN.js
index 5dcccb195..1b19d524f 100644
--- a/packages/locale/lang/zh-CN.js
+++ b/packages/locale/lang/zh-CN.js
@@ -2,7 +2,8 @@ export default {
vxe: {
error: {
groupFixed: '如果使用分组表头,固定列必须按组设置',
- groupMouseRange: '分组表头与 "{0}" 不能同时使用,这可能會出現错误',
+ groupMouseRange: '分组表头与 "{0}" 不能同时使用,这可能会出现错误',
+ groupTag: '分组列头应该使用 "{0}" 而不是 "{1}",这可能会出现错误',
scrollErrProp: '启用虚拟滚动后不支持该参数 "{0}"',
scrollXNotGroup: '横向虚拟滚动不支持分组表头,请修改正确 "scroll-x.gt" 的参数,否则可能会导致出现错误',
errConflicts: '参数 "{0}" 与 "{1}" 有冲突',
diff --git a/packages/locale/lang/zh-TC.js b/packages/locale/lang/zh-TC.js
index cc0b1f143..b3629b832 100644
--- a/packages/locale/lang/zh-TC.js
+++ b/packages/locale/lang/zh-TC.js
@@ -3,6 +3,7 @@ export default {
error: {
groupFixed: '如果使用分組表頭,固定列必須按組設定',
groupMouseRange: '分组表頭與 "{0}" 不能同時使用,這可能會出現錯誤',
+ groupTag: '分組列頭應該使用 "{0}" 而不是 "{1}",這可能會出現錯誤',
scrollErrProp: '啟用虛擬滾動後不支持該參數 "{0}"',
scrollXNotGroup: '橫向虛擬滾動不支持分組表頭,請修改正確 "scroll-x.gt" 的參數,否則可能會導致出現錯誤',
errConflicts: '參數 "{0}" 與 "{1}" 有衝突',
diff --git a/packages/pager/src/pager.js b/packages/pager/src/pager.js
index 107b009ad..01e35959f 100644
--- a/packages/pager/src/pager.js
+++ b/packages/pager/src/pager.js
@@ -345,7 +345,7 @@ export default {
jumpPage (currentPage) {
if (currentPage !== this.currentPage) {
this.$emit('update:currentPage', currentPage)
- this.$emit('page-change', { type: 'current', pageSize: this.pageSize, currentPage, $event: { type: 'current' } })
+ this.$emit('page-change', { type: 'current', pageSize: this.pageSize, currentPage })
}
},
pageSizeEvent (pageSize) {
@@ -354,7 +354,7 @@ export default {
changePageSize (pageSize) {
if (pageSize !== this.pageSize) {
this.$emit('update:pageSize', pageSize)
- this.$emit('page-change', { type: 'size', pageSize, currentPage: Math.min(this.currentPage, this.getPageCount(this.total, pageSize)), $event: { type: 'size' } })
+ this.$emit('page-change', { type: 'size', pageSize, currentPage: Math.min(this.currentPage, this.getPageCount(this.total, pageSize)) })
}
},
jumpKeydownEvent (evnt) {
diff --git a/packages/table/index.js b/packages/table/index.js
index c514ebbb1..9fbef7175 100644
--- a/packages/table/index.js
+++ b/packages/table/index.js
@@ -1,4 +1,5 @@
import VxeTable from './src/table'
+import VxeTableBody from './src/body'
import VXETable from '../v-x-e-table'
VxeTable.install = function (Vue) {
@@ -14,6 +15,7 @@ VxeTable.install = function (Vue) {
Vue.prototype.$vxe.t = VXETable.t
}
Vue.component(VxeTable.name, VxeTable)
+ Vue.component(VxeTableBody.name, VxeTableBody)
}
export const Table = VxeTable
diff --git a/packages/body/src/body.js b/packages/table/src/body.js
similarity index 99%
rename from packages/body/src/body.js
rename to packages/table/src/body.js
index 3ab001415..15530839a 100644
--- a/packages/body/src/body.js
+++ b/packages/table/src/body.js
@@ -482,7 +482,7 @@ export default {
} else {
const compConf = emptyRender ? VXETable.renderer.get(emptyOpts.name) : null
if (compConf && compConf.renderEmpty) {
- emptyContent = compConf.renderEmpty.call(this, h, emptyOpts, { $table: $xetable }, { $table: $xetable })
+ emptyContent = compConf.renderEmpty.call(this, h, emptyOpts, { $table: $xetable })
} else {
emptyContent = $xetable.emptyText || GlobalConfig.i18n('vxe.table.emptyText')
}
diff --git a/packages/cell/src/cell.js b/packages/table/src/cell.js
similarity index 98%
rename from packages/cell/src/cell.js
rename to packages/table/src/cell.js
index 5b447c124..ab966c591 100644
--- a/packages/cell/src/cell.js
+++ b/packages/table/src/cell.js
@@ -70,7 +70,7 @@ function getFooterContent (h, params) {
if (renderOpts) {
const compConf = VXETable.renderer.get(renderOpts.name)
if (compConf && compConf.renderFooter) {
- return compConf.renderFooter.call($table, h, renderOpts, params, { $grid: $table.$xegrid, $table })
+ return compConf.renderFooter.call($table, h, renderOpts, params)
}
}
return [UtilTools.formatText(items[_columnIndex], 1)]
@@ -144,7 +144,7 @@ export const Cell = {
if (renderOpts) {
const compConf = VXETable.renderer.get(renderOpts.name)
if (compConf && compConf.renderHeader) {
- return renderTitleContent(h, params, compConf.renderHeader.call($table, h, renderOpts, params, { $grid: $table.$xegrid, $table }))
+ return renderTitleContent(h, params, compConf.renderHeader.call($table, h, renderOpts, params))
}
}
return renderTitleContent(h, params, UtilTools.formatText(column.getTitle(), 1))
@@ -163,7 +163,7 @@ export const Cell = {
const funName = editRender ? 'renderCell' : 'renderDefault'
const compConf = VXETable.renderer.get(renderOpts.name)
if (compConf && compConf[funName]) {
- return compConf[funName].call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params), { $grid: $table.$xegrid, $table })
+ return compConf[funName].call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))
}
}
return [
@@ -528,7 +528,7 @@ export const Cell = {
if (contentRender) {
const compConf = VXETable.renderer.get(contentRender.name)
if (compConf && compConf.renderExpand) {
- return compConf.renderExpand.call($table, h, contentRender, params, { $grid: $table.$xegrid, $table })
+ return compConf.renderExpand.call($table, h, contentRender, params)
}
}
return []
@@ -690,7 +690,7 @@ export const Cell = {
if (slots && slots.edit) {
return slots.edit.call($table, params, h)
}
- return compConf && compConf.renderEdit ? compConf.renderEdit.call($table, h, editRender, Object.assign({ $type: 'edit' }, params), { $grid: $table.$xegrid, $table }) : []
+ return compConf && compConf.renderEdit ? compConf.renderEdit.call($table, h, editRender, Object.assign({ $type: 'edit' }, params)) : []
}
if (slots && slots.default) {
return slots.default.call($table, params, h)
diff --git a/packages/table/src/methods.js b/packages/table/src/methods.js
index 3f8744414..8092e6b99 100644
--- a/packages/table/src/methods.js
+++ b/packages/table/src/methods.js
@@ -1,6 +1,6 @@
import XEUtils from 'xe-utils/ctor'
import GlobalConfig from '../../conf'
-import Cell from '../../cell'
+import Cell from './cell'
import VXETable from '../../v-x-e-table'
import { UtilTools, DomTools } from '../../tools'
diff --git a/packages/table/src/table.js b/packages/table/src/table.js
index 84f6214c6..cb62cc21d 100644
--- a/packages/table/src/table.js
+++ b/packages/table/src/table.js
@@ -1,7 +1,7 @@
import XEUtils from 'xe-utils/ctor'
import GlobalConfig from '../../conf'
import VXETable from '../../v-x-e-table'
-import VxeTableBody from '../../body'
+import VxeTableBody from './body'
import vSize from '../../mixins/size'
import { UtilTools, GlobalEvent, ResizeEvent } from '../../tools'
import methods from './methods'
@@ -15,25 +15,23 @@ import methods from './methods'
* @param {String} fixedType 固定列类型
*/
function renderFixed (h, $xetable, fixedType) {
- const { tableData, tableColumn, tableGroupColumn, vSize, showHeader, showFooter, columnStore, footerData } = $xetable
+ const { _e, tableData, tableColumn, tableGroupColumn, vSize, showHeader, showFooter, columnStore, footerData } = $xetable
const fixedColumn = columnStore[`${fixedType}List`]
- const tableChilds = []
- if (showHeader) {
- tableChilds.push(
- h('vxe-table-header', {
- props: {
- fixedType,
- tableData,
- tableColumn,
- tableGroupColumn,
- size: vSize,
- fixedColumn
- },
- ref: `${fixedType}Header`
- })
- )
- }
- tableChilds.push(
+ return h('div', {
+ class: `vxe-table--fixed-${fixedType}-wrapper`,
+ ref: `${fixedType}Container`
+ }, [
+ showHeader ? h('vxe-table-header', {
+ props: {
+ fixedType,
+ tableData,
+ tableColumn,
+ tableGroupColumn,
+ size: vSize,
+ fixedColumn
+ },
+ ref: `${fixedType}Header`
+ }) : _e(),
h('vxe-table-body', {
props: {
fixedType,
@@ -43,26 +41,35 @@ function renderFixed (h, $xetable, fixedType) {
size: vSize
},
ref: `${fixedType}Body`
- })
- )
- if (showFooter) {
- tableChilds.push(
- h('vxe-table-footer', {
- props: {
- footerData,
- tableColumn,
- fixedColumn,
- fixedType,
- size: vSize
- },
- ref: `${fixedType}Footer`
- })
- )
+ }),
+ showFooter ? h('vxe-table-footer', {
+ props: {
+ footerData,
+ tableColumn,
+ fixedColumn,
+ fixedType,
+ size: vSize
+ },
+ ref: `${fixedType}Footer`
+ }) : _e()
+ ])
+}
+
+function renderEmptyContenet (h, _vm) {
+ const { $scopedSlots, emptyOpts } = _vm
+ let emptyContent = ''
+ const params = { $table: _vm }
+ if ($scopedSlots.empty) {
+ emptyContent = $scopedSlots.empty.call(_vm, params, h)
+ } else {
+ const compConf = _vm.emptyRender ? VXETable.renderer.get(emptyOpts.name) : null
+ if (compConf) {
+ emptyContent = compConf.renderEmpty.call(_vm, h, emptyOpts, params)
+ } else {
+ emptyContent = _vm.emptyText || GlobalConfig.i18n('vxe.table.emptyText')
+ }
}
- return h('div', {
- class: `vxe-table--fixed-${fixedType}-wrapper`,
- ref: `${fixedType}Container`
- }, tableChilds)
+ return emptyContent
}
export default {
@@ -680,19 +687,21 @@ export default {
}
// 检查是否有安装需要的模块
- let errorModuleName
- if (!VXETable._edit && this.editConfig) {
- errorModuleName = 'Edit'
- } else if (!VXETable._valid && this.editRules) {
- errorModuleName = 'Validator'
- } else if (!VXETable._keyboard && (this.keyboardConfig || this.mouseConfig)) {
- errorModuleName = 'Keyboard'
- } else if (!VXETable._export && (this.importConfig || this.exportConfig)) {
- errorModuleName = 'Export'
- }
- if (errorModuleName) {
- throw new Error(UtilTools.getLog('vxe.error.reqModule', [errorModuleName]))
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
+ if (this.editConfig && !this._insert) {
+ UtilTools.error('vxe.error.reqModule', ['Edit'])
+ }
+ if (this.editRules && !this._validate) {
+ UtilTools.error('vxe.error.reqModule', ['Validator'])
+ }
+ if ((this.keyboardConfig || this.mouseConfig) && !this.triggerCellMousedownEvent) {
+ UtilTools.error('vxe.error.reqModule', ['Keyboard'])
+ }
+ if ((this.printConfig || this.importConfig || this.exportConfig) && !this._exportData) {
+ UtilTools.error('vxe.error.reqModule', ['Export'])
+ }
}
+
Object.assign(scrollYStore, {
startIndex: 0,
endIndex: 0,
@@ -760,7 +769,7 @@ export default {
},
render (h) {
const {
- $scopedSlots,
+ _e,
tId,
tableData,
tableColumn,
@@ -795,118 +804,9 @@ export default {
ctxMenuStore,
ctxMenuOpts,
footerData,
- hasTip,
- emptyRender,
- emptyOpts
+ hasTip
} = this
- const tableChilds = []
- const fixedChilds = []
- const tableComps = []
const { leftList, rightList } = columnStore
- let emptyContent
- if ($scopedSlots.empty) {
- emptyContent = $scopedSlots.empty.call(this, { $table: this }, h)
- } else {
- const compConf = emptyRender ? VXETable.renderer.get(emptyOpts.name) : null
- if (compConf) {
- emptyContent = compConf.renderEmpty.call(this, h, emptyOpts, { $table: this }, { $table: this })
- } else {
- emptyContent = this.emptyText || GlobalConfig.i18n('vxe.table.emptyText')
- }
- }
- // 头部
- if (showHeader) {
- tableChilds.push(
- h('vxe-table-header', {
- ref: 'tableHeader',
- props: {
- tableData,
- tableColumn,
- tableGroupColumn,
- size: vSize
- }
- })
- )
- }
- // 主体
- tableChilds.push(
- h('vxe-table-body', {
- ref: 'tableBody',
- props: {
- tableData,
- tableColumn,
- size: vSize
- }
- })
- )
- // 表尾
- if (showFooter) {
- tableChilds.push(
- h('vxe-table-footer', {
- props: {
- footerData,
- tableColumn,
- size: vSize
- },
- ref: 'tableFooter'
- })
- )
- }
-
- // 左侧固定区域
- if (leftList && leftList.length && overflowX) {
- fixedChilds.push(renderFixed(h, this, 'left'))
- }
- // 右侧固定区域
- if (rightList && rightList.length && overflowX) {
- fixedChilds.push(renderFixed(h, this, 'right'))
- }
-
- // 部件 - 筛选
- if (initStore.filter) {
- tableComps.push(
- h('vxe-table-filter', {
- ref: 'filterWrapper',
- props: {
- filterStore
- }
- })
- )
- }
- // 部件 - 导入
- if (initStore.import && this.importConfig) {
- tableComps.push(
- h('vxe-import-panel', {
- props: {
- defaultOptions: this.importParams,
- storeData: this.importStore
- }
- })
- )
- }
- // 部件 - 导出
- if (initStore.export && this.exportConfig) {
- tableComps.push(
- h('vxe-export-panel', {
- props: {
- defaultOptions: this.exportParams,
- storeData: this.exportStore
- }
- })
- )
- }
- // 部件 - 快捷菜单
- if (ctxMenuStore.visible && this.isCtxMenu) {
- tableComps.push(
- h('vxe-table-context-menu', {
- ref: 'ctxWrapper',
- props: {
- ctxMenuStore,
- ctxMenuOpts
- }
- })
- )
- }
return h('div', {
class: ['vxe-table', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
'vxe-editable': !!editConfig,
@@ -942,10 +842,54 @@ export default {
}, this.$slots.default),
h('div', {
class: 'vxe-table--main-wrapper'
- }, tableChilds),
+ }, [
+ /**
+ * 表头
+ */
+ showHeader ? h('vxe-table-header', {
+ ref: 'tableHeader',
+ props: {
+ tableData,
+ tableColumn,
+ tableGroupColumn,
+ size: vSize
+ }
+ }) : _e(),
+ /**
+ * 表体
+ */
+ h('vxe-table-body', {
+ ref: 'tableBody',
+ props: {
+ tableData,
+ tableColumn,
+ size: vSize
+ }
+ }),
+ /**
+ * 表尾
+ */
+ showFooter ? h('vxe-table-footer', {
+ ref: 'tableFooter',
+ props: {
+ footerData,
+ tableColumn,
+ size: vSize
+ }
+ }) : _e()
+ ]),
h('div', {
class: 'vxe-table--fixed-wrapper'
- }, fixedChilds),
+ }, [
+ /**
+ * 左侧固定区域
+ */
+ leftList && leftList.length && overflowX ? renderFixed(h, this, 'left') : _e(),
+ /**
+ * 右侧固定区域
+ */
+ rightList && rightList.length && overflowX ? renderFixed(h, this, 'right') : _e()
+ ]),
/**
* 空数据
*/
@@ -955,7 +899,7 @@ export default {
}, [
h('div', {
class: 'vxe-table--empty-content'
- }, emptyContent)
+ }, renderEmptyContenet(h, this))
]),
/**
* 边框线
@@ -985,22 +929,60 @@ export default {
class: 'vxe-loading--spinner'
})
]),
- h('div', {}, [
- // 工具提示
- hasTip ? h('vxe-tooltip', {
- key: 'mTip',
- ref: 'tooltip',
- props: tooltipOpts
- }) : null,
- // 校验提示
- hasTip && this.editRules && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h('vxe-tooltip', {
- key: 'vTip',
- ref: 'validTip',
- class: 'vxe-table--valid-error',
- props: validOpts.message === 'tooltip' || tableData.length === 1 ? vaildTipOpts : null
- }) : null
- ]),
- h('div', {}, tableComps)
+ /**
+ * 筛选
+ */
+ initStore.filter ? h('vxe-table-filter', {
+ ref: 'filterWrapper',
+ props: {
+ filterStore
+ }
+ }) : _e(),
+ /**
+ * 导入
+ */
+ initStore.import && this.importConfig ? h('vxe-import-panel', {
+ props: {
+ defaultOptions: this.importParams,
+ storeData: this.importStore
+ }
+ }) : _e(),
+ /**
+ * 导出
+ */
+ initStore.export && this.exportConfig ? h('vxe-export-panel', {
+ props: {
+ defaultOptions: this.exportParams,
+ storeData: this.exportStore
+ }
+ }) : _e(),
+ /**
+ * 快捷菜单
+ */
+ ctxMenuStore.visible && this.isCtxMenu ? h('vxe-table-context-menu', {
+ ref: 'ctxWrapper',
+ props: {
+ ctxMenuStore,
+ ctxMenuOpts
+ }
+ }) : _e(),
+ /**
+ * 工具提示
+ */
+ hasTip ? h('vxe-tooltip', {
+ key: 'mTip',
+ ref: 'tooltip',
+ props: tooltipOpts
+ }) : _e(),
+ /**
+ * 校验提示
+ */
+ hasTip && this.editRules && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h('vxe-tooltip', {
+ key: 'vTip',
+ ref: 'validTip',
+ class: 'vxe-table--valid-error',
+ props: validOpts.message === 'tooltip' || tableData.length === 1 ? vaildTipOpts : null
+ }) : _e()
])
},
methods
diff --git a/packages/toolbar/src/toolbar.js b/packages/toolbar/src/toolbar.js
index fb1538168..2f1839c15 100644
--- a/packages/toolbar/src/toolbar.js
+++ b/packages/toolbar/src/toolbar.js
@@ -13,15 +13,15 @@ function renderBtns (h, _vm) {
return $scopedSlots.buttons.call(_vm, { $grid: $xegrid, $table: $xetable }, h)
}
return buttons.map(item => {
- const { name, visible, dropdowns, buttonRender } = item
+ const { dropdowns, buttonRender } = item
const compConf = buttonRender ? VXETable.renderer.get(buttonRender.name) : null
- if (visible === false) {
+ if (item.visible === false) {
return _e()
}
if (compConf && compConf.renderButton) {
return h('span', {
class: 'vxe-button--item'
- }, compConf.renderButton.call(_vm, h, buttonRender, { $grid: $xegrid, $table: $xetable, button: item }, { $grid: $xegrid, $table: $xetable }))
+ }, compConf.renderButton.call(_vm, h, buttonRender, { $grid: $xegrid, $table: $xetable, button: item }))
}
return h('vxe-button', {
on: {
@@ -35,12 +35,12 @@ function renderBtns (h, _vm) {
circle: item.circle,
round: item.round,
status: item.status,
+ content: UtilTools.getFuncText(item.name),
destroyOnClose: item.destroyOnClose,
placement: item.placement,
transfer: item.transfer
},
scopedSlots: dropdowns && dropdowns.length ? {
- default: () => UtilTools.getFuncText(name),
dropdowns: () => dropdowns.map(child => {
return child.visible === false ? _e() : h('vxe-button', {
on: {
@@ -53,12 +53,13 @@ function renderBtns (h, _vm) {
icon: child.icon,
circle: child.circle,
round: child.round,
- status: child.status
+ status: child.status,
+ content: UtilTools.getFuncText(child.name)
}
- }, UtilTools.getFuncText(child.name))
+ })
})
} : null
- }, UtilTools.getFuncText(name))
+ })
})
}
@@ -258,9 +259,6 @@ export default {
},
created () {
const { refresh, refreshOpts } = this
- if (!VXETable._export && (this.export || this.import)) {
- UtilTools.error('vxe.error.reqModule', ['Export'])
- }
this.$nextTick(() => {
const $xetable = this.fintTable()
if (refresh && !this.$xegrid && !refreshOpts.query) {
@@ -278,7 +276,7 @@ export default {
GlobalEvent.off(this, 'blur')
},
render (h) {
- const { $xegrid, perfect, loading, importOpts, exportOpts, refresh, refreshOpts, zoom, zoomOpts, custom, vSize } = this
+ const { _e, $xegrid, perfect, loading, importOpts, exportOpts, refresh, refreshOpts, zoom, zoomOpts, custom, vSize } = this
return h('div', {
class: ['vxe-toolbar', {
[`size--${vSize}`]: vSize,
@@ -306,7 +304,7 @@ export default {
on: {
click: this.importEvent
}
- }) : null,
+ }) : _e(),
this.export ? h('vxe-button', {
props: {
circle: true,
@@ -318,7 +316,7 @@ export default {
on: {
click: this.exportEvent
}
- }) : null,
+ }) : _e(),
this.print ? h('vxe-button', {
props: {
circle: true,
@@ -330,7 +328,7 @@ export default {
on: {
click: this.printEvent
}
- }) : null,
+ }) : _e(),
refresh ? h('vxe-button', {
props: {
circle: true,
@@ -342,7 +340,7 @@ export default {
on: {
click: this.refreshEvent
}
- }) : null,
+ }) : _e(),
zoom && $xegrid ? h('vxe-button', {
props: {
circle: true,
@@ -354,8 +352,8 @@ export default {
on: {
click: $xegrid.triggerZoomEvent
}
- }) : null,
- custom ? renderCustoms(h, this) : null
+ }) : _e(),
+ custom ? renderCustoms(h, this) : _e()
])
])
},
diff --git a/packages/tools/src/utils.js b/packages/tools/src/utils.js
index 2ef85a19b..8695c4a2d 100644
--- a/packages/tools/src/utils.js
+++ b/packages/tools/src/utils.js
@@ -244,6 +244,11 @@ export const UtilTools = {
const groupConfig = $xecolumn ? $xecolumn.columnConfig : null
columnConfig.slots = _vm.$scopedSlots
if (groupConfig) {
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
+ if ($xecolumn.$options._componentTag === 'vxe-table-column') {
+ UtilTools.warn('vxe.error.groupTag', [``, ``])
+ }
+ }
if (!groupConfig.children) {
groupConfig.children = []
}
diff --git a/packages/vxe-table.js b/packages/vxe-table.js
index cad2e4276..caa543cd6 100644
--- a/packages/vxe-table.js
+++ b/packages/vxe-table.js
@@ -82,7 +82,6 @@ if (typeof window !== 'undefined' && window.Vue && window.Vue.use) {
export * from './v-x-e-table'
export * from './column'
export * from './header'
-export * from './body'
export * from './footer'
export * from './filter'
export * from './grid'
diff --git a/styles/body.scss b/styles/body.scss
deleted file mode 100644
index 054a56ec7..000000000
--- a/styles/body.scss
+++ /dev/null
@@ -1 +0,0 @@
-/**Variable**/
diff --git a/styles/cell.scss b/styles/cell.scss
deleted file mode 100644
index 054a56ec7..000000000
--- a/styles/cell.scss
+++ /dev/null
@@ -1 +0,0 @@
-/**Variable**/
diff --git a/styles/index.js b/styles/index.js
deleted file mode 100644
index f3f8dd4ea..000000000
--- a/styles/index.js
+++ /dev/null
@@ -1 +0,0 @@
-require('./style.css')
diff --git a/styles/modules.scss b/styles/modules.scss
index cd364bb90..38ac42351 100644
--- a/styles/modules.scss
+++ b/styles/modules.scss
@@ -2,7 +2,6 @@
@import './table.scss';
@import './column.scss';
@import './header.scss';
-@import './body.scss';
@import './footer.scss';
@import './filter.scss';
@import './menu.scss';
diff --git a/tsconfig.json b/tsconfig.json
index 6ce56f954..faeb30949 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -31,7 +31,7 @@
"examples/**/*.tsx",
"examples/**/*.vue",
"types/**/*.ts",
- "types/**/*.tsx"
+ "types/**/*.tsx", "examples/api/table-colgroup.js"
],
"exclude": [
"node_modules"
diff --git a/types/column.d.ts b/types/column.d.ts
index 2c861b172..fd0c7591c 100644
--- a/types/column.d.ts
+++ b/types/column.d.ts
@@ -38,7 +38,7 @@ export declare class Column extends VXETableComponent {
/**
* 将列固定在左侧或者右侧
*/
- fixed?: 'left' | 'right';
+ fixed?: 'left' | 'right' | null;
/**
* 列对其方式
*/
@@ -177,7 +177,7 @@ export interface ColumnOptions {
/**
* 将列固定在左侧或者右侧
*/
- fixed?: 'left' | 'right';
+ fixed?: 'left' | 'right' | null;
/**
* 列对其方式
*/
diff --git a/types/grid.d.ts b/types/grid.d.ts
index 8b53bf416..fe983add0 100644
--- a/types/grid.d.ts
+++ b/types/grid.d.ts
@@ -2,8 +2,10 @@ import { VNode } from 'vue'
import { Table } from './table'
import { ColumnOptions } from './column'
import { FormOptions } from './form'
+import { FormItemOptions } from './form-item'
import { ToolbarOptions } from './toolbar'
import { PagerOptions } from './pager'
+import { RowInfo } from './component'
/**
* 高级表格
@@ -37,10 +39,14 @@ export declare class Grid extends Table {
* @param code 指令编码
*/
commitProxy(code: string): Promise;
+ /**
+ * 获取表单项列表
+ */
+ getFormItems(index?: number): FormItemOptions[];
/**
* 获取已标记删除的数据
*/
- getPendingRecords(): any[];
+ getPendingRecords(): RowInfo[];
/**
* 切换表格最大化/还原
*/
@@ -49,6 +55,14 @@ export declare class Grid extends Table {
* 判断是否最大化显示
*/
isMaximized(): boolean;
+ /**
+ * 如果表格处于常规状态,则最大化表格
+ */
+ maximize(): Promise;
+ /**
+ * 如果表格处于最大化状态,则还原表格
+ */
+ revert(): Promise;
/**
* 获取数据代理信息
*/