Skip to content

Next version for Vue 2 #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Feb 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3754991
Merge remote-tracking branch 'refs/remotes/origin/master' into next
icebob Oct 6, 2016
f6c4ff1
Merge remote-tracking branch 'refs/remotes/origin/master' into next
icebob Oct 6, 2016
d90d343
Merge branch 'next' of github.com:icebob/vue-form-generator into next
Oct 7, 2016
0b1df2c
[wip] modification to work with vuejs 2.0.
Oct 6, 2016
5d6c0c7
fix: aligned with issue #84
Oct 7, 2016
35be49e
fix: rewrite in jade and commenting problematic fields
Oct 7, 2016
ca783ba
Merge branch 'lb_next'
lionel-bijaoui Nov 29, 2016
61b76c1
Update vuejs version to 2.1.3, and made change accordingly (added vue…
lionel-bijaoui Nov 30, 2016
1d090df
Fix a bug with v-model and dynamic type on input.
lionel-bijaoui Nov 30, 2016
fc123fe
Merge pull request #89 from lionel-bijaoui/lb_next
icebob Dec 1, 2016
d671057
fix validator error
icebob Dec 7, 2016
8044f9e
test: fix test cases
icebob Dec 7, 2016
b240183
test: fix selectEx tests
icebob Dec 7, 2016
caae630
test: fix fieldCleave tests
icebob Dec 7, 2016
f3202fa
test: fix checklist tests
icebob Dec 7, 2016
8ab6894
:bug: fix examples
icebob Dec 7, 2016
80ecf31
:bug: fix $index
icebob Dec 7, 2016
393461b
:package: first build for Vue 2.x
icebob Dec 12, 2016
9334ce6
docs: changelog updated
icebob Dec 12, 2016
b8c82c0
:bug: fix examples
icebob Dec 12, 2016
86d2ef4
:bug: fix examples
icebob Dec 12, 2016
454fa0e
remove console.log
icebob Dec 31, 2016
3a1c267
Merge remote-tracking branch 'refs/remotes/origin/master' into next
icebob Jan 30, 2017
e57725c
update yarn lock
icebob Jan 30, 2017
f4e5709
update deps
icebob Jan 30, 2017
386fa3f
reorganize dev codes
icebob Jan 30, 2017
8d3ca97
fix some errors
icebob Jan 30, 2017
593307b
fix checkbox tests
icebob Jan 30, 2017
2aacb57
fix vue-multiselect test errors
icebob Jan 30, 2017
94347e7
bump version to 2.0.0-beta2
icebob Jan 30, 2017
ebfc4b0
Fix vue version in examples
icebob Jan 30, 2017
7a786f7
Fix some CSS visual bugs
icebob Jan 30, 2017
ab562bd
:package: Build beta2
icebob Jan 30, 2017
1d85539
update travis. Remove v5, add v7
icebob Jan 30, 2017
df5aca0
update yarn lock
icebob Jan 30, 2017
bbdcc0f
remove v4 from travis
icebob Jan 30, 2017
eb6328c
update readme
icebob Jan 30, 2017
8636178
update changelog
icebob Jan 30, 2017
3e8d1a1
fix nested models
icebob Feb 10, 2017
ce999d0
remove unused codes
icebob Feb 10, 2017
665d6c1
bump version
icebob Feb 10, 2017
dfe78a0
:package: build
icebob Feb 10, 2017
cfe892f
:pencil: update changelog
icebob Feb 10, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": ["es2015", "stage-0"],
"presets": ["es2015", "stage-2"],
"plugins": ["transform-runtime"],
"comments": false
}
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ cache:
directories:
- node_modules
node_js:
- "7"
- "6"
- "5"
- "4"
after_success:
- npm run coverall
176 changes: 121 additions & 55 deletions CHANGELOG.md

Large diffs are not rendered by default.

