Skip to content

Commit 6fd72d5

Browse files
committed
update to webpack 5, fix upstream role='role' tag removal
1 parent d8f5562 commit 6fd72d5

File tree

10 files changed

+19048
-20620
lines changed

10 files changed

+19048
-20620
lines changed

example/index.js

Lines changed: 631 additions & 926 deletions
Large diffs are not rendered by default.

example/index.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.

example/mix-manifest.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"/index.js": "/index.js",
3-
"/index.js.map": "/index.js.map"
2+
"/index.js": "/index.js"
43
}

lib/index.js

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

lib/index.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.

lib/mix-manifest.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"/index.js": "/index.js?id=c3150f74252920b08c5b",
3-
"/index.js.map": "/index.js.map?id=e18a32d01cac4489a1f2"
2+
"/index.js": "/index.js?id=c2bfed2c49b23d12ebcc"
43
}

package-lock.json

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

package.json

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-datatables-net",
33
"description": "Vue jQuery DataTables.net wrapper component",
4-
"version": "1.3.0",
4+
"version": "1.4.0",
55
"author": "[email protected]",
66
"license": "MIT",
77
"main": "lib/index.js",
@@ -13,13 +13,11 @@
1313
"url": "https://github.com/niiknow/vue-datatables-net.git"
1414
},
1515
"scripts": {
16-
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
17-
"watch-poll": "npm run watch -- --watch-poll",
16+
"watch": "mix watch",
17+
"watch-poll": "mix watch -- --watch-options-poll=1000",
1818
"watch-late-schema": "cross-env EXAMPLE=late-schema npm run watch",
1919
"build": "npm run production",
20-
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
21-
"test": "cross-env NODE_ENV=test mocha-webpack --webpack-config=node_modules/laravel-mix/setup/webpack.config.js --require tests/setup.js tests/**/*.spec.js",
22-
"watch-test": "cross-env NODE_ENV=test mocha-webpack --webpack-config=node_modules/laravel-mix/setup/webpack.config.js --watch --require tests/setup.js tests/**/*.spec.js",
20+
"production": "mix --production",
2321
"lint": "eslint --ext .js,.vue src/ example/app.*",
2422
"lint-fix": "eslint --fix --ext .js,.vue src/ example/app.*",
2523
"check-outdated": "npm outdated"
@@ -34,30 +32,30 @@
3432
"vue": ">=2.0.0"
3533
},
3634
"devDependencies": {
37-
"@babel/core": "^7.10.4",
38-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
35+
"@babel/core": "^7.12.10",
36+
"@babel/preset-env": "^7.12.11",
3937
"babel-eslint": "^10.1.0",
40-
"bootstrap": "^4.5.0",
41-
"browser-sync": "^2.26.7",
42-
"browser-sync-webpack-plugin": "^2.0.1",
43-
"cross-env": "^5.2.1",
44-
"css-loader": "^2.1.0",
45-
"datatables.net-bs4": "^1.10.21",
46-
"datatables.net-buttons-bs4": "^1.6.2",
47-
"datatables.net-responsive": "^2.2.5",
48-
"datatables.net-responsive-bs4": "^2.2.5",
38+
"babel-loader": "^8.2.2",
39+
"bootstrap": "^4.5.3",
40+
"browser-sync": "^2.26.13",
41+
"browser-sync-webpack-plugin": "^2.3.0",
42+
"cross-env": "^7.0.3",
43+
"css-loader": "^5.0.1",
44+
"datatables.net-bs4": "^1.10.23",
45+
"datatables.net-buttons-bs4": "^1.6.5",
46+
"datatables.net-responsive": "^2.2.7",
47+
"datatables.net-responsive-bs4": "^2.2.7",
4948
"datatables.net-select-bs4": "^1.3.1",
50-
"eslint": "^5.16.0",
51-
"eslint-config-prettier": "^4.3.0",
49+
"eslint": "^7.17.0",
50+
"eslint-config-prettier": "^7.1.0",
5251
"eslint-friendly-formatter": "^4.0.1",
53-
"eslint-loader": "^2.2.1",
54-
"eslint-plugin-import": "^2.22.0",
55-
"eslint-plugin-vue": "^5.2.3",
56-
"file-loader": "^3.0.1",
57-
"jquery": "^3.5.1",
58-
"laravel-mix": "^5.0.9",
59-
"vue": "^2.6.11",
60-
"vue-loader": "^15.9.3",
61-
"vue-template-compiler": "^2.6.11"
52+
"eslint-plugin-vue": "^7.4.1",
53+
"eslint-webpack-plugin": "^2.4.1",
54+
"file-loader": "^6.2.0",
55+
"laravel-mix": "^6.0.6",
56+
"vue": "^2.6.12",
57+
"vue-loader": "^15.9.6",
58+
"vue-template-compiler": "^2.6.12",
59+
"webpack": "^5.12.0"
6260
}
6361
}

