diff --git a/packages/data-table-view/package.json b/packages/data-table-view/package.json index f629063d19fdd2a46b50fafe3d6f8aa92b4f1741..7611f19f4abcdec58a04567a98587c962a0afc0e 100644 --- a/packages/data-table-view/package.json +++ b/packages/data-table-view/package.json @@ -12,15 +12,16 @@ "mocha": "^6.2.0", "chai": "^4.2.0", "rollup": "^1.11.3", - "rollup-plugin-commonjs": "^9.3.4", - "rollup-plugin-copy": "^2.0.1", - "rollup-plugin-node-resolve": "^4.2.3", - "rollup-plugin-postcss": "^2.0.3", - "rollup-plugin-serve": "^1.0.1", - "rollup-plugin-terser": "^4.0.4", + "rollup-plugin-commonjs": "^10.0.2", + "rollup-plugin-copy": "^3.1.0", "rollup-plugin-json": "^4.0.0", - "rollup-plugin-replace": "^2.2.0", "rollup-plugin-multi-entry": "^2.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-postcss": "^2.0.3", + "rollup-plugin-replace": "^2.2.0", + "rollup-plugin-serve": "^1.0.1", + "rollup-plugin-terser": "^5.1.1", + "rollup-plugin-url": "^2.2.2", "i18next-scanner": "^2.10.2", "vpu-auth": "file:./vendor/auth", "vpu-common": "file:./vendor/common" @@ -32,7 +33,7 @@ "datatables.net-responsive-dt": "^2.2.3", "i18next": "^17.0.3", "jquery": "^3.4.1", - "lit-element": "^2.1.0", + "lit-element": "^2.2.1", "lit-html": "^1.1.1" }, "scripts": { diff --git a/packages/data-table-view/rollup.config.js b/packages/data-table-view/rollup.config.js index 88cddf15a64e848e721b6f85e6de5f13212dd83d..26e5d9376f75d0f4da0fbb2604f45c4279c01b32 100644 --- a/packages/data-table-view/rollup.config.js +++ b/packages/data-table-view/rollup.config.js @@ -1,58 +1,78 @@ +import path from 'path'; import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; -import postcss from 'rollup-plugin-postcss'; import copy from 'rollup-plugin-copy'; import {terser} from "rollup-plugin-terser"; import json from 'rollup-plugin-json'; import replace from "rollup-plugin-replace"; import serve from 'rollup-plugin-serve'; import multiEntry from 'rollup-plugin-multi-entry'; +import url from "rollup-plugin-url"; +const pkg = require('./package.json'); const build = (typeof process.env.BUILD !== 'undefined') ? process.env.BUILD : 'local'; console.log("build: " + build); +let manualChunks = Object.keys(pkg.dependencies).reduce(function (acc, item) { acc[item] = [item]; return acc;}, {}); +manualChunks = Object.keys(pkg.devDependencies).reduce(function (acc, item) { if (item.startsWith('vpu-')) acc[item] = [item]; return acc;}, manualChunks); + export default { input: (build !== 'test') ? 'src/demo.js' : 'test/**/*.js', output: { - file: 'dist/bundle.js', + dir: 'dist', + entryFileNames: pkg.name + '.js', + chunkFileNames: 'shared/[name].[hash].[format].js', format: 'esm' }, + manualChunks: manualChunks, + onwarn: function (warning, warn) { + // ignore "suggestions" warning re "use strict" + if (warning.code === 'MODULE_LEVEL_DIRECTIVE') { + return; + } + throw new Error(warning); + }, + watch: { + chokidar: true, + }, plugins: [ - multiEntry(), - resolve(), + (build == 'test') ? multiEntry() : false, + resolve({ + customResolveOptions: { + // ignore node_modules from vendored packages + moduleDirectory: path.join(process.cwd(), 'node_modules') + } + }), commonjs({ include: 'node_modules/**' }), json(), + url({ + limit: 0, + include: [ + "node_modules/bulma/**/*.css", + "node_modules/bulma/**/*.sass", + ], + emitFiles: true, + fileName: 'shared/[name].[hash][extname]' + }), replace({ "process.env.BUILD": '"' + build + '"', }), - postcss({ - inject: false, - minimize: false, - plugins: [] - }), (build !== 'local' && build !== 'test') ? terser() : false, copy({ targets: [ - 'assets/index.html', - 'assets/favicon.ico' - ], - outputFolder: 'dist' - }), - copy({ - targets: [ - 'node_modules/datatables.net-dt/css', - 'node_modules/datatables.net-dt/images', - 'node_modules/datatables.net-responsive-dt/css' - ], - outputFolder: 'dist/datatables' - }), - copy({ - targets: [ - 'assets/datatables/i18n' + {src: 'assets/index.html', dest: 'dist', rename: pkg.name + '.html'}, + {src: 'assets/*.css', dest: 'dist/local/' + pkg.name}, + {src: 'assets/*.ico', dest: 'dist/local/' + pkg.name}, + {src: 'node_modules/vpu-common/vpu-spinner.js', dest: 'dist/local/' + pkg.name, rename: 'spinner.js'}, + {src: 'node_modules/material-design-icons-svg/paths/*.json', dest: 'dist/local/vpu-common/icons'}, + + {src: 'node_modules/datatables.net-dt/css', dest: 'dist/local/vpu-data-table-view'}, + {src: 'node_modules/datatables.net-dt/images', dest: 'dist/local/vpu-data-table-view'}, + {src: 'node_modules/datatables.net-responsive-dt/css', dest: 'dist/local/vpu-data-table-view'}, + {src: 'assets/datatables/i18n', dest: 'dist/local/vpu-data-tables-view'} ], - outputFolder: 'dist/datatables/' }), (process.env.ROLLUP_WATCH === 'true') ? serve({contentBase: 'dist', host: '127.0.0.1', port: 8003}) : false diff --git a/packages/data-table-view/src/data-table-view.js b/packages/data-table-view/src/data-table-view.js index 32ba17fc2202de3411f806575e331b614dca6bd9..9e13aead307ed9a8c26647c84f008708fef1631c 100644 --- a/packages/data-table-view/src/data-table-view.js +++ b/packages/data-table-view/src/data-table-view.js @@ -20,6 +20,7 @@ class DataTableView extends LitElement { this.responsive = null; this.paging = false; this.searching = false; + this.columnDef = []; } static get properties() { @@ -28,9 +29,14 @@ class DataTableView extends LitElement { table: { type: Object, attribute: false }, paging: { type: Boolean }, searching: { type: Boolean }, + columnDef: { type: Array, attribute: false }, }; } + set_columnDef(def) { + this.columnDef = def; + } + set_datatable() { const lang_de_url = 'datatables/i18n/German.json'; const lang_en_url = 'datatables/i18n/English.json'; @@ -45,6 +51,7 @@ class DataTableView extends LitElement { }, paging: this.paging, searching: this.searching, + columnDef: this.columnDef, }); try { diff --git a/packages/data-table-view/vendor/auth b/packages/data-table-view/vendor/auth index a653f5e57c0adc69ed27dc5ff769b02c53e58fbb..b4b3094501b87763e3b2bdcca79176975ca745a7 160000 --- a/packages/data-table-view/vendor/auth +++ b/packages/data-table-view/vendor/auth @@ -1 +1 @@ -Subproject commit a653f5e57c0adc69ed27dc5ff769b02c53e58fbb +Subproject commit b4b3094501b87763e3b2bdcca79176975ca745a7 diff --git a/packages/data-table-view/vendor/common b/packages/data-table-view/vendor/common index e222390de095b9c7bee33caab7b080bdf3571ba5..f65096b99b737a046d07ad6616eec31788850422 160000 --- a/packages/data-table-view/vendor/common +++ b/packages/data-table-view/vendor/common @@ -1 +1 @@ -Subproject commit e222390de095b9c7bee33caab7b080bdf3571ba5 +Subproject commit f65096b99b737a046d07ad6616eec31788850422