Skip to content

Commit d00b2de

Browse files
author
Andrea
committed
Merge branch 'dev' for release of 2.5.0
2 parents c889acc + bb6e6e1 commit d00b2de

27 files changed

+5847
-1115
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ node_modules/
33
npm-debug.log
44
selenium-debug.log
55
test/unit/coverage
6+
test/unit-functions/coverage
67
test/e2e/reports
78
.idea/

README.md

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
[![Join the chat at https://gitter.im/gurghet/vue-smart-table](https://badges.gitter.im/gurghet/vue-smart-table.svg)](https://gitter.im/gurghet/vue-smart-table?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44
[![npm](https://img.shields.io/npm/dt/vue-smart-table.svg?maxAge=2592000)](https://www.npmjs.com/package/vue-smart-table)
5+
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&maxAge=2592000)](http://twitter.com/share?text=Cut%20development%20time.%20Smart%20Table%20renders%20cool%20ui%20grids%20with%200%20effort%20and%20max%20modularity&url=http://bit.ly/29TxlG6)
56

6-
> A vue table with dynamic components
7+
> Vue Smart Table lets you deploy beautiful tables when you are in a hurry and all you got is a tangled json from the backend.
8+
9+
> After such a hack you are left with super mainainable code because the table is completely modular and divided in components.
10+
11+
> You can then pick it up and perfect your work without long rewrites.
712
813
## Usage
914

@@ -14,7 +19,7 @@ Basically you write this
1419
:auto-load="true"
1520
body-path="results"
1621
id-col="id.value"
17-
endpoint="http://api.randomuser.me/?page=1&results=20"
22+
endpoint="http://api.randomuser.me/?results=20"
1823
:header="[
1924
{key: 'name.first', label: 'name'},
2025
{key: 'name.last', label: 'surname'},
@@ -25,10 +30,10 @@ Basically you write this
2530
]"
2631
:order-by="['name.first', 'name.last']"
2732
>
28-
<src2img slot="picture.thumbnail"></src2img><!-- renders pictures -->
29-
<contacts slot="phone+cell"></contacts><!-- custom formatting -->
30-
<nationality slot="nat"></nationality><!-- queries a remote server for country code to country name conversion -->
31-
<fontawesome slot="gender"></fontawesome><!-- font awesome! -->
33+
<src2img col="picture.thumbnail"></src2img><!-- renders pictures -->
34+
<contacts col="phone+cell"></contacts><!-- custom formatting -->
35+
<nationality col="nat"></nationality><!-- queries a remote server for country code to country name conversion -->
36+
<fontawesome col="gender"></fontawesome><!-- font awesome! -->
3237
</smart-table>
3338
```
3439

@@ -40,7 +45,7 @@ and you get this
4045

4146
## Installation
4247

43-
#### Webpack/Browserify
48+
#### If you use Webpack/Browserify
4449

4550
``` bash
4651
npm install vue-smart-table --save
@@ -52,17 +57,43 @@ In your app then you write:
5257
import SmartTable from "vue-smart-table"
5358
Vue.component('smart-table', SmartTable)
5459
```
60+
Alternatively you can add it to your components options
61+
62+
``` javascript
63+
import SmartTable from "vue-smart-table"
64+
// ...
65+
components: {
66+
'smart-table': SmartTable
67+
}
68+
// ...
69+
```
70+
In Webpack you will have to transpile some `.js` files inside the vue-smart-table, since the `node_modules` directory it’s excluded by default in the `vue-cli` template, remember to enable it. This means that if your js loader is like this:
71+
72+
``` javascript
73+
{
74+
test: /\.js$/,
75+
loader: 'babel',
76+
include: projectRoot,
77+
exclude: /node_modules/ // <-- this needs to be changed
78+
}
79+
```
80+
You will have to spare the folder `node_modules/vue-smart-table/src/components` from exclusion. Just turn the `exclude` property to:
81+
82+
`eclude: /node_modules(?!\/vue-smart-table\/src\/components)/`
5583

56-
#### &lt;script&gt; tag inside your page
84+
#### If you use the &lt;script&gt; tag inside your page
85+
86+
This is ideal if you are using Smart Table as a drop-in component in a bigger project that is *not* based on Vue.js
87+
88+
The `vue-smart-table.js` does not contain `vue` and `vue-resources` dependencies, those will also need to be on the page.
5789

5890
``` html
59-
<!-- optional in your head -->
60-
<link rel="stylesheet" href="https://npmcdn.com/[email protected]/dist/static/vue-smart-table-default.css">
61-
<!-- at the end of your body -->
62-
<script src="https://npmcdn.com/[email protected]/dist/static/vue-smart-table.js"></script>
91+
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-smart-table/2.5.0-beta1/vue-smart-table.js"></script>
92+
<!-- or -->
93+
<script src="https://npmcdn.com/[email protected]/dist/static/vue-smart-table.js"></script>
6394
```
6495

65-
That’s it! The component will register itself!
96+
That’s it! The component will register itself! Remember do add a `min.js` when going in production.
6697

6798
---
6899

@@ -74,14 +105,12 @@ After that you can freely use it in your templates:
74105

75106
## Documentation
76107

77-
For the moment being I'll collect some documentation at the following link:
78-
79-
http://forum.vuejs.org/topic/4140/vue-smart-table
80-
81-
I'm also writing the wiki
108+
You will find documentation at the wiki page (although there is no versioning there, so heads up)
82109

83110
[Documentation](https://github.com/gurghet/vue-smart-table/wiki)
84111

112+
For more information visit: http://forum.vuejs.org/topic/4140/vue-smart-table
113+
85114
The format of the `body` prop is like the following:
86115

87116
```
@@ -104,6 +133,8 @@ npm run build
104133
# run unit tests
105134
# always run unit tests! D:<
106135
npm run ~unit
136+
# for the body parsing run
137+
npm run ~funit
107138
```
108139

109140
## Roadmap
@@ -121,7 +152,7 @@ npm run ~unit
121152
* [ ] Inline validation
122153
* [ ] Drag row to reorder
123154
* [ ] Filtering
124-
* [ ] Client side
155+
* [x] Client side
125156
* [ ] Server side
126157

127158
## Similar Components
@@ -132,6 +163,15 @@ Here is a list of similar components that also display a table:
132163

133164
##Changelog
134165

166+
###2.5.0
167+
168+
- Complete engine rewrite!
169+
- Core logic was ~100 lines, now only ~15
170+
- Such maintainance
171+
- Many development speed
172+
- wow!
173+
- [Feature] Client filtering is now supported through the `filter` event
174+
135175
###2.4.3
136176

137177
- [Fix] Polyfill for find added for Chrome for Android

build/build2.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// https://github.com/shelljs/shelljs
2+
require('shelljs/global')
3+
env.NODE_ENV = 'production'
4+
5+
var path = require('path')
6+
var config = require('../config')
7+
var ora = require('ora')
8+
var webpack = require('webpack')
9+
var webpackConfig = require('./webpack.prod2.conf')
10+
11+
console.log(
12+
' Tip:\n' +
13+
' Built files are meant to be served over an HTTP server.\n' +
14+
' Opening index.html over file:// won\'t work.\n'
15+
)
16+
17+
var spinner = ora('building for production2...')
18+
spinner.start()
19+
20+
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
21+
// rm('-rf', assetsPath)
22+
// mkdir('-p', assetsPath)
23+
// cp('-R', 'static/', assetsPath)
24+
25+
webpack(webpackConfig, function (err, stats) {
26+
spinner.stop()
27+
if (err) throw err
28+
process.stdout.write(stats.toString({
29+
colors: true,
30+
modules: false,
31+
children: false,
32+
chunks: false,
33+
chunkModules: false
34+
}) + '\n')
35+
})

build/pub.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// https://github.com/shelljs/shelljs
2+
require('shelljs/global')
3+
exec('npm run build && npm publish');

build/webpack.prod.conf.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ module.exports = merge(baseWebpackConfig, {
1414
app: './src/vue-smart-table.js'
1515
},
1616
module: {
17-
loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true })
17+
loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: false })
1818
},
1919
devtool: config.build.productionSourceMap ? '#source-map' : false,
2020
output: {
2121
path: config.build.assetsRoot, // dist directory
22-
filename: utils.assetsPath('vue-smart-table.js'),
22+
filename: utils.assetsPath('vue-smart-table.min.js'),
2323
library: "SmartTable",
2424
libraryTarget: "umd"
2525
},
2626
vue: {
2727
loaders: utils.cssLoaders({
2828
sourceMap: config.build.productionSourceMap,
29-
extract: true
29+
extract: false
3030
})
3131
},
3232
externals: {
@@ -43,10 +43,6 @@ module.exports = merge(baseWebpackConfig, {
4343
warnings: false
4444
}
4545
}),
46-
new webpack.optimize.OccurenceOrderPlugin(),
47-
// extract css into its own file
48-
new ExtractTextPlugin(utils.assetsPath('vue-smart-table-default.css'))
49-
// extract webpack runtime and module manifest to its own file in order to
50-
// prevent vendor hash from being updated whenever app bundle is updated
46+
new webpack.optimize.OccurenceOrderPlugin()
5147
]
5248
})

build/webpack.prod2.conf.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
var path = require('path')
2+
var config = require('../config')
3+
var utils = require('./utils')
4+
var webpack = require('webpack')
5+
var merge = require('webpack-merge')
6+
var baseWebpackConfig = require('./webpack.base.conf')
7+
var ExtractTextPlugin = require('extract-text-webpack-plugin')
8+
var env = process.env.NODE_ENV === 'testing'
9+
? require('../config/test.env')
10+
: config.dev.env
11+
12+
module.exports = merge(baseWebpackConfig, {
13+
entry: {
14+
app: './src/vue-smart-table.js'
15+
},
16+
module: {
17+
loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: false })
18+
},
19+
devtool: config.build.productionSourceMap ? '#source-map' : false,
20+
output: {
21+
path: config.build.assetsRoot, // dist directory
22+
filename: utils.assetsPath('vue-smart-table.js'),
23+
library: "SmartTable",
24+
libraryTarget: "umd"
25+
},
26+
vue: {
27+
loaders: utils.cssLoaders({
28+
sourceMap: config.build.productionSourceMap,
29+
extract: false
30+
})
31+
},
32+
externals: {
33+
'vue': 'Vue',
34+
'vue-resource': 'VueResource'
35+
},
36+
plugins: [
37+
// http://vuejs.github.io/vue-loader/workflow/production.html
38+
new webpack.DefinePlugin({
39+
'process.env': env
40+
}),
41+
new webpack.optimize.OccurenceOrderPlugin()
42+
]
43+
})

dist/static/vue-smart-table-default.css

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/static/vue-smart-table-default.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/static/vue-smart-table.js

Lines changed: 4397 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/static/vue-smart-table.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)