src/VdtnetTable.vue

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -497,27 +497,28 @@ export default {
497497
$el.on('click', '[data-action]', (e) => {
498498
e.preventDefault()
499499
e.stopPropagation()
500+
500501
let target = jq(e.target)
501-
let action = target.attr('data-action')
502-
while(!action) {
503-
// don't let it propagate outside of container
504-
if (target.hasClass('vdtnet-container') ||
505-
target.prop('tagName') === 'table') {
506-
// no action, simply exit
507-
return
502+
let action = target.attr('data-action')
503+
504+
// no action, simply exit
505+
if (!action) {
506+
return
507+
} else {
508+
let tr = target
509+
510+
// detect if action is inside a row
511+
// get data from parent row/tr
512+
if (target.prop('tagName') !== 'TR') {
513+
tr = target.closest('tr')
508514
}
509-
target = target.parent()
510-
action = target.attr('data-action')
511-
}
512515
513-
// only emit if there is action
514-
if (action) {
515-
// detect if row action
516-
let tr = target.closest('tr')
517516
if (tr) {
518-
if (tr.attr('role') !== 'row') {
517+
// if child row, get previous/parent row
518+
if (tr.hasClass('master-details')) {
519519
tr = tr.prev()
520520
}
521+
521522
const row = that.dataTable.row(tr)
522523
const data = row.data()
523524
that.$emit(action, data, row, tr, target)
@@ -550,20 +551,22 @@ export default {
550551
e.stopPropagation()
551552
const target = jq(e.target)
552553
let tr = target.closest('tr')
553-
if (tr.attr('role') !== 'row') {
554+
555+
if (tr.hasClass('master-details')) {
554556
tr = tr.prev()
555557
}
558+
556559
const row = that.dataTable.row( tr )
560+
557561
if ( row.child.isShown() ) {
558562
// This row is already open - close it
559563
row.child.hide()
560564
tr.removeClass('master')
561-
}
562-
else {
565+
} else {
563566
// Open this row
564567
const data = row.data()
565568
row.child( renderFunc(data, 'child', row, tr) ).show()
566-
tr.addClass('master')
569+
tr.addClass('master').next().addClass('master-details')
567570
}
568571
})
569572
}

webpack.mix.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
const path = require('path');
2-
const mix = require('laravel-mix');
3-
const public = mix.inProduction() ? 'lib' : 'example';
1+
const webpack = require('webpack');
2+
const path = require('path');
3+
const mix = require('laravel-mix');
4+
const public = mix.inProduction() ? 'lib' : 'example';
5+
const ESLintPlugin = require('eslint-webpack-plugin');
46

57
mix.setPublicPath(path.normalize(public));
68

@@ -10,19 +12,7 @@ const config = {
1012
'vue': 'Vue'
1113
},
1214
module: {
13-
rules: [
14-
{
15-
enforce: 'pre',
16-
test: /\.(vue|js)$/,
17-
exclude: /(node_modules|bower_components)/,
18-
loader: 'eslint-loader',
19-
options: {
20-
fix: false,
21-
cache: false,
22-
formatter: require('eslint-friendly-formatter')
23-
}
24-
}
25-
]
15+
rules: []
2616
},
2717
output: {
2818
path: path.resolve(public),
@@ -36,19 +26,25 @@ const config = {
3626
inline: true,
3727
quiet: false
3828
},
39-
devtool: 'cheap-source-map'
29+
devtool: 'cheap-source-map',
30+
plugins: [
31+
new webpack.ProvidePlugin({
32+
Promise: 'es6-promise'
33+
}),
34+
new ESLintPlugin()
35+
]
4036
};
4137

4238
mix.webpackConfig(config).sourceMaps();
4339

4440
if (mix.inProduction()) {
45-
mix.js(`src/index.js`, `${ public }`);
41+
mix.js(`src/index.js`, `${ public }`).vue();
4642
mix.version();
4743
mix.disableNotifications();
4844
} else {
4945
const exampleName = process.env.EXAMPLE || 'app'
5046

51-
mix.js(`example/${exampleName}.js`, `${ public }`);
47+
mix.js(`example/${exampleName}.js`, `${ public }`).vue();
5248
mix.browserSync({
5349
proxy: false,
5450
port: 3000,

0 commit comments

Comments
 (0)