Skip to content

Commit 12eebaf

Browse files
committed
start of migration to vue-cli
1 parent 3153274 commit 12eebaf

38 files changed

+4444
-3292
lines changed

.browserslistrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not ie <= 8

.eslintrc.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true
5+
},
6+
'extends': [
7+
'plugin:vue/essential',
8+
'eslint:recommended'
9+
],
10+
rules: {
11+
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
13+
},
14+
parserOptions: {
15+
parser: 'babel-eslint'
16+
}
17+
}

.gitignore

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
.DS_Store
22
node_modules
3-
build
4-
npm-debug.log
5-
.idea
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw*
22+
23+
yarn.lock
24+
yarn-error.log

.babelrc renamed to OLD/.babelrc

File renamed without changes.
File renamed without changes.

OLD/package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "vue-grid-layout",
3+
"version": "2.1.13",
4+
"description": "A draggable and resizable grid layout, as a Vue component.",
5+
"keywords": [
6+
"grid",
7+
"vuejs",
8+
"drag",
9+
"draggable",
10+
"resize",
11+
"resizable",
12+
"fluid",
13+
"responsive"
14+
],
15+
"main": "dist/vue-grid-layout.min.js",
16+
"scripts": {
17+
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --inline --hot",
18+
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
19+
"dist": "webpack --progress --hide-modules --config webpack.build.js && cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.build.min.js"
20+
},
21+
"repository": {
22+
"type": "git",
23+
"url": "https://github.com/jbaysolutions/vue-grid-layout.git"
24+
},
25+
"author": "Gustavo Santos (JBay Solutions) <[email protected]> (http://www.jbaysolutions.com)",
26+
"dependencies": {
27+
"element-resize-detector": "^1.1.10",
28+
"interactjs": "^1.3.3"
29+
},
30+
"devDependencies": {
31+
"babel-core": "^6.26.0",
32+
"babel-loader": "^7.1.2",
33+
"babel-plugin-transform-flow-comments": "^6.7.0",
34+
"babel-plugin-transform-runtime": "^6.0.0",
35+
"babel-preset-es2015": "^6.0.0",
36+
"babel-preset-es2015-loose": "^7.0.0",
37+
"babel-preset-stage-1": "^6.5.0",
38+
"cross-env": "^3.0.0",
39+
"css-loader": "^0.25.0",
40+
"file-loader": "^0.9.0",
41+
"vue": "^2.2.6",
42+
"vue-loader": "^11.1.4",
43+
"vue-template-compiler": "^2.2.6",
44+
"webpack": "^3.5.6",
45+
"webpack-dev-server": "^2.7.0"
46+
},
47+
"license": "MIT"
48+
}

OLD/src/App.vue

