Skip to content

Commit

Permalink
Merge branch 'master' into test_tools
Browse files Browse the repository at this point in the history
  • Loading branch information
FreezingRiver committed Jul 4, 2018
2 parents a012d95 + 969970d commit b2b09c6
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 14 deletions.
2 changes: 2 additions & 0 deletions build/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "revising version in doc..."
sed -i '' "s/vue-data-tables@\(.*\)\/dist/vue-data-tables@$VERSION\/dist/g" docs/index.html
sed -i '' "s/<small>\(.*\)<\/small>/<small>$VERSION<\/small>/" docs/_coverpage.md
sed -i '' "s/<small>\(.*\)<\/small>/<small>$VERSION<\/small>/" docs/en-us/_coverpage.md
sed -i '' "s/<small>\(.*\)<\/small>/<small>$VERSION<\/small>/" docs/zh-cn/_coverpage.md

# commit
git add docs
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.test.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const webpackConfig = merge(baseWebpackConfig, {
mode: 'development',
// use inline sourcemap for karma-sourcemap-loader
module: {
rules: utils.styleLoaders({ sourceMap: true, usePostCSS: true })
rules: utils.styleLoaders()
},
devtool: '#inline-source-map',
resolveLoader: {
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](../_media/icon.svg)

# vue-data-tables <small>3.3.7</small>
# vue-data-tables <small>3.4.0</small>

> A simple, customizable and pageable table, based on vue2 and element-ui
Expand Down
2 changes: 1 addition & 1 deletion docs/en-us/actionBar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Tool Bar
In the version before `3.4`, `vue-data-tables` provides a default tool bar with some filter tools, like checkbox and search. In practice, the tool bar is entirely different from project to project, most of the time, the default tool bar is useless. To decrease the complexity of this library, the default tool bar is removed from `3.4`. If you need tool bar, just implement yourself according to your project requirement.
In the version before `3.4`, `vue-data-tables` provides a default tool bar with some filter tools, like checkbox and search. In practice, the tool bar is entirely different from project to project, most of the time, the default tool bar is useless. To decrease the complexity of this library, the default tool bar is removed from version `3.4`. If you need tool bar, just implement yourself according to your project requirement.

In the following example, we implement a tool bar, and leverage the [filters](en-us/filter.md) property of `vue-data-tables` to make table filter work.

Expand Down
6 changes: 3 additions & 3 deletions docs/en-us/quickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ locale.use(lang)

### import bundled vue-data-tables (recommended and straightforward)
```js
// import DataTables and DataTableServer separately
import { DataTables, DataTableServer } from 'vue-data-tables'
// import DataTables and DataTablesServer separately
import { DataTables, DataTablesServer } from 'vue-data-tables'
Vue.use(DataTables)

// import DataTables and DataTableServer together
// import DataTables and DataTablesServer together
import VueDataTables from 'vue-data-tables'
Vue.use(VueDataTables)
```
Expand Down
36 changes: 34 additions & 2 deletions docs/en-us/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,41 @@

`sort` feature of `vue-data-tables` is based on the [customize sort](http://element.eleme.io/#/en-US/component/table#sorting) of `el-table`. Setting `sortable` prop of `el-table-column` to `custom` can enable customize sort of the column.

> PS, Setting `sortable` to `true` can also work, but `vue-data-table` and embedded `el-table` both sort the data, which may cause performance downgrade.
> PS: Setting `sortable` to `true` can also work, but `vue-data-table` and embedded `el-table` both sort the data, which may cause performance downgrade.
`el-table` accepts `default-sort` prop to set default sort column and order. `vue-data-tables` can pass any props to embedded `el-table` by prop [table-props](en-us/basic.md?id=pass-props-to-the-embedded-el-table), so we can define `vue-data-tables`'s default sort by `:table-props='{ defaultSort: VALUE }'`.
```html
/*vue*/
<desc>
* `sortable="custom"` 很重要
* `tableProps.defaultSort` 定义了默认的排序列
</desc>
<template>
<data-tables
:data='data'
>
<el-table-column v-for="title in titles"
:prop="title.prop"
:label="title.label"
:key="title.label"
sortable="custom">
</el-table-column>
</data-tables>
</template>

<script>
export default {
data() {
return {
data,
titles,
}
}
}
</script>
```

## Default sort
As mentioned in [previous section](en-us/basic.md?id=pass-props-to-the-embedded-el-table), `el-table` accepts `default-sort` prop to set default sort column and order. `vue-data-tables` can pass any props to embedded `el-table` by prop [table-props](en-us/basic.md?id=pass-props-to-the-embedded-el-table), so we can define `vue-data-tables`'s default sort by `:table-props='{ defaultSort: VALUE }'`.

```html
/*vue*/
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-cn/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](../_media/icon.svg)

# vue-data-tables <small>3.3.7</small>
# vue-data-tables <small>3.4.0</small>

> 一个基于 Vue 和 element-ui 简单易用, 可定制的分页表格
Expand Down
6 changes: 3 additions & 3 deletions docs/zh-cn/quickStart.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ locale.use(lang)

### 引入打包之后的 vue-data-tables (推荐, 简单)
```js
// 分别导入 DataTables 和 DataTableServer
import { DataTables, DataTableServer } from 'vue-data-tables'
// 分别导入 DataTables 和 DataTablesServer
import { DataTables, DataTablesServer } from 'vue-data-tables'
Vue.use(DataTables)

// 同时使用 DataTables 和 DataTableServer
// 同时使用 DataTables 和 DataTablesServer
import VueDataTables from 'vue-data-tables'
Vue.use(VueDataTables)
```
Expand Down
36 changes: 35 additions & 1 deletion docs/zh-cn/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,41 @@

> 注意虽然把 `sortable` 属性为 `true` 也可以工作,但是此时 `vue-data-table` 和内置的 `el-table` 都会对数据进行排序,会影响表格的性能。
我们可以通过 `el-table``default-sort` 属性来设置默认的排序列和方向。对于 `vue-data-tables` 来说所有的内置 `el-table` 的属性,都可以通过 [table-props](zh-cn/basic.md?id=传递-prop-给内置的-el-table) 来传递,所以我们可以通过 `:table-props='{ defaultSort: VALUE }'`, 来为 `vue-data-tables` 定义默认排序。

```html
/*vue*/
<desc>
* `sortable="custom"` 很重要
* `tableProps.defaultSort` 定义了默认的排序列
</desc>
<template>
<data-tables
:data='data'
>
<el-table-column v-for="title in titles"
:prop="title.prop"
:label="title.label"
:key="title.label"
sortable="custom">
</el-table-column>
</data-tables>
</template>

<script>
export default {
data() {
return {
data,
titles,
}
}
}
</script>
```

## 默认排序

[前文](zh-cn/basic.md?id=传递-prop-给内置的-el-table)提到的,我们可以通过 `el-table``default-sort` 属性来设置默认的排序列和方向。对于 `vue-data-tables` 来说所有的内置 `el-table` 的属性,都可以通过 [table-props](zh-cn/basic.md?id=传递-prop-给内置的-el-table) 来传递,所以我们可以通过 `:table-props='{ defaultSort: VALUE }'`, 来为 `vue-data-tables` 定义默认排序。

```html
/*vue*/
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"babel-plugin-jsx-v-model": "^2.0.3",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-plugin-vue-jsx-sync": "^0.0.5",
Expand Down
2 changes: 2 additions & 0 deletions test/unit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Vue.use(VueDataTables)
chai.should() // Using Should style
chai.use(sinonChai)

const isHeadlessChrome = /\bHeadlessChrome\//.test(navigator.userAgent)
Vue.config.devtools = !isHeadlessChrome
Vue.config.productionTip = false
Vue.config.silent = true

Expand Down

0 comments on commit b2b09c6

Please sign in to comment.