Skip to content

Commit 03c659a

Browse files
committed
another build attempt
1 parent c88b519 commit 03c659a

15 files changed

+366
-2926
lines changed

README.md

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)
66
[![Twitter: selfagency_llc](https://img.shields.io/twitter/follow/selfagency_llc.svg?style=social)](https://twitter.com/selfagency_llc)
77

8-
> A Vue.js wrapper component for Grid.js
8+
A [Vue.js](https://vuejs.org) wrapper component for [Grid.js](https://grid.io)
99

1010
### 🏠 [Homepage](https://gitlab.com/selfagency/vue-gridjs)
1111

@@ -71,25 +71,46 @@ export default {
7171
},
7272
data() {
7373
return {
74-
auto-width: true/false, // boolean to automatically set table width
75-
data: { // object containing arrays columns & rows
74+
autoWidth: true / false, // boolean to automatically set table width
75+
data: {
76+
// object containing arrays columns & rows
7677
cols: ['column 1', 'column 2'],
7778
rows: ['row 1: col 1', 'row 1: col 2']
7879
},
79-
from: '.my-element', // string of HTML table selector
80-
language: {}, // localization dictionary object
81-
pagination: true/false || {}, // boolean or pagination settings object
82-
search: true/false || {}, // boolean or search settings object
83-
server: {}, // server settings object
84-
sort: true/false || {}, // boolean or sort settings object
85-
theme: 'mermaid', // string with name of theme
86-
width: '100%' // string with css width value
80+
from: '.my-element', // string of HTML table selector
81+
language: {}, // localization dictionary object
82+
pagination: true / false || {}, // boolean or pagination settings object
83+
search: true / false || {}, // boolean or search settings object
84+
server: {}, // server settings object
85+
sort: true / false || {}, // boolean or sort settings object
86+
theme: 'mermaid', // string with name of theme
87+
width: '100%' // string with css width value
8788
}
8889
}
8990
}
9091
</script>
9192
```
9293

94+
### Default settings
95+
96+
```json
97+
{
98+
"autoWidth": true,
99+
"data": {
100+
"cols": [""],
101+
"rows": [""]
102+
},
103+
"from": undefined,
104+
"language": undefined,
105+
"pagination": false,
106+
"search": false,
107+
"server": undefined,
108+
"sort": false,
109+
"theme": "mermaid",
110+
"width": "100%"
111+
}
112+
```
113+
93114
## Author
94115

95116
👤 **Daniel Sieradski <[email protected]>**

bili.config.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
module.exports = {
2-
// jsCompiler: 'babel',
2+
jsCompiler: 'babel',
33
banner: true,
4+
input: 'src/index.js',
45
output: {
5-
extractCSS: false
6+
fileName: 'vue-gridjs.js',
7+
format: ['cjs', 'esm', 'umd'],
8+
extractCSS: false,
9+
bundleNodeModules: true,
10+
minify: true,
11+
moduleName: 'Grid'
612
},
713
plugins: {
814
vue: {
@@ -11,7 +17,10 @@ module.exports = {
1117
scss: true,
1218
babel: {
1319
presets: ['vue', ['@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 }]],
14-
runtimeHelpers: true
15-
}
20+
runtimeHelpers: true,
21+
exclude: 'node_modules/**',
22+
configFile: false
23+
},
24+
'node-resolve': true
1625
}
1726
}

dist/index.esm.js

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
/*!
2+
* vue-gridjs v0.1.0
3+
* (c)
4+
*/
5+
import 'core-js/modules/es.object.to-string';
6+
import 'core-js/modules/es.promise';
7+
import 'core-js/modules/es.regexp.exec';
8+
import 'core-js/modules/es.string.search';
9+
import { Grid } from 'gridjs';
10+
import uuid from 'uuid-random';
11+
import elementReady from 'element-ready';
12+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.mjs';
13+
import __vue_create_injector__ from 'vue-runtime-helpers/dist/inject-style/browser.mjs';
14+
15+
function _await(value, then, direct) {
16+
if (direct) {
17+
return then ? then(value) : value;
18+
}
19+
20+
if (!value || !value.then) {
21+
value = Promise.resolve(value);
22+
}
23+
24+
return then ? value.then(then) : value;
25+
}
26+
27+
var script = {
28+
name: 'Grid',
29+
props: {
30+
autoWidth: {
31+
type: Boolean,
32+
default: true
33+
},
34+
from: {
35+
type: String,
36+
default: undefined
37+
},
38+
data: {
39+
type: Object,
40+
default: function _default() {
41+
return {
42+
cols: ['Table is null'],
43+
rows: ['Please add some data']
44+
};
45+
}
46+
},
47+
language: {
48+
type: Object,
49+
default: undefined
50+
},
51+
pagination: {
52+
type: [Object, Boolean],
53+
default: false
54+
},
55+
search: {
56+
type: [Object, Boolean],
57+
default: false
58+
},
59+
server: {
60+
type: Object,
61+
default: undefined
62+
},
63+
sort: {
64+
type: [Object, Boolean],
65+
default: false
66+
},
67+
theme: {
68+
type: String,
69+
default: 'mermaid'
70+
},
71+
width: {
72+
type: String,
73+
default: '100%'
74+
}
75+
},
76+
data: function data() {
77+
return {
78+
uuid: null,
79+
wrapper: null
80+
};
81+
},
82+
mounted: function mounted() {
83+
try {
84+
var _this2 = this;
85+
86+
// give table a unique id
87+
_this2.uuid = uuid(); // select the unique wrapper element
88+
89+
return _await(elementReady("[data-uuid=\"".concat(_this2.uuid, "\"]")), function (_elementReady) {
90+
_this2.wrapper = _elementReady;
91+
92+
if (_this2.data && _this2.data.rows || _this2.server || _this2.from) {
93+
_this2.grid = new Grid({
94+
autoWidth: false,
95+
columns: _this2.data.cols,
96+
data: _this2.data.rows,
97+
from: _this2.from,
98+
pagination: _this2.pagination,
99+
search: _this2.search,
100+
server: _this2.server,
101+
sort: _this2.sort,
102+
width: _this2.width
103+
}).render(_this2.wrapper);
104+
}
105+
}); // instantiate grid.js
106+
} catch (e) {
107+
return Promise.reject(e);
108+
}
109+
},
110+
destroyed: function destroyed() {
111+
// unload from memory
112+
this.grid = undefined;
113+
this.wrapper = undefined;
114+
}
115+
};
116+
117+
/* script */
118+
var __vue_script__ = script;
119+
/* template */
120+
121+
var __vue_render__ = function __vue_render__() {
122+
var _vm = this;
123+
124+
var _h = _vm.$createElement;
125+
126+
var _c = _vm._self._c || _h;
127+
128+
return _c('article', {
129+
class: "gridjs__wrapper " + _vm.theme,
130+
attrs: {
131+
"data-uuid": _vm.uuid
132+
}
133+
});
134+
};
135+
136+
var __vue_staticRenderFns__ = [];
137+
/* style */
138+
139+
var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
140+
if (!inject) return;
141+
inject("data-v-68133c66_0", {
142+
source: ".mermaid[data-v-68133c66]{@import '~gridjs/dist/theme/mermaid.css';}",
143+
map: undefined,
144+
media: undefined
145+
});
146+
};
147+
/* scoped */
148+
149+
150+
var __vue_scope_id__ = "data-v-68133c66";
151+
/* module identifier */
152+
153+
var __vue_module_identifier__ = undefined;
154+
/* functional template */
155+
156+
var __vue_is_functional_template__ = false;
157+
/* style inject SSR */
158+
159+
/* style inject shadow dom */
160+
161+
var __vue_component__ = /*#__PURE__*/__vue_normalize__({
162+
render: __vue_render__,
163+
staticRenderFns: __vue_staticRenderFns__
164+
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, __vue_create_injector__, undefined, undefined);
165+
166+
function install(Vue) {
167+
if (install.installed) return;
168+
install.installed = true;
169+
Vue.component('Grid', __vue_component__);
170+
}
171+
var plugin = {
172+
install: install
173+
};
174+
var GlobalVue = null;
175+
176+
if (typeof window !== 'undefined') {
177+
GlobalVue = window.Vue;
178+
} else if (typeof global !== 'undefined') {
179+
GlobalVue = global.Vue;
180+
}
181+
182+
if (GlobalVue) {
183+
GlobalVue.use(plugin);
184+
}
185+
186+
export default __vue_component__;
187+
export { install };

0 commit comments

Comments
 (0)