+228
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
<template>
2+
<div id="app">
3+
<h1>Vue Grid Layout</h1>
4+
<!--<pre>{{ layout | json }}</pre>-->
5+
<div>
6+
<div class="layoutJSON">
7+
Displayed as <code>[x, y, w, h]</code>:
8+
<div class="columns">
9+
<div class="layoutItem" v-for="item in layout">
10+
<b>{{item.i}}</b>: [{{item.x}}, {{item.y}}, {{item.w}}, {{item.h}}]
11+
</div>
12+
</div>
13+
</div>
14+
<div class="layoutJSON">
15+
Displayed as <code>[x, y, w, h]</code>:
16+
<div class="columns">
17+
<div class="layoutItem" v-for="item in layout2">
18+
<b>{{item.i}}</b>: [{{item.x}}, {{item.y}}, {{item.w}}, {{item.h}}]
19+
</div>
20+
</div>
21+
</div>
22+
</div>
23+
<div id="content">
24+
<button @click="decreaseWidth">Decrease Width</button>
25+
<button @click="increaseWidth">Increase Width</button>
26+
<button @click="addItem">Add an item</button>
27+
<!-- Add to show rtl support -->
28+
<button @click="changeDirection">Change Direction</button>
29+
<input type="checkbox" v-model="draggable"/> Draggable
30+
<input type="checkbox" v-model="resizable"/> Resizable
31+
<input type="checkbox" v-model="mirrored"/> Mirrored
32+
<br/>
33+
Row Height: <input type="number" v-model="rowHeight"/> Col nums: <input type="number" v-model="colNum"/>
34+
<br/>
35+
<grid-layout
36+
:layout="layout"
37+
:col-num="parseInt(colNum)"
38+
:row-height="rowHeight"
39+
:is-draggable="draggable"
40+
:is-resizable="resizable"
41+
:is-mirrored="mirrored"
42+
:vertical-compact="true"
43+
:use-css-transforms="true"
44+
>
45+
<grid-item v-for="item in layout" :key="item.i"
46+
:x="item.x"
47+
:y="item.y"
48+
:w="item.w"
49+
:h="item.h"
50+
:i="item.i"
51+
@resize="resize"
52+
@move="move"
53+
@resized="resized"
54+
@moved="moved"
55+
>
56+
<!--<custom-drag-element :text="item.i"></custom-drag-element>-->
57+
<test-element :text="item.i"></test-element>
58+
<!--<button @click="clicked">CLICK ME!</button>-->
59+
</grid-item>
60+
</grid-layout>
61+
<hr/>
62+
<!--<grid-layout
63+
:layout="layout2"
64+
:col-num="12"
65+
:row-height="rowHeight"
66+
:is-draggable="draggable"
67+
:is-resizable="resizable"
68+
:vertical-compact="true"
69+
:use-css-transforms="true"
70+
>
71+
<grid-item v-for="item in layout2" :key="item.i"
72+
:x="item.x"
73+
:y="item.y"
74+
:w="item.w"
75+
:h="item.h"
76+
:min-w="2"
77+
:min-h="2"
78+
:i="item.i"
79+
:is-draggable="item.draggable"
80+
:is-resizable="item.resizable"
81+
>
82+
<test-element :text="item.i"></test-element>
83+
</grid-item>
84+
</grid-layout>-->
85+
</div>
86+
</div>
87+
</template>
88+
89+
<script>
90+
import GridItem from './GridItem.vue';
91+
import GridLayout from './GridLayout.vue';
92+
//import ResponsiveGridLayout from './ResponsiveGridLayout.vue';
93+
import TestElement from './TestElement.vue';
94+
import CustomDragElement from './CustomDragElement.vue';
95+
import {getDocumentDir, setDocumentDir} from "./DOM";
96+
//var eventBus = require('./eventBus');
97+
98+
let testLayout = [
99+
{"x":0,"y":0,"w":2,"h":2,"i":"0", resizable: true, draggable: true},
100+
{"x":2,"y":0,"w":2,"h":4,"i":"1", resizable: null, draggable: null},
101+
{"x":4,"y":0,"w":2,"h":5,"i":"2", resizable: false, draggable: false},
102+
{"x":6,"y":0,"w":2,"h":3,"i":"3", resizable: false, draggable: false},
103+
{"x":8,"y":0,"w":2,"h":3,"i":"4", resizable: false, draggable: false},
104+
{"x":10,"y":0,"w":2,"h":3,"i":"5", resizable: false, draggable: false},
105+
{"x":0,"y":5,"w":2,"h":5,"i":"6", resizable: false, draggable: false},
106+
{"x":2,"y":5,"w":2,"h":5,"i":"7", resizable: false, draggable: false},
107+
{"x":4,"y":5,"w":2,"h":5,"i":"8", resizable: false, draggable: false},
108+
{"x":6,"y":4,"w":2,"h":4,"i":"9", resizable: false, draggable: false},
109+
{"x":8,"y":4,"w":2,"h":4,"i":"10", resizable: false, draggable: false},
110+
{"x":10,"y":4,"w":2,"h":4,"i":"11", resizable: false, draggable: false},
111+
{"x":0,"y":10,"w":2,"h":5,"i":"12", resizable: false, draggable: false},
112+
{"x":2,"y":10,"w":2,"h":5,"i":"13", resizable: false, draggable: false},
113+
{"x":4,"y":8,"w":2,"h":4,"i":"14", resizable: false, draggable: false},
114+
{"x":6,"y":8,"w":2,"h":4,"i":"15", resizable: false, draggable: false},
115+
{"x":8,"y":10,"w":2,"h":5,"i":"16", resizable: false, draggable: false},
116+
{"x":10,"y":4,"w":2,"h":2,"i":"17", resizable: false, draggable: false},
117+
{"x":0,"y":9,"w":2,"h":3,"i":"18", resizable: false, draggable: false},
118+
{"x":2,"y":6,"w":2,"h":2,"i":"19", resizable: false, draggable: false}
119+
];
120+
121+
export default {
122+
name: 'app',
123+
components: {
124+
//ResponsiveGridLayout,
125+
GridLayout,
126+
GridItem,
127+
TestElement,
128+
CustomDragElement,
129+
},
130+
data () {
131+
return {
132+
layout: JSON.parse(JSON.stringify(testLayout)),
133+
layout2: JSON.parse(JSON.stringify(testLayout)),
134+
draggable: true,
135+
resizable: true,
136+
mirrored: false,
137+
rowHeight: 30,
138+
colNum: 12,
139+
index: 0
140+
}
141+
},
142+
mounted: function () {
143+
this.index = this.layout.length;
144+
},
145+
methods: {
146+
clicked: function() {
147+
window.alert("CLICK!");
148+
},
149+
increaseWidth: function(item) {
150+
var width = document.getElementById("content").offsetWidth;
151+
width += 20;
152+
document.getElementById("content").style.width = width+"px";
153+
},
154+
decreaseWidth: function(item) {
155+
156+
var width = document.getElementById("content").offsetWidth;
157+
width -= 20;
158+
document.getElementById("content").style.width = width+"px";
159+
},
160+
removeItem: function(item) {
161+
//console.log("### REMOVE " + item.i);
162+
this.layout.splice(this.layout.indexOf(item), 1);
163+
},
164+
addItem: function() {
165+
let self = this;
166+
//console.log("### LENGTH: " + this.layout.length);
167+
let item = {"x":0,"y":0,"w":2,"h":2,"i":this.index+"", whatever: "bbb"};
168+
this.index++;
169+
this.layout.push(item);
170+
},
171+
move: function(i, newX, newY){
172+
// console.log("MOVE i=" + i + ", X=" + newX + ", Y=" + newY);
173+
},
174+
resize: function(i, newH, newW, newHPx, newWPx){
175+
console.log("RESIZE i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
176+
},
177+
moved: function(i, newX, newY){
178+
console.log("### MOVED i=" + i + ", X=" + newX + ", Y=" + newY);
179+
},
180+
resized: function(i, newH, newW, newHPx, newWPx){
181+
console.log("### RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
182+
},
183+
/**
184+
* Add change direction button
185+
*/
186+
changeDirection() {
187+
let documentDirection = getDocumentDir();
188+
let toggle = "";
189+
if (documentDirection === "rtl") {
190+
toggle = "ltr"
191+
} else {
192+
toggle = "rtl"
193+
}
194+
setDocumentDir(toggle);
195+
//eventBus.$emit('directionchange');
196+
}
197+
},
198+
}
199+
</script>
200+
201+
<style>
202+
/* #app {
203+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
204+
-webkit-font-smoothing: antialiased;
205+
-moz-osx-font-smoothing: grayscale;
206+
text-align: center;
207+
color: #2c3e50;
208+
margin-top: 60px;
209+
}
210+
211+
h1, h2 {
212+
font-weight: normal;
213+
}
214+
215+
ul {
216+
list-style-type: none;
217+
padding: 0;
218+
}
219+
220+
li {
221+
display: inline-block;
222+
margin: 0 10px;
223+
}
224+
225+
a {
226+
color: #42b983;
227+
}*/
228+
</style>
File renamed without changes.
File renamed without changes.

OLD/src/main.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Vue from 'vue'
2+
import App from './App.vue'
3+
4+
new Vue({
5+
el: '#app',
6+
render: h => h(App)
7+
})
File renamed without changes.
File renamed without changes.
File renamed without changes.

babel.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/app'
4+
],
5+
"plugins": [
6+
"transform-flow-comments"
7+
]
8+
}

0 commit comments

Comments
 (0)