Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow tag template first column #54

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
51 changes: 29 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,46 @@

module.exports = {
root: true,
parser: 'babel-eslint',
parser: "babel-eslint",
parserOptions: {
sourceType: 'module'
sourceType: "module"
},
env: {
browser: true,
browser: true
},
extends: 'airbnb-base',
extends: "airbnb-base",
// required to lint *.vue files
plugins: [
'html'
],
plugins: ["html"],
// check if imports actually resolve
'settings': {
'import/resolver': {
'webpack': {
'config': 'build/webpack.base.conf.js'
settings: {
"import/resolver": {
webpack: {
config: "build/webpack.base.conf.js"
}
}
},
// add your custom rules here
'rules': {
rules: {
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
'js': 'never',
'vue': 'never'
}],
"import/extensions": [
"error",
"always",
{
js: "never",
vue: "never"
}
],
// allow optionalDependencies
'import/no-extraneous-dependencies': ['error', {
'optionalDependencies': ['test/unit/index.js']
}],
"import/no-extraneous-dependencies": [
"error",
{
optionalDependencies: ["test/unit/index.js"]
}
],
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-plusplus': ["error", { "allowForLoopAfterthoughts": true }]
"no-debugger": process.env.NODE_ENV === "production" ? 2 : 0,
"no-plusplus": ["error", {
allowForLoopAfterthoughts: true
}]
}
}
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.DS_Store
node_modules/
lib/
./mocks
mocks/
./mocks/*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
Expand Down
66 changes: 25 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,59 @@
# vue-table-with-tree-grid
# vue-tree-view-table

> A table (with tree-grid) component for Vue.js 2.0. (Its style extends [@iView](https://github.com/iview/iview))

## Example

![Example](./example/example.gif)
> A table (with tree-grid) component for Vue.js 2.0. (Its style extends [vue-table-with-tree-grid](https://github.com/MisterTaki/vue-table-with-tree-grid))

## Installation

Use npm:

```shell
npm i vue-table-with-tree-grid -S
npm i vue-tree-view-table -S
```

Or use yarn:

```shell
yarn add vue-table-with-tree-grid
yarn add vue-tree-view-table
```

## Usage

```javascript
import Vue from 'vue'
import ZkTable from 'vue-table-with-tree-grid'
import SafeTreeview from 'vue-tree-view-table'

Vue.use(ZkTable)
Vue.use(SafeTreeview)
```

Or

```javascript
import Vue from 'vue'
import ZkTable from 'vue-table-with-tree-grid'
import SafeTreeview from 'vue-tree-view-table'

Vue.component(ZkTable.name, ZkTable)
Vue.component(SafeTreeview.name, SafeTreeview)
```

more information please see [example...](https://github.com/MisterTaki/vue-table-with-tree-gird/blob/master/example/Example.vue), or git clone this repository and open dev mode (I will give it a homepage later...).

## API

### Table Attributes

| 属性 | 说明 | 类型 | 参数 | 默认值 |
| Atributo | Descripción | tipo | Parametro | Valor por defecto |
| ---- | ---- | ---- | ---- | ---- |
| data | 表格各行的数据 | Array | - | [] |
| empty-text | 表格数据为空时显示的文字 | String | - | '暂无数据' |
| columns | 表格各列的配置(具体见下文:Columns Configs) | Array | - | [] |
| show-header | 是否显示表头 | Boolean | - | true |
| show-index | 是否显示数据索引 | Boolean | - | false |
| index-text | 数据索引名称 | String | - | '序号' |
| show-summary | 是否显示表尾合计行 | Boolean | - | false |
| sum-text | 表尾合计行首列名称 | String | - | '合计' |
| summary-method | 表尾合计行计算方法 | Function | data, column, columnIndex | - |
| max-height | 最大高度 | [String, Number] | - | 'auto' |
| stripe | 是否显示间隔斑马纹 | Boolean | - | false |
| border | 是否显示纵向边框 | Boolean | - | false |
| show-row-hover | 鼠标悬停时,是否高亮当前行 | Boolean | - | true |
| tree-type | 是否为树形表格 | Boolean | - | false |
| children-prop | 树形表格中遍历的属性名称 | String | - | 'children' |
| is-fold | 树形表格中父级是否默认折叠 | Boolean | - | true |
| data | datos a mostrar | Array | - | [] |
| empty-text | texto a mostrar cuando no tiene datos | String | - | 'Aun no hay datos' |
| columns | configuracion de las columnas de la tabla(ver abajo:Columns Configs) | Array | - | [] |
| show-header | si se muestra el encabezado | Boolean | - | true |
| show-index | si se muestra el indice de datos | Boolean | - | false |
| index-text | nombre del indice de datos | String | - | 'index' |
| show-summary | si se muestra el final total de la tabla | Boolean | - | false |
| sum-text | suma total de la primera fila | String | - | 'total' |
| summary-method | Método de calculo de suma | Function | data, column, columnIndex | - |
| max-height | Tamaño maximo de la tabla | [String, Number] | - | 'auto' |
| stripe | si se muestra el color en intervalo de las filas | Boolean | - | false |
| border | si la tabla tiene bordes | Boolean | - | false |
| show-row-hover | si se colorea cuando pase el cursor por encima | Boolean | - | true |
| tree-type | si es tipo árbol o no | Boolean | - | false |
| children-prop | nombre de la propiedad que contiene los hijos | String | - | 'children' |
| is-fold | si se muestra plegado | Boolean | - | true |
| expand-type | 是否为展开行类型表格(为 True 时,需要添加名称为 '$expand' 的[作用域插槽](https://cn.vuejs.org/v2/guide/components.html#作用域插槽), 它可以获取到 row, rowIndex) | Boolean | - | false |
| selection-type | 是否为多选类型表格 | Boolean | - | false |
| row-key | 行数据的 Key,用来优化 Table 的渲染 | Function | row, rowIndex | rowIndex |
Expand All @@ -87,17 +79,9 @@ more information please see [example...](https://github.com/MisterTaki/vue-table

| 事件名 | 说明 | 参数 |
| ---- | ---- | ---- |
| cell-click | 单击某一单元格 | row, rowIndex, column, columnIndex, $event |
| cell-dblclick | 双击某一单元格 | row, rowIndex, column, columnIndex, $event |
| cell-contextmenu | 在某一单元格上点击鼠标右键 | row, rowIndex, column, columnIndex, $event |
| cell-mouseenter | 鼠标滑入某一单元格 | row, rowIndex, column, columnIndex, $event |
| cell-mouseleave | 鼠标滑出某一单元格 | row, rowIndex, column, columnIndex, $event |
| row-click | 单击某一行 | row, rowIndex, $event |
| row-dblclick | 双击某一行 | row, rowIndex, $event |
| row-contextmenu | 在某一行上点击鼠标右键 | row, rowIndex, $event |
| row-mouseenter | 鼠标滑入某一行 | row, rowIndex, $event |
| row-mouseleave | 鼠标滑出某一行 | row, rowIndex, $event |
| checkbox-click | 鼠标单击checkbox | row, rowIndex, $event |
| tree-icon-click | 鼠标单击树形icon | row, rowIndex, $event |
| expand-cell-click | 鼠标单击展开单元格 | row, rowIndex, $event |

Expand Down
1 change: 0 additions & 1 deletion build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ exports.cssLoaders = function (options) {
var cssLoader = {
loader: 'css-loader',
options: {
minimize: process.env.NODE_ENV === 'production',
sourceMap: options.sourceMap
}
}
Expand Down
34 changes: 17 additions & 17 deletions build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
var path = require('path')
var webpack = require('webpack')
var merge = require('webpack-merge')
var config = require('./config')
var baseWebpackConfig = require('./webpack.base.conf')
var path = require("path");
var webpack = require("webpack");
var merge = require("webpack-merge");
var config = require("./config");
var baseWebpackConfig = require("./webpack.base.conf");

var env = config.build.env
var env = config.build.env;

var webpackConfig = merge(baseWebpackConfig, {
devtool: '#source-map',
devtool: "#source-map",
output: {
path: config.build.assetsRoot,
filename: 'vue-table-with-tree-grid.js',
library: 'vue-table-with-tree-grid',
libraryTarget: 'umd',
filename: "vue-tree-view-table.js",
library: "vue-tree-view-table",
libraryTarget: "umd",
umdNamedDefine: true
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
root: "Vue",
commonjs: "vue",
commonjs2: "vue",
amd: "vue"
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': env
"process.env": env
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
Expand All @@ -34,6 +34,6 @@ var webpackConfig = merge(baseWebpackConfig, {
sourceMap: true
})
]
})
});

module.exports = webpackConfig
module.exports = webpackConfig;
Loading