diff --git a/.babelrc b/.babelrc
index 97b911e9..272b042d 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,5 +1,18 @@
{
- "presets": ["es2015", "stage-2"],
- "plugins": ["transform-runtime", "lodash"],
- "comments": false
-}
\ No newline at end of file
+ "presets": [
+ [
+ "env",
+ {
+ "modules": false,
+ "useBuiltIns": "entry"
+ }
+ ],
+ "stage-2"
+ ],
+ "plugins": ["transform-runtime", "lodash"],
+ "env": {
+ "test": {
+ "plugins": ["istanbul"]
+ }
+ }
+}
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..4b8b3e12
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,9 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+indent_style = tab
+indent_size = 4
+trim_trailing_whitespace = true
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 00000000..f4a64d40
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,4 @@
+dist/*.js
+build/*.js
+config/*.js
+!.eslintrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
index df57cea6..4e0bf90e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,45 +1,27 @@
module.exports = {
- root: true,
- "env": {
- "browser": true,
- "commonjs": true,
- "es6": true,
- "jquery": false,
- "mocha": true
- },
- "extends": "eslint:recommended",
- "parserOptions": {
- "sourceType": "module",
- "ecmaVersion": 6,
- "ecmaFeatures": {
- "experimentalObjectRestSpread": true
- }
- },
- "plugins": [
- "html"
- ],
- "rules": {
- "indent": [
- "warn",
- "tab",
- { SwitchCase: 1 }
- ],
- "quotes": [
- "warn",
- "double"
- ],
- "semi": [
- "error",
- "always"
- ],
- "no-var": [
- "error"
- ],
- "no-console": [
- "off"
- ],
- "no-unused-vars": [
- "warn"
- ]
- }
-};
\ No newline at end of file
+ root: true,
+ parser: "vue-eslint-parser",
+ parserOptions: {
+ sourceType: "module",
+ parser: "babel-eslint"
+ },
+ env: {
+ browser: true,
+ commonjs: true
+ },
+ globals: {
+ process: true
+ },
+ extends: ["eslint:recommended", "plugin:vue/essential"],
+ plugins: ["prettier"],
+ rules: {
+ indent: [1, "tab", { SwitchCase: 1 }],
+ quotes: [1, "double", { allowTemplateLiterals: true }],
+ semi: [2, "always"],
+ "no-var": [2],
+ "no-console": [0],
+ "no-unused-vars": [1],
+ "no-throw-literal": 0,
+ eqeqeq: [2, "smart"]
+ }
+};
diff --git a/.gitignore b/.gitignore
index 933b8e64..6c546dcb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,5 @@
.DS_Store
node_modules/
-coverage/
docs/_book/
npm-debug.log
selenium-debug.log
@@ -8,4 +7,4 @@ test/unit/coverage
test/e2e/reports
stats.json
typings/
-typings.json
\ No newline at end of file
+typings.json
diff --git a/.jsbeautifyrc b/.jsbeautifyrc
deleted file mode 100644
index 71c7efbf..00000000
--- a/.jsbeautifyrc
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "html": {
- "indent_char": "\t",
- "indent_size": 1
- }
-}
\ No newline at end of file
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 00000000..4f9b3072
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,9 @@
+{
+ "printWidth": 120,
+ "tabWidth": 4,
+ "singleQuote": false,
+ "trailingComma": "none",
+ "bracketSpacing": true,
+ "semi": true,
+ "useTabs": true
+}
diff --git a/.travis.yml b/.travis.yml
index bba335ed..7a73d116 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,4 +6,4 @@ node_js:
- "7"
- "6"
after_success:
- - npm run coverall
+ - npm run coverage
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 062505a8..0ba289c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,54 @@
+
+# 2.2.0 (2018-01-21)
+
+* add console.log ([fa779bd](https://github.com/icebob/vue-form-generator/commit/fa779bd))
+* add console.log to debug ([d05818e](https://github.com/icebob/vue-form-generator/commit/d05818e))
+* add indent ([026439a](https://github.com/icebob/vue-form-generator/commit/026439a))
+* add unscape html for error message. ([20b8d9d](https://github.com/icebob/vue-form-generator/commit/20b8d9d))
+* added "getLabelClasses" and unit test, using the fieldClasses unit test as an example ([8c01307](https://github.com/icebob/vue-form-generator/commit/8c01307))
+* added labelClasses support ([acdbb6c](https://github.com/icebob/vue-form-generator/commit/acdbb6c))
+* added missing "id" attributes to checkbox, checklist, radios and submit ([09d44c1](https://github.com/icebob/vue-form-generator/commit/09d44c1))
+* added missing comma that failed in Travis ([32c7627](https://github.com/icebob/vue-form-generator/commit/32c7627))
+* added styleClasses support to groups ([8b6801b](https://github.com/icebob/vue-form-generator/commit/8b6801b))
+* addeds "styleClasses" to group schemas, reimplements #339 ([8e4b43d](https://github.com/icebob/vue-form-generator/commit/8e4b43d))
+* bumped vue version to 2.5.3 ([7d7c0c4](https://github.com/icebob/vue-form-generator/commit/7d7c0c4))
+* change the judgement ([d4bc27a](https://github.com/icebob/vue-form-generator/commit/d4bc27a))
+* check if field.type is undefined before appending the "field-undefined" class ([9993550](https://github.com/icebob/vue-form-generator/commit/9993550))
+* commit the built bundle ([45e1436](https://github.com/icebob/vue-form-generator/commit/45e1436))
+* commit the built dist ([12b3cf7](https://github.com/icebob/vue-form-generator/commit/12b3cf7))
+* commit without console.log ([79a77bd](https://github.com/icebob/vue-form-generator/commit/79a77bd))
+* delete console.log ([ed853a2](https://github.com/icebob/vue-form-generator/commit/ed853a2))
+* don't render labels when no label text is provided, proposed option 1 from #347 ([8ecc851](https://github.com/icebob/vue-form-generator/commit/8ecc851))
+* fix bower.json validation ([2afb4ac](https://github.com/icebob/vue-form-generator/commit/2afb4ac))
+* fixed null check ([7842b92](https://github.com/icebob/vue-form-generator/commit/7842b92))
+* fixed Vue version ([624ed92](https://github.com/icebob/vue-form-generator/commit/624ed92))
+* fixes #340 - "none" value set to `null`, formatValueToField checks for `isNil(value)` and returns `n ([5b42807](https://github.com/icebob/vue-form-generator/commit/5b42807)), closes [#340](https://github.com/icebob/vue-form-generator/issues/340)
+* fixes #341 - introduced debounce functionality into `formatValueToModel` ([a46fe31](https://github.com/icebob/vue-form-generator/commit/a46fe31)), closes [#341](https://github.com/icebob/vue-form-generator/issues/341)
+* fixes #345 - declare debouncedValidateFunc and set it when debouncedValidate() is called... vue 2.2. ([ee684f0](https://github.com/icebob/vue-form-generator/commit/ee684f0)), closes [#345](https://github.com/icebob/vue-form-generator/issues/345)
+* fixes #358 - support "validateBeforeSubmit" with async validators ([5a26ef1](https://github.com/icebob/vue-form-generator/commit/5a26ef1)), closes [#358](https://github.com/icebob/vue-form-generator/issues/358)
+* fixes #361 - use $event.target.valueAsNumber for number/range inputs, debounce `formatValueToModel` ([d1a8bcf](https://github.com/icebob/vue-form-generator/commit/d1a8bcf)), closes [#361](https://github.com/icebob/vue-form-generator/issues/361)
+* fixes #362 - `integer` validator now calls `number` validator, and returns `invalidIntegerl: "The va ([8d436be](https://github.com/icebob/vue-form-generator/commit/8d436be)), closes [#362](https://github.com/icebob/vue-form-generator/issues/362)
+* Groupped fields "tag" param fixed. ([9275a26](https://github.com/icebob/vue-form-generator/commit/9275a26))
+* moved unit test to formGenerator, as labels are managed by formGenerator and not the field component ([f102967](https://github.com/icebob/vue-form-generator/commit/f102967))
+* remove garbage ([17eeae5](https://github.com/icebob/vue-form-generator/commit/17eeae5))
+* remove the errorUnescaped property, add v-html on the error part ([ecd2ca5](https://github.com/icebob/vue-form-generator/commit/ecd2ca5))
+* remove uniqueId import ([c86d7dc](https://github.com/icebob/vue-form-generator/commit/c86d7dc))
+* removed commented out console.log statements ([e9bf285](https://github.com/icebob/vue-form-generator/commit/e9bf285))
+* removed console.log and fixed quotes ([025b541](https://github.com/icebob/vue-form-generator/commit/025b541))
+* removed indentation ([49f57b8](https://github.com/icebob/vue-form-generator/commit/49f57b8))
+* requested by @icebob ([2724809](https://github.com/icebob/vue-form-generator/commit/2724809))
+* reverted back to `schema.required` for "none selected" disabled state, per @icebob ([f562d7f](https://github.com/icebob/vue-form-generator/commit/f562d7f))
+* reverting back to original test ([4ba3d4a](https://github.com/icebob/vue-form-generator/commit/4ba3d4a))
+* Update badges ([705c6a7](https://github.com/icebob/vue-form-generator/commit/705c6a7))
+* Update formGenerator.vue ([3208446](https://github.com/icebob/vue-form-generator/commit/3208446))
+* update node-sass ([e3eee64](https://github.com/icebob/vue-form-generator/commit/e3eee64))
+* Update README.md ([f57faba](https://github.com/icebob/vue-form-generator/commit/f57faba))
+* Update README.md ([1092e01](https://github.com/icebob/vue-form-generator/commit/1092e01))
+* Update README.md ([9d9701b](https://github.com/icebob/vue-form-generator/commit/9d9701b))
+* updated tests for modified label logic ([f0c2281](https://github.com/icebob/vue-form-generator/commit/f0c2281))
+
+
+
## 2.1.1 (2017-10-20)
diff --git a/README.md b/README.md
index ad22f612..9c9bbbaa 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,15 @@
# vue-form-generator [](https://www.npmjs.com/package/vue-form-generator) 
A schema-based form generator component for Vue.js.
-[](https://www.codacy.com/app/mereg-norbert/vue-form-generator?utm_source=github.com&utm_medium=referral&utm_content=icebob/vue-form-generator&utm_campaign=Badge_Grade)
-[](https://travis-ci.org/icebob/vue-form-generator)
-[](https://coveralls.io/github/icebob/vue-form-generator?branch=master)
+[](https://www.codacy.com/app/mereg-norbert/vue-form-generator_2?utm_source=github.com&utm_medium=referral&utm_content=vue-generators/vue-form-generator&utm_campaign=Badge_Grade)
+[](https://travis-ci.org/vue-generators/vue-form-generator)
+[](https://coveralls.io/github/vue-generators/vue-form-generator?branch=master)
[]()
[](http://packagequality.com/#?package=vue-form-generator)
-[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Ficebob%2Fvue-form-generator?ref=badge_shield)
+[](https://app.fossa.io/projects/git%2Bgithub.com%2Fvue-generators%2Fvue-form-generator?ref=badge_shield)
-[](https://david-dm.org/icebob/vue-form-generator)
-[](https://david-dm.org/icebob/vue-form-generator#info=devDependencies)
+[](https://david-dm.org/vue-generators/vue-form-generator)
+[](https://david-dm.org/vue-generators/vue-form-generator#info=devDependencies)
[](https://www.npmjs.com/package/vue-form-generator)
## Demo
@@ -205,6 +205,10 @@ VueFormGenerator supports custom fields. If you decide to release your custom fi
This way, it will be easier for everyone to find it. Thank you !
+### Public Custom Fields
+
+- [vue-tel-input](https://github.com/EducationLink/vue-tel-input) - International Telephone Input Boilerplate with Vue (integrated with VueFormGenerator).
+
## 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.
diff --git a/bower.json b/bower.json
index 82ef85cc..eece7682 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "vue-form-generator",
- "version": "2.1.1",
+ "version": "2.2.0",
"homepage": "https://github.com/icebob/vue-form-generator",
"authors": [
"Icebob"
diff --git a/build/utils.js b/build/utils.js
new file mode 100644
index 00000000..414d5eb5
--- /dev/null
+++ b/build/utils.js
@@ -0,0 +1,63 @@
+let path = require("path");
+let ExtractTextPlugin = require("extract-text-webpack-plugin");
+
+exports.cssLoaders = function(options) {
+ options = options || {};
+
+ let cssLoader = {
+ loader: "css-loader",
+ options: {
+ minimize: process.env.NODE_ENV === "production",
+ sourceMap: options.sourceMap
+ }
+ };
+
+ // generate loader string to be used with extract text plugin
+ function generateLoaders(loader, loaderOptions) {
+ let loaders = [cssLoader];
+ if (loader) {
+ loaders.push({
+ loader: loader + "-loader",
+ options: Object.assign({}, loaderOptions, {
+ sourceMap: options.sourceMap
+ })
+ });
+ }
+
+ // Extract CSS when that option is specified
+ // (which is the case during production build)
+ if (options.extract) {
+ return ExtractTextPlugin.extract({
+ use: loaders,
+ fallback: "vue-style-loader"
+ });
+ } else {
+ return ["vue-style-loader"].concat(loaders);
+ }
+ }
+
+ // https://vue-loader.vuejs.org/en/configurations/extract-css.html
+ return {
+ css: generateLoaders(),
+ postcss: generateLoaders(),
+ less: generateLoaders("less"),
+ sass: generateLoaders("sass", { indentedSyntax: true }),
+ scss: generateLoaders("sass"),
+ stylus: generateLoaders("stylus"),
+ styl: generateLoaders("stylus")
+ };
+};
+
+// Generate loaders for standalone style files (outside of .vue)
+exports.styleLoaders = function(options) {
+ let output = [];
+ let loaders = exports.cssLoaders(options);
+ for (let extension in loaders) {
+ let loader = loaders[extension];
+ output.push({
+ test: new RegExp("\\." + extension + "$"),
+ use: loader
+ });
+ }
+ return output;
+};
diff --git a/build/vue-loader.conf.js b/build/vue-loader.conf.js
new file mode 100644
index 00000000..ae4f2e8a
--- /dev/null
+++ b/build/vue-loader.conf.js
@@ -0,0 +1,10 @@
+let utils = require("./utils");
+let isProduction = process.env.NODE_ENV === "production";
+
+module.exports = {
+ esModule: false,
+ loaders: utils.cssLoaders({
+ sourceMap: false,
+ extract: isProduction
+ })
+};
diff --git a/build/webpack.build.config.js b/build/webpack.build.config.js
new file mode 100644
index 00000000..f170435c
--- /dev/null
+++ b/build/webpack.build.config.js
@@ -0,0 +1,104 @@
+const path = require("path");
+const webpack = require("webpack");
+const utils = require("./utils");
+const version = require("../package.json").version;
+const banner =
+ "/**\n" +
+ " * vue-form-generator v" +
+ version +
+ "\n" +
+ " * https://github.com/icebob/vue-form-generator\n" +
+ " * Released under the MIT License.\n" +
+ " */\n";
+const ExtractTextPlugin = require("extract-text-webpack-plugin");
+const StatsPlugin = require("stats-webpack-plugin");
+const vueLoaderConfig = require("./vue-loader.conf");
+
+let rules = [
+ {
+ test: /\.(js|vue)$/,
+ loader: "eslint-loader",
+ enforce: "pre",
+ include: [path.resolve("src")],
+ options: {
+ formatter: require("eslint-friendly-formatter")
+ }
+ },
+ {
+ test: /\.vue$/,
+ loader: "vue-loader",
+ include: [path.resolve("src")],
+ exclude: /node_modules/,
+ options: vueLoaderConfig
+ },
+ {
+ test: /\.js$/,
+ loader: "babel-loader",
+ include: [path.resolve("src")],
+ exclude: /node_modules/
+ },
+ {
+ test: /\.(woff2?|svg)$/,
+ loader: "url-loader",
+ include: [path.resolve("src")]
+ },
+ {
+ test: /\.(ttf|eot)$/,
+ loader: "url-loader",
+ include: [path.resolve("src")]
+ }
+];
+
+let cssFileName;
+if (process.env.FULL_BUNDLE !== "false") {
+ cssFileName = "vfg.css";
+} else {
+ cssFileName = "vfg-core.css";
+}
+
+module.exports = [
+ {
+ entry: "./src/index.js",
+ output: {
+ path: path.resolve("dist"),
+ filename: "vfg.js",
+ library: "VueFormGenerator",
+ libraryTarget: "umd"
+ },
+
+ plugins: [
+ new webpack.DefinePlugin({
+ "process.env": {
+ NODE_ENV: JSON.stringify("production")
+ }
+ }),
+ new webpack.optimize.UglifyJsPlugin({
+ compress: {
+ warnings: false
+ }
+ }),
+ new webpack.BannerPlugin({
+ banner,
+ raw: true
+ }),
+ new ExtractTextPlugin(cssFileName, { allChunks: true }),
+ new StatsPlugin("../stats.json", {
+ chunkModules: true
+ //exclude: [/node_modules[\\\/]react/]
+ })
+ ],
+
+ module: {
+ rules
+ },
+
+ resolve: {
+ aliasFields: ["browser"],
+ extensions: [".js", ".vue", ".json"],
+ alias: {
+ vue$: "vue/dist/vue.esm.js",
+ "@": path.resolve("src")
+ }
+ }
+ }
+];
diff --git a/build/webpack.dev.config.js b/build/webpack.dev.config.js
new file mode 100644
index 00000000..c840e470
--- /dev/null
+++ b/build/webpack.dev.config.js
@@ -0,0 +1,81 @@
+const path = require("path");
+const webpack = require("webpack");
+const projectRoot = path.resolve(__dirname, "../");
+const vueLoaderConfig = require("./vue-loader.conf");
+
+let rules = [
+ {
+ test: /\.(js|vue)$/,
+ loader: "eslint-loader",
+ enforce: "pre",
+ include: [path.resolve("src"), path.resolve("dev")],
+ options: {
+ formatter: require("eslint-friendly-formatter")
+ }
+ },
+ {
+ test: /\.vue$/,
+ loader: "vue-loader",
+ include: [path.resolve("src"), path.resolve("dev")],
+ exclude: /node_modules/,
+ options: vueLoaderConfig
+ },
+ {
+ test: /\.js$/,
+ loader: "babel-loader",
+ include: [path.resolve("src"), path.resolve("dev")],
+ exclude: /node_modules/
+ },
+ {
+ test: /\.(woff2?|svg)$/,
+ loader: "url-loader",
+ include: [path.resolve("src"), path.resolve("dev")]
+ },
+ {
+ test: /\.(ttf|eot)$/,
+ loader: "url-loader",
+ include: [path.resolve("src"), path.resolve("dev")]
+ }
+];
+
+module.exports = {
+ devtool: "source-map",
+ devServer: {
+ contentBase: [path.resolve("dev/projects")]
+ },
+ entry: {
+ full: path.resolve("dev", "projects", "full", "main.js"),
+ basic: path.resolve("dev", "projects", "basic", "main.js"),
+ mselect: path.resolve("dev", "projects", "multiselect", "main.js"),
+ grouping: path.resolve("dev", "projects", "grouping", "main.js"),
+ checklist: path.resolve("dev", "projects", "checklist", "main.js"),
+ picker: path.resolve("dev", "projects", "picker", "main.js")
+ },
+
+ output: {
+ path: path.resolve("dev/projects"),
+ filename: "[name].js",
+ publicPath: "/"
+ },
+
+ plugins: [
+ new webpack.DefinePlugin({
+ "process.env": {
+ NODE_ENV: JSON.stringify("development"),
+ FULL_BUNDLE: true
+ }
+ })
+ ],
+
+ module: {
+ rules
+ },
+
+ resolve: {
+ extensions: [".js", ".vue", ".json"],
+ alias: {
+ vue$: "vue/dist/vue.esm.js",
+ "@": path.resolve("src")
+ }
+ }
+};
diff --git a/build/webpack.test.config.js b/build/webpack.test.config.js
new file mode 100644
index 00000000..32812ad9
--- /dev/null
+++ b/build/webpack.test.config.js
@@ -0,0 +1,68 @@
+const path = require("path");
+const vueLoaderConfig = require("./vue-loader.conf");
+const nodeExternals = require("webpack-node-externals");
+
+let rules = [
+ {
+ test: /\.(js|vue)$/,
+ loader: "eslint-loader",
+ enforce: "pre",
+ include: [path.resolve("src")],
+ options: {
+ formatter: require("eslint-friendly-formatter")
+ }
+ },
+ {
+ test: /\.vue$/,
+ loader: "vue-loader",
+ include: [path.resolve("src"), path.resolve("test")],
+ exclude: /node_modules/,
+ options: vueLoaderConfig
+ },
+ {
+ test: /\.js$/,
+ loader: "babel-loader",
+ include: [path.resolve("src"), path.resolve("test")],
+ exclude: /node_modules/
+ },
+ {
+ test: /\.(woff2?|svg)$/,
+ loader: "url-loader",
+ include: [path.resolve("src"), path.resolve("test")]
+ },
+ {
+ test: /\.(ttf|eot)$/,
+ loader: "url-loader",
+ include: [path.resolve("src"), path.resolve("test")]
+ }
+];
+
+module.exports = {
+ devtool: "inline-cheap-module-source-map",
+
+ entry: "./src/index.js",
+
+ output: {
+ path: path.resolve("dist"),
+ filename: "vfg.js",
+ library: "VueFormGenerator",
+ libraryTarget: "umd"
+ },
+
+ module: {
+ rules
+ },
+
+ plugins: [],
+
+ resolve: {
+ aliasFields: ["browser"],
+ extensions: [".js", ".vue", ".json"],
+ alias: {
+ vue$: "vue/dist/vue.esm.js",
+ src: path.resolve("src")
+ }
+ },
+
+ externals: [nodeExternals()]
+};
diff --git a/dev/basic/app.vue b/dev/basic/app.vue
deleted file mode 100644
index 4596c08d..00000000
--- a/dev/basic/app.vue
+++ /dev/null
@@ -1,308 +0,0 @@
-
- Basic
-
{{ model }}
- {{ model }}
-