16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,18 @@ You can find details about dependencies in [documentation](https://icebob.gitboo

## Installation
### NPM
You can install it via [NPM](http://npmjs.org/).
You can install it via [NPM](http://npmjs.org/) or [yarn](https://yarnpkg.com/).

#### Latest version for Vue 2.x
```
$ npm install vue-form-generator
```

#### Legacy version for Vue 1.0.x
```
$ npm install [email protected]
```

### Manual
Download zip package and unpack and add the `vue-form-generator.css` and `vue-form-generator.js` file to your project from dist folder.
```
Expand Down Expand Up @@ -140,8 +148,10 @@ npm run build
```bash
npm test
```

See: https://github.com/icebob/vue-form-generator/projects/1
or
```bash
npm run ci
```

## Contribution
Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-form-generator",
"version": "0.6.1",
"version": "2.0.0-beta3",
"homepage": "https://github.com/icebob/vue-form-generator",
"authors": [
"Icebob"
Expand Down
100 changes: 55 additions & 45 deletions dev/app.vue → dev/full/app.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
<template lang="jade">
.row
.col-md-10.col-md-offset-1
data-table(:rows="rows", :selected="selected", :select="selectRow")

.row(v-show="model")
.col-md-5.col-md-offset-1
.control-buttons.text-center
button.btn.btn-default.new(@click="newModel")
i.fa.fa-plus
| New
button.btn.btn-primary.save(@click="saveModel")
i.fa.fa-floppy-o
| Save
i.fa.fa-warning(v-if="showWarning()")
button.btn.btn-danger.delete(@click="deleteModel")
i.fa.fa-trash
| Delete

.errors.text-center
div.alert.alert-danger(v-for="item in validationErrors", track-by="$index") {{ item.field.label}}:
strong {{ item.error }}

vue-form-generator(:schema='schema', :model='model', :options='formOptions', :multiple="selected.length > 1", v-ref:form, :is-new-model="isNewModel")


.col-md-6
pre(v-if='model') {{{ model | prettyJSON }}}
<template>
<div>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<data-table :rows="rows" :selected="selected" :select="selectRow"></data-table>
</div>
</div>
<div v-show="model" class="row">
<div class="col-md-5 col-md-offset-1">
<div class="control-buttons text-center">
<button @click="newModel" class="btn btn-default new"> <i class="fa fa-plus"></i>New</button>
<button @click="saveModel" class="btn btn-primary save"> <i class="fa fa-floppy-o"></i>Save<i v-if="showWarning()" class="fa fa-warning"></i></button>
<button @click="deleteModel" class="btn btn-danger delete"> <i class="fa fa-trash"></i>Delete</button>
</div>
<div class="errors text-center">
<div v-for="(item, index) in validationErrors" track-by="index" class="alert alert-danger">{{ item.field.label}}: <strong>{{ item.error }}</strong></div>
</div>
<vue-form-generator :schema="schema" :model="model" :options="formOptions" :multiple="selected.length > 1" ref="form" :is-new-model="isNewModel" @model-updated="modelUpdated"></vue-form-generator>
</div>
<div class="col-md-6">
<pre v-if="model" v-html="prettyModel"></pre>
</div>
</div>
</div>

</template>

<script>
import Vue from "vue";
import VueFormGenerator from "../src";
import VueFormGenerator from "../../src";
import DataTable from "./dataTable.vue";
import Fakerator from "fakerator";

Expand Down Expand Up @@ -82,6 +78,9 @@
return this.$refs.form.errors;

return [];
},
prettyModel(){
return filters.prettyJSON(this.model);
}
},

Expand All @@ -95,10 +94,12 @@
selectRow(event, row, add) {
this.isNewModel = false;
if ( (add || (event && event.ctrlKey))) {
if (this.selected.indexOf(row) != -1)
this.selected.$remove(row);
else
if (this.selected.indexOf(row) != -1){
var index = this.selected.indexOf(row);
this.selected.splice(index, 1);
} else {
this.selected.push(row);
}
} else {
this.clearSelection();
this.selected.push(row);
Expand All @@ -114,12 +115,11 @@
generateModel() {
if (this.selected.length == 1) {
this.model = cloneDeep(this.selected[0]);
}
else if (this.selected.length > 1) {
} else if (this.selected.length > 1) {
this.model = VueFormGenerator.schema.mergeMultiObjectFields(Schema, this.selected);
}
else
} else {
this.model = null;
}
},

newModel() {
Expand All @@ -146,6 +146,7 @@
}

} else {
console.warn("Error saving model...");
// Validation error
}
},
Expand All @@ -162,7 +163,8 @@
deleteModel() {
if (this.selected.length > 0) {
each(this.selected, (row) => {
this.rows.$remove(row);
let index = this.rows.indexOf(row);
this.rows.splice(index, 1)
})
this.clearSelection();
}
Expand All @@ -180,22 +182,30 @@
},

validate() {
console.log("validate", this.$refs.form, this.$refs.form.validate());
return this.$refs.form.validate();
},

modelUpdated(newVal, schema) {
console.log("main model has updated", newVal, schema);
// this.model[schema] = newVal;
}


},

ready() {
window.app = this;
mounted() {
this.$nextTick(function () {
window.app = this;

if (users.length > 0) {
this.selectRow(null, fakerator.random.arrayElement(users));
}
if (users.length > 0) {
this.selectRow(null, fakerator.random.arrayElement(users));
}

// Localize validate errors
VueFormGenerator.validators.resources.fieldIsRequired = "Ezt a mezőt kötelező kitölteni!";
VueFormGenerator.validators.resources.textTooSmall = "A szöveg túl rövid! Jelenleg: {0}, minimum: {1}";
// Localize validate errors
// VueFormGenerator.validators.resources.fieldIsRequired = "Ezt a mezőt kötelező kitölteni!";
// VueFormGenerator.validators.resources.textTooSmall = "A szöveg túl rövid! Jelenleg: {0}, minimum: {1}";
})
}
}

Expand Down
15 changes: 8 additions & 7 deletions dev/data.js → dev/full/data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Fakerator from 'fakerator';
import moment from 'moment';
import Fakerator from "fakerator";
import moment from "moment";

let fakerator = new Fakerator();

Expand All @@ -8,7 +8,7 @@ let roles = [
{ id: "moderator", name: "Moderator"},
{ id: "user", name: "Registered User"},
{ id: "visitor", name: "Visitor"}
]
];

let skills = [ "HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS" ];

Expand All @@ -19,7 +19,7 @@ module.exports = {
users: (function() {
let res = [];
for (let i = 0; i < 5; i++) {
let lang = fakerator.random.arrayElement(['en-US', 'en-GB', 'de', 'fr', 'it']);
let lang = fakerator.random.arrayElement(["en-US", "en-GB", "de", "fr", "it"]);
let user = fakerator.entity.user();
user.id = i + 1;
user.type = fakerator.random.arrayElement(["personal", "business"]);
Expand All @@ -41,16 +41,17 @@ module.exports = {
user.created = fakerator.date.recent(30).valueOf();
user.dt = fakerator.date.recent(30).valueOf();
user.favoriteColor = "#" + fakerator.internet.color();
user.color = "#" + fakerator.internet.color();

if (user.type == "business")
user.company = fakerator.entity.company();

user.income = [ fakerator.random.number(50000), fakerator.random.number(50000, 100000)];

res.push(user);
console.log(user);
// console.log(user);
}
//console.log(res);
// console.log(res);
return res;
})()
}
};
2 changes: 1 addition & 1 deletion dev/dataTable.vue → dev/full/dataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<script>
import Vue from "vue";
import VueFormGenerator from "../src";
import VueFormGenerator from "../../src";
import Schema from "./schema";
import { find } from "lodash";
import { users, roles } from "./data";
Expand Down
2 changes: 1 addition & 1 deletion dev/fieldAwesome.vue → dev/full/fieldAwesome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</template>

<script>
import VueFormGenerator from "../src";
import VueFormGenerator from "../../src";

export default {
mixins: [ VueFormGenerator.abstractField ]
Expand Down
30 changes: 15 additions & 15 deletions dev/index.html → dev/full/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
<head>
<meta charset="utf-8">
<title>vue-form-generator development</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.1/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/css/bootstrap-select.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.11.2/css/bootstrap-select.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/css/ion.rangeSlider.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/css/ion.rangeSlider.skinHTML5.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/8.5.1/nouislider.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/9.0.0/nouislider.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.4.0/css/pikaday.min.css">


<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.3.0/lodash.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js"></script>
<!-- jQuery dependent -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.10.0/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.11.2/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/spectrum/1.8.0/spectrum.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.1.4/js/ion.rangeSlider.js"></script>
<!-- Vanilla libs -->
<script type="text/javascript" src="https://rawgit.com/monterail/vue-multiselect/v1.1.4/lib/vue-multiselect.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/vue-multiselect@2.0.0-beta.13"></script>
<script type="text/javascript" src="https://rawgit.com/nosir/cleave.js/master/dist/cleave.min.js"></script>
<script type="text/javascript" src="https://nosir.github.io/cleave.js/lib/cleave-phone.i18n.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/8.5.1/nouislider.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/9.0.0/nouislider.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pikaday/1.4.0/pikaday.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCEz-sX9bRJorDS-D_JL0JkZVZe2gzoUMw&amp;libraries=places"></script>

</head>
<body>
<div class="container-fluid"></div>
<app></app>
<script src="/app.js"></script>
<div id="app"></div>
<script src="/full.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions dev/full/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* global Vue */

// var App = require('./app.vue');
// $(function() {
// App.$mount('#app');
// });

import Vue from 'vue';
import App from './app.vue';

new Vue({
...App
}).$mount('#app');
Loading