Skip to content

Commit c88b519

Browse files
committed
successful build
1 parent e07c54d commit c88b519

16 files changed

+5144
-1213
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Temporary Items
6868
# Recommended template: Node.gitignore
6969

7070
node_modules/
71-
dist/
71+
#dist/
7272

7373
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,linux,sass,vue,vuejs
7474

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ yarn install vue-gridjs || npm install vue-gridjs
2222
```js
2323
/* in `main.js` or wherever you specify your global components */
2424
import Grid from 'vue-gridjs'
25-
Vue.component('grid', Grid)
25+
26+
Vue.use(Grid)
2627
```
2728

2829
### Local Registration
@@ -70,17 +71,18 @@ export default {
7071
},
7172
data() {
7273
return {
73-
auto-width: true/false, // boolean
74+
auto-width: true/false, // boolean to automatically set table width
7475
data: { // object containing arrays columns & rows
7576
cols: ['column 1', 'column 2'],
7677
rows: ['row 1: col 1', 'row 1: col 2']
7778
},
7879
from: '.my-element', // string of HTML table selector
79-
language: {} // dictionary object
80-
pagination: true/false || {} // boolean pagination settings object
81-
search: true/false || {} // boolean or search settings object
82-
server: {} // server settings object
83-
sort: true/false || {} // boolean sort settings object
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
8486
width: '100%' // string with css width value
8587
}
8688
}
@@ -94,7 +96,7 @@ export default {
9496

9597
- Website: https://self.agency
9698
- Twitter: [@selfagency_llc](https://twitter.com/selfagency_llc)
97-
- Github: [@selfagency](https://github.com/selfagency)
99+
- Gitlab: [@selfagency](https://gitlab.com/selfagency)
98100
- LinkedIn: [@selfagency](https://linkedin.com/in/selfagency)
99101

100102
## 🤝 Contributing

attributes.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"vue-gridjs/autoWidth": {
3+
"type": "boolean",
4+
"description": "Boolean to automatically set table width. Default: true"
5+
},
6+
"vue-gridjs/from": {
7+
"type": "string",
8+
"description": "String of HTML table selector. Default: undefined"
9+
},
10+
"vue-gridjs/data": {
11+
"type": "object",
12+
"description": "Object containing arrays of columns [cols] & rows [rows]. Default: { cols: [''], rows: [''] }"
13+
},
14+
"vue-gridjs/language": {
15+
"type": "object",
16+
"description": "Localization dictionary object. Default: undefined"
17+
},
18+
"vue-gridjs/pagination": {
19+
"type": ["boolean", "object"],
20+
"description": "Boolean or pagination settings object. Default: true"
21+
},
22+
"vue-gridjs/search": {
23+
"type": ["boolean", "object"],
24+
"description": "Boolean or search settings object. Default: false"
25+
},
26+
"vue-gridjs/server": {
27+
"type": "object",
28+
"description": "Server settings object. Default: undefined"
29+
},
30+
"vue-gridjs/sort": {
31+
"type": ["boolean", "object"],
32+
"description": "Boolean or sort settings object. Default: false"
33+
},
34+
"vue-gridjs/theme": {
35+
"type": "string",
36+
"description": "String with name of theme. Default: 'mermaid'"
37+
},
38+
"vue-gridjs/width": {
39+
"type": "string",
40+
"description": "String with CSS width value. Default: undefined"
41+
}
42+
}

bili.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
// jsCompiler: 'babel',
3+
banner: true,
4+
output: {
5+
extractCSS: false
6+
},
7+
plugins: {
8+
vue: {
9+
css: true
10+
},
11+
scss: true,
12+
babel: {
13+
presets: ['vue', ['@babel/preset-env', { useBuiltIns: 'usage', corejs: 3 }]],
14+
runtimeHelpers: true
15+
}
16+
}
17+
}

dist/index.js

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

0 commit comments

Comments
 (0)