Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jun 12, 2019
1 parent be27337 commit 10e2baa
Show file tree
Hide file tree
Showing 25 changed files with 1,633 additions and 284 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=Cache-Control content="no-cache, no-store, must-revalidate"><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><link rel=icon href=/vxe-table/favicon.ico><title>vxe-table 表格</title><link href=/vxe-table/static/css/chunk-vendors.73f3d338.css rel=preload as=style><link href=/vxe-table/static/css/index.b3635b72.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.9d232144.js rel=preload as=script><link href=/vxe-table/static/js/index.8bfbdedd.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.73f3d338.css rel=stylesheet><link href=/vxe-table/static/css/index.b3635b72.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.9d232144.js></script><script src=/vxe-table/static/js/index.8bfbdedd.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=Cache-Control content="no-cache, no-store, must-revalidate"><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><link rel=icon href=/vxe-table/favicon.ico><title>vxe-table 表格</title><link href=/vxe-table/static/css/chunk-vendors.73f3d338.css rel=preload as=style><link href=/vxe-table/static/css/index.b3635b72.css rel=preload as=style><link href=/vxe-table/static/js/chunk-vendors.9d232144.js rel=preload as=script><link href=/vxe-table/static/js/index.fd33727a.js rel=preload as=script><link href=/vxe-table/static/css/chunk-vendors.73f3d338.css rel=stylesheet><link href=/vxe-table/static/css/index.b3635b72.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.9d232144.js></script><script src=/vxe-table/static/js/index.fd33727a.js></script></body></html>
1 change: 0 additions & 1 deletion docs/static/js/index.8bfbdedd.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/static/js/index.fd33727a.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/api/alert.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/button.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/checkbox.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/excel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/grid.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/input.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/pager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/radio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
4 changes: 2 additions & 2 deletions examples/api/table-column.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
list: [
{
name: 'type',
desc: '列的类型',
descKey: 'app.api.tableColumn.desc.type',
type: 'String',
enum: 'index(序号),selection(多选),radio(单选),expand(展开行)',
defVal: '',
Expand Down
20 changes: 10 additions & 10 deletions examples/api/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,78 +111,78 @@ const contextMenuApi = [
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
list: [
{
name: 'data',
desc: '显示的数据',
descKey: 'app.api.table.desc.data',
type: 'Array',
enum: '',
defVal: '',
list: []
},
{
name: 'customs',
desc: '初始化绑定显示/隐藏列',
descKey: 'app.api.table.desc.customs',
type: 'Array',
enum: '',
defVal: '',
list: []
},
{
name: 'height',
desc: '表格的高度',
descKey: 'app.api.table.desc.height',
type: 'Number,String',
enum: 'auto(铺满父容器高度),数值px',
defVal: '',
list: []
},
{
name: 'max-height',
desc: '表格的最大高度',
descKey: 'app.api.table.desc.maxHeight',
type: 'Number,String',
enum: '数值px',
defVal: '',
list: []
},
{
name: 'auto-resize',
desc: '是否自动监听父容器响应式调整表格宽高(如果需要自动跟随父容器的高度变化时可能会用到)',
descKey: 'app.api.table.desc.autoResize',
type: 'Boolean',
enum: '',
defVal: 'false',
list: []
},
{
name: 'resizable',
desc: '所有的列是否允许拖动列宽调整大小',
descKey: 'app.api.table.desc.resizable',
type: 'Boolean',
enum: '',
defVal: 'false',
list: []
},
{
name: 'stripe',
desc: '是否带有斑马纹',
descKey: 'app.api.table.desc.stripe',
type: 'Boolean',
enum: '',
defVal: 'false',
list: []
},
{
name: 'border',
desc: '是否带有纵向边框',
descKey: 'app.api.table.desc.border',
type: 'Boolean',
enum: '',
defVal: 'false',
list: []
},
{
name: 'size',
desc: '表格的尺寸',
descKey: 'app.api.table.desc.size',
type: 'String',
enum: 'medium,small,mini',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/toolbar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
2 changes: 1 addition & 1 deletion examples/api/tooltip.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const apis = [
{
name: 'Props',
desc: '参数',
descKey: 'app.api.title.props',
type: '',
enum: '',
defVal: '',
Expand Down
21 changes: 20 additions & 1 deletion examples/i18n/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,26 @@ module.exports = {
desc: 'Description',
type: 'Type / Return type',
enum: 'Accepted Values',
defVal: 'Default / Arguments'
defVal: 'Default / Arguments',
props: 'Table Attributes'
},
table: {
desc: {
data: 'Table data',
customs: 'Initialize the binding to show/hide columns;You can modify the display or hide columns by using the visible property',
height: 'Table height, supports adaptive or fixed width and height',
maxHeight: 'Max height of the table',
autoResize: 'Whether to automatically listen to the parent container to adjust the table width and height in a responsive manner (this may be used if you need to automatically follow the parent container\'s height)',
resizable: 'Whether drag column width resizing is allowed for all columns',
stripe: 'Whether with zebra stripes',
border: 'Whether there is a vertical border',
size: 'Table size'
}
},
tableColumn: {
desc: {
type: 'The type of the column'
}
}
}
}
Expand Down
21 changes: 20 additions & 1 deletion examples/i18n/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,26 @@ module.exports = {
desc: '说明',
type: '类型 / 返回类型',
enum: '可选值',
defVal: '默认值 / 参数'
defVal: '默认值 / 参数',
props: '参数'
},
table: {
desc: {
data: '显示的数据',
customs: '初始化绑定显示/隐藏列;可以通过 visible 动态修改显示或隐藏',
height: '表格的高度;支持自适应或者固定宽高',
maxHeight: '表格的最大高度',
autoResize: '是否自动监听父容器响应式调整表格宽高(如果需要自动跟随父容器的高度变化时可能会用到)',
resizable: '所有的列是否允许拖动列宽调整大小',
stripe: '是否带有斑马纹',
border: '是否带有纵向边框',
size: '表格的尺寸'
}
},
tableColumn: {
desc: {
type: '列的类型'
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/mock/api/user/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "{{ random.repeat(['name', 'test'],1) }}_{{ $index }}",
"nickname": "{{ random.repeat(['昵称', '名字'],1) }}_{{ $index }}",
"password": "{{ random.repeat('abcdefgABCDEFG',6,12) }}",
"checked": false,
"sex|random(1)": [null, "0", "1"],
"role|random(1)": ["前端", "后端", "测试", "设计", "项目经理"],
"region|random(1)": [[1, 1, 5], [19, 199, 1773], [9, 73, 719]],
Expand Down
52 changes: 23 additions & 29 deletions examples/views/table/api/API.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,11 @@ export default {
data () {
return {
filterName: this.$route.query.filterName,
tableData: [],
defaultExpandRowKeys: []
}
},
computed: {
apiList () {
let filterName = XEUtils.toString(this.filterName).trim().toLowerCase()
if (filterName) {
let filterRE = new RegExp(filterName, 'gi')
let options = { children: 'list' }
let searchProps = ['name', 'desc', 'type', 'enum', 'defVal']
let rest = XEUtils.searchTree(this.tableData, item => searchProps.some(key => item[key].toLowerCase().indexOf(filterName) > -1), options)
XEUtils.eachTree(rest, item => {
searchProps.forEach(key => {
item[key] = item[key].replace(filterRE, match => `<span class="keyword-lighten">${match}</span>`)
})
}, options)
return rest
}
return this.tableData
}
},
created () {
this.loadAPI()
},
methods: {
loadAPI () {
tableData () {
let apis = []
switch (this.$route.params.name) {
case 'table':
Expand Down Expand Up @@ -128,22 +106,38 @@ export default {
apis = tooltipAPI
break
}
// 生成唯一 id
let index = 1
XEUtils.eachTree(apis, item => {
item.id = index++
item.desc = item.descKey ? this.$t(item.descKey) : item.desc
}, { children: 'list' })
// 默认展开一级
this.defaultExpandRowKeys = apis.filter(item => item.list && item.list.length).map(item => item.id)
this.tableData = apis
return apis
},
apiList () {
let filterName = XEUtils.toString(this.filterName).trim().toLowerCase()
if (filterName) {
let filterRE = new RegExp(filterName, 'gi')
let options = { children: 'list' }
let searchProps = ['name', 'desc', 'type', 'enum', 'defVal']
let rest = XEUtils.searchTree(this.tableData, item => searchProps.some(key => item[key].toLowerCase().indexOf(filterName) > -1), options)
XEUtils.eachTree(rest, item => {
searchProps.forEach(key => {
item[key] = item[key].replace(filterRE, match => `<span class="keyword-lighten">${match}</span>`)
})
}, options)
return rest
}
return this.tableData
}
},
created () {
// 默认展开一级
this.defaultExpandRowKeys = this.tableData.filter(item => item.list && item.list.length).map(item => item.id)
},
beforeRouteUpdate (to, from, next) {
next()
this.filterName = ''
this.loadAPI()
}
}
</script>
10 changes: 10 additions & 0 deletions examples/views/table/grid/FullEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:proxy-config="tableProxy"
:columns="tableColumn"
:select-config="{reserve: true}"
:edit-rules="validRules"
:edit-config="{key: 'id', trigger: 'click', mode: 'row', showStatus: true}"></vxe-grid>

<p class="demo-code">{{ $t('app.body.button.showCode') }}</p>
Expand All @@ -33,6 +34,15 @@ import XEUtils from 'xe-utils'
export default {
data () {
return {
validRules: {
name: [
{ required: true, message: '名称必须填写' },
{ min: 3, max: 50, message: '名称长度在 3 到 50 个字符' }
],
role: [
{ required: true, message: '角色必须填写' }
]
},
tableProxy: {
index: true, // 启用动态序号代理
sort: true, // 启用排序代理
Expand Down
Loading

0 comments on commit 10e2baa

Please sign in to comment.