├── .gitattributes ├── .gitignore ├── FormBase.vue ├── LICENSE ├── README.md ├── docs ├── _config.yml ├── index.html └── index.md ├── example └── vue-form-base │ ├── .babelrc │ ├── .gitattributes │ ├── .gitignore │ ├── README.md │ ├── index.html │ ├── package.json │ ├── src │ ├── App.vue │ ├── components │ │ └── formBase.vue │ └── main.js │ └── webpack.config.js ├── images ├── name1.JPG └── name2.JPG ├── index.js ├── package.json └── publish-npm.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #dist in Client 2 | client/dist 3 | 4 | node_modules 5 | 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 23 | .grunt 24 | 25 | # node-waf configuration 26 | .lock-wscript 27 | 28 | # Compiled binary addons (http://nodejs.org/api/addons.html) 29 | build/Release 30 | 31 | # Dependency directories 32 | node_modules 33 | jspm_packages 34 | 35 | # Optional npm cache directory 36 | .npm 37 | 38 | # Optional REPL history 39 | .node_repl_history 40 | 41 | # ========================= 42 | # Operating System Files 43 | # ========================= 44 | 45 | # OSX 46 | # ========================= 47 | 48 | .DS_Store 49 | .AppleDouble 50 | .LSOverride 51 | 52 | # Thumbnails 53 | ._* 54 | 55 | # Files that might appear in the root of a volume 56 | .DocumentRevisions-V100 57 | .fseventsd 58 | .Spotlight-V100 59 | .TemporaryItems 60 | .Trashes 61 | .VolumeIcon.icns 62 | 63 | # Directories potentially created on remote AFP share 64 | .AppleDB 65 | .AppleDesktop 66 | Network Trash Folder 67 | Temporary Items 68 | .apdisk 69 | 70 | # Windows 71 | # ========================= 72 | 73 | # Windows image file caches 74 | Thumbs.db 75 | ehthumbs.db 76 | 77 | # Folder config file 78 | Desktop.ini 79 | 80 | # Recycle Bin used on file shares 81 | $RECYCLE.BIN/ 82 | 83 | # Windows Installer files 84 | *.cab 85 | *.msi 86 | *.msm 87 | *.msp 88 | 89 | # Windows shortcuts 90 | *.lnk 91 | client/src/views/LetterContainer.vue 92 | rethink-db/dinosaurus/dinosaurus/efabbcdf-9c30-4a0e-9e37-204826d3da29 93 | rethink-db/tiger/rethinkdb_data/metadata 94 | rethink-db/tiger/rethinkdb_data/log_file 95 | rethink-db/panther/rethinkdb_data/efabbcdf-9c30-4a0e-9e37-204826d3da29 96 | -------------------------------------------------------------------------------- /FormBase.vue: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 126 | 127 | 128 | 458 | 459 | 460 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 mimani 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Vue-Form-Base 3 | === 4 | 5 | ### DEPRECATED see next Version: vuetify-form-base 6 | 7 | Vue-Form-Base is a Vue 2.0 Component and Form-Generator for editing plain or deep nested Javascript objects getting a reactive Result. 8 | 9 | You have to create a lot of different forms? **Vue-Form-Base** can simplify your job by creating forms from JS-Objects. 10 | 11 | Select from different HTML5 Input-types like Text, Password, Checkboxes, Radios, Select, Multiselect, Color, Files or a lot of other fields. Apart from 'select' or multiselect' the Browser specific implementation of **Input-Types** is used. [Some Informations to HTML5 input-types here](https://www.wufoo.com/html5/) 12 | 13 | We use the [Materialize CSS](http://materializecss.com/) framework for styling. Input Fields have a clear, minimalistic design, but don't worry you can change your style with CSS in a lot of ways. For more details see section **Style with CSS** 14 | 15 | Add global **Validation** to the form or validate only a single field. Use inline validation or write a new function for individuell validation. 16 | 17 | Make complex data editable by **mapping** your incoming and outgoing data: i.e. change dateformats, trim strings or join/split arrays for editing in a textfield. 18 | 19 | And finally get a full reactive Result by using **Vuex.** 20 | 21 | 22 | Installation 23 | === 24 | 25 | 26 | npm install vue-form-base --save 27 | 28 | Using [single-file components](https://vuejs.org/v2/guide/single-file-components.html) with a .vue extension, 29 | 30 | import Formbase.vue File from your path 31 | 32 | import FormBase from 'vue-form-base'; 33 | 34 | then register in 35 | 36 | export default { 37 | ... 38 | components:{ 39 | FormBase 40 | } 41 | } 42 | 43 | and use it in template 44 | 45 | 48 | 49 | 50 | 51 | 52 | **Minimalistic Example** 53 | 54 | If your **data-state-name** property has the value *datastate*, 55 | then you must additionally define `datastate` in Vuex State. 56 | 57 | State:{ 58 | datastate:null, 59 | ... 60 | } 61 | 62 | Now use existing Data Object 63 | 64 | data:{ 65 | name: 'smith', 66 | email:'smith@online.com' 67 | } 68 | 69 | define the following minimalistic Schema 70 | 71 | schema:{ 72 | name: {type:'text'}, 73 | email: {type:'email'} 74 | 75 | } 76 | 77 | and get this full editable Form 78 | 79 | ![Form Example](https://raw.githubusercontent.com/wotamann/vue-form-base/master/images/name1.JPG) 80 | 81 | 82 | **Edit using different Input-Types** 83 | 84 | 85 | 86 | 87 | A more realistic Example. 88 | 89 | Your Data to edit: 90 | 91 | 92 | data:{ 93 | name: 'smith', 94 | email:'smith', 95 | password: '12345ABCDEF', 96 | remember: 'undefined', 97 | address:{ 98 | city:'NY', 99 | 100 | } 101 | }, 102 | 103 | Create a Schema Object: 104 | 105 | schema:{ 106 | 107 | user: {type:'text', label:'User:', placeholder:'User...', 108 | mapSet: (val, obj, data, schema) => { 109 | // type 'hide' to hide dependent item password 110 | schema.password.hidden = val === 'hide'; 111 | return val; 112 | } 113 | }, 114 | 115 | email: {type:'email',label:'Email:', validate:true }, 116 | 117 | password: {type:'password', label:'Password(Numbers only):', pattern:'[0-9]*', validate: msg => console.log(msg) }, 118 | 119 | remember: {type:'checkbox', label:'Remember Me:', true:'Yes', false:'No' }, 120 | 121 | address:{ 122 | city:{ type:'text', mapSet: v => v && v.toUpperCase() } 123 | } 124 | } 125 | 126 | ![](https://raw.githubusercontent.com/wotamann/vue-form-base/master/images/name2.JPG) 127 | 128 | 129 | 130 | >IMPORTANT: 131 | > 132 | >Properties from Data-Object, which doesn't exist in Schema-Object, are ignored. 133 | 134 | 135 | Reactive Result (Vuex) 136 | === 137 | 138 | Model `Data` und describing `Schema` flow as prop into the `Vue-Form-Base`. On the concept of *one-way data flow* you get reactive access to your modified data via Vuex Store `$store.state.datastate` . Installed Vuex is mandatory, details about Vuex you can find here [Vuex-Introduction](https://vuex.vuejs.org/en/intro.html) 139 | 140 | 141 | 142 | If you need to dynamically modify the internal Schema (for example if you want to change dynamically `schema.hidden` to show/hide one item depending from the input of another item) you can have reactive access to the modified Schema via Vuex Store `$store.state.schemastate`. 143 | 144 | Inside a single component .vue file you can use your component like this 145 | 146 | 157 | 158 | Get **Access** to the reactive Result using Vuex State anywhere in your Project. 159 | 160 | 161 | this.$store.state.datastate 162 | 163 | 164 | > IMPORTANT: 165 | > 166 | > 'Data' and 'Schema' passed as Prop becomes not mutated. 167 | 168 | Two Forms can be reactiv **Linked** by using the same state property 169 | 170 | 171 | 172 | 173 | 174 | and if you need different CSS 175 | 176 | 177 | 178 | 179 | 180 | 181 | **Reset** modified Data and modified Schema use following code inside the parent single component .vue file 182 | 183 | If you need to change the Schema-Object dynamically, like in this case hiding another item 184 | 185 | schema:{ 186 | ... 187 | user: { 188 | type:'text', 189 | mapSet: (val, obj, data, schema) => { schema.password.hidden = val === 'hide'; return val } 190 | }, 191 | password: { 192 | ... 193 | } 194 | } 195 | 196 | then you need `datastate` and `schemastate` to restore like in this case 197 | 198 | ... 199 | methods:{ 200 | reset(){ 201 | this.$store.state.datastate= cloneDeep(this.data); 202 | this.$store.state.schemastate= cloneDeep(this.schema) 203 | }, 204 | ... 205 | }, 206 | ... 207 | 208 | In common use cases without modified Schema **Reset** can be shortened 209 | 210 | 213 | 214 | 227 | 228 | 229 | 230 | 231 | Schema 232 | === 233 | 234 | 235 | 236 | Schema is an object, which defines and controls the behavior of your form. Each Key in your schema-object must reflect a key in the data-object. 237 | 238 | schema:{ 239 | user: { type:'text'}, // minimalistic definition of input-type 240 | } 241 | 242 | 243 | // more 244 | 245 | validate = val => console.log(val); 246 | mapSet = val => val + '!' 247 | schema:{ 248 | user: { 249 | type:'text', 250 | label:'User:', 251 | pattern:'([A-Z]*)', 252 | css:'blue', 253 | validate, // is the same as - validate:validate, 254 | mapSet, // is the same as - mapSet:mapSet, 255 | order:1 256 | }, 257 | ... 258 | } 259 | 260 | In common use cases the the value will be another object with several properties, to get different control over the behaviour of your input-field. 261 | 262 | **Properties in Schema** 263 | 264 | 265 | schema:{ 266 | order: number, // controls order of displaying 267 | 268 | type: string, // 'text', 'password', 'email', ... 269 | label: string, // title of item 270 | placeholder: string, // placeholder set null to hide 271 | true: string, // text if checkbox is checked 272 | false: string, // text if checkbox is unchecked 273 | accept: string, // type:'file' - limit files audio/*, image/*, .pdf 274 | title: string, // define your own validation message 275 | error: string, // preset/set inline error msg 276 | 277 | css: string, // inject one or more classnames at item level 278 | // Use 12 column grid system from materializecss.com/grid.html for displaying items 279 | // for example a 12 column grid with 3 items in one row would look like: 280 | // schema:{ item1:{ css:'col s4'}, item2:{ css:'col s4'}, item3:{ css:'next-row col s4'} } 281 | 282 | pattern: string, // regex to control input 283 | 284 | min: number, // limit number or range 285 | max: number, // limit number or range 286 | step: number, 287 | maxlength: number, // max length of type text, password, email 288 | 289 | multiple: bool, // type:'file' select one or more files 290 | required: bool, // need an input value 291 | disabled: bool, // disable input field 292 | readonly: bool, 293 | hidden: bool, // hide item - set from another item 294 | 295 | options: array, // used with type: radio, list, text, select, mselect 296 | 297 | mapGet: function, function( val, obj, state, schema ) {... return val} 298 | mapSet: function, function( val, obj, state, schema ) {... return val} } 299 | 300 | validate: true // use inline error message 301 | validate: function, function( msg, obj, state, schema, validity ) {...} 302 | noValidate: function, function( value, obj, state, schema ) {...} 303 | } 304 | 305 | 306 | **Real-Life Example** 307 | 308 | ... 309 | schema:{ 310 | 311 | user: { type:'text', label:'Fullname:', placeholder:'Name...', css:'col s6'}, 312 | 313 | email: {type:'email', validate:true, mapSet: v => v && v.toUpperCase(), css:'next-row col s6' }, 314 | 315 | singleRole:{ type:'select', options:['Admin','Guest','User'] }, 316 | 317 | } 318 | ... 319 | 320 | 321 | 322 | 323 | 324 | 325 | Style with CSS 326 | --- 327 | 328 | Customize your **vue-form-base** component using the following CSS-Classnames 329 | 330 | 331 | > IMPORTANT: 332 | > Don't use ` 419 | 420 | 424 | 425 | import FormBase from './FormBase.vue'; 426 | 427 | export default { 428 | 429 | data () { 430 | return { 431 | 432 | data:{ 433 | user: 'smith', 434 | pw: 'secret' 435 | }, 436 | 437 | schema:{ 438 | user: { 439 | type:'text', 440 | label:'User:', 441 | placeholder:'User...' 442 | }, 443 | pw: { 444 | type:'password', 445 | pattern:'^.{6,}', 446 | lable:'Password:', 447 | title: 'Password must have minimal 6 Chars', 448 | required:true, 449 | validate:true 450 | } 451 | } 452 | } 453 | }, 454 | 455 | components:{ 456 | FormBase 457 | } 458 | } 459 | 460 | 461 | 462 | Features 463 | === 464 | 465 | * vue-component 466 | * edit plain or deep nested objects 467 | * support most of input types 468 | * full reactive result 469 | * configurable via Schema Defintion 470 | * configurable Style based on Materialize CSS 471 | 472 | 473 | 474 | Dependencies 475 | === 476 | 477 | * Vue 2.0 478 | 479 | * Vuex 480 | 481 | * Lodash 482 | 483 | * Materialize CSSs 484 | 485 | 486 | 487 | Similar Projects 488 | === 489 | 490 | [vue-form-generator](https://github.com/icebob/vue-form-generator) 491 | 492 | [vue-formular](https://github.com/matfish2/vue-formular) 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | My First HTML Page 7 | 8 | 9 | 10 | 11 | My text goes here. 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | ## Welcome to GitHub Pages 2 | 3 | You can use the [editor on GitHub](https://github.com/wotamann/vue-form-base/edit/master/docs/index.md) to maintain and preview the content for your website in Markdown files. 4 | 5 | Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. 6 | 7 | ### Markdown 8 | 9 | Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for 10 | 11 | ```markdown 12 | Syntax highlighted code block 13 | 14 | # Header 1 15 | ## Header 2 16 | ### Header 3 17 | 18 | - Bulleted 19 | - List 20 | 21 | 1. Numbered 22 | 2. List 23 | 24 | **Bold** and _Italic_ and `Code` text 25 | 26 | [Link](url) and ![Image](src) 27 | ``` 28 | 29 | For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). 30 | 31 | ### Jekyll Themes 32 | 33 | Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/wotamann/vue-form-base/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. 34 | 35 | ### Support or Contact 36 | 37 | Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out. 38 | -------------------------------------------------------------------------------- /example/vue-form-base/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["es2015", { "modules": false }] 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /example/vue-form-base/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /example/vue-form-base/.gitignore: -------------------------------------------------------------------------------- 1 | #dist in Client 2 | dist 3 | 4 | node_modules 5 | 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | 11 | # Runtime data 12 | pids 13 | *.pid 14 | *.seed 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 23 | .grunt 24 | 25 | # node-waf configuration 26 | .lock-wscript 27 | 28 | # Compiled binary addons (http://nodejs.org/api/addons.html) 29 | build/Release 30 | 31 | # Dependency directories 32 | node_modules 33 | jspm_packages 34 | 35 | # Optional npm cache directory 36 | .npm 37 | 38 | # Optional REPL history 39 | .node_repl_history 40 | 41 | # ========================= 42 | # Operating System Files 43 | # ========================= 44 | 45 | # OSX 46 | # ========================= 47 | 48 | .DS_Store 49 | .AppleDouble 50 | .LSOverride 51 | 52 | # Thumbnails 53 | ._* 54 | 55 | # Files that might appear in the root of a volume 56 | .DocumentRevisions-V100 57 | .fseventsd 58 | .Spotlight-V100 59 | .TemporaryItems 60 | .Trashes 61 | .VolumeIcon.icns 62 | 63 | # Directories potentially created on remote AFP share 64 | .AppleDB 65 | .AppleDesktop 66 | Network Trash Folder 67 | Temporary Items 68 | .apdisk 69 | 70 | # Windows 71 | # ========================= 72 | 73 | # Windows image file caches 74 | Thumbs.db 75 | ehthumbs.db 76 | 77 | # Folder config file 78 | Desktop.ini 79 | 80 | # Recycle Bin used on file shares 81 | $RECYCLE.BIN/ 82 | 83 | # Windows Installer files 84 | *.cab 85 | *.msi 86 | *.msm 87 | *.msp 88 | 89 | # Windows shortcuts 90 | *.lnk 91 | client/src/views/LetterContainer.vue 92 | rethink-db/dinosaurus/dinosaurus/efabbcdf-9c30-4a0e-9e37-204826d3da29 93 | rethink-db/tiger/rethinkdb_data/metadata 94 | rethink-db/tiger/rethinkdb_data/log_file 95 | rethink-db/panther/rethinkdb_data/efabbcdf-9c30-4a0e-9e37-204826d3da29 96 | -------------------------------------------------------------------------------- /example/vue-form-base/README.md: -------------------------------------------------------------------------------- 1 | ## Example of vue-form-base 2 | 3 | > A Vue component which generates a form to edit plain or nested JS-Objects with a reactive Result using Vuex. 4 | 5 | > Integrate 'formBase.vue' like a Vue-component into your project 6 | 7 | 8 | 9 | ## Build Setup 10 | 11 | 12 | **install dependencies** 13 | 14 | npm install 15 | 16 | **serve with hot reload at localhost:8080** 17 | 18 | npm run dev 19 | 20 | **build for production with minification** 21 | 22 | npm run build 23 | 24 | 25 | For detailed explanation on how things work, consult the [docs for vue-loader](http://vuejs.github.io/vue-loader). 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/vue-form-base/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | form-base 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /example/vue-form-base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-form-base-demo", 3 | "description": "demo of vue-form-base", 4 | "version": "1.0.0", 5 | "author": "wotamann ", 6 | "private": true, 7 | "license": "MIT", 8 | "scripts": { 9 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", 10 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" 11 | }, 12 | "dependencies": { 13 | "lodash": "^4.17.4", 14 | "vue": "^2.1.0", 15 | "vue-form-base": "0.0.3 - 0.2.5", 16 | "vuex": "^2.1.2" 17 | }, 18 | "devDependencies": { 19 | "babel-core": "^6.0.0", 20 | "babel-loader": "^6.0.0", 21 | "babel-preset-es2015": "^6.0.0", 22 | "cross-env": "^3.0.0", 23 | "css-loader": "^0.25.0", 24 | "file-loader": "^0.9.0", 25 | "url-loader": "^0.5.7", 26 | "vue-loader": "^10.0.0", 27 | "vue-template-compiler": "^2.1.0", 28 | "webpack": "^2.2.0", 29 | "webpack-dev-server": "^2.2.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /example/vue-form-base/src/App.vue: -------------------------------------------------------------------------------- 1 | 83 | 84 | 142 | 143 | 144 | 299 | 300 | -------------------------------------------------------------------------------- /example/vue-form-base/src/components/formBase.vue: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 126 | 127 | 128 | 458 | 459 | 460 | -------------------------------------------------------------------------------- /example/vue-form-base/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | const store = new Vuex.Store({ 7 | 8 | state: { 9 | 10 | // 11 | // stateDataForm: null 12 | data: null, // vuex state object holding the edited data 13 | 14 | // 15 | // stateSchemaForm: null 16 | schema: null // vuex state object holding the possible modified schema 17 | 18 | } 19 | 20 | }); 21 | 22 | import App from './App.vue' 23 | 24 | new Vue({ 25 | el: '#app', 26 | store, 27 | render: h => h(App) 28 | }) 29 | -------------------------------------------------------------------------------- /example/vue-form-base/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var webpack = require('webpack') 3 | 4 | module.exports = { 5 | entry: './src/main.js', 6 | output: { 7 | path: path.resolve(__dirname, './dist'), 8 | publicPath: '/dist/', 9 | filename: 'build.js' 10 | }, 11 | module: { 12 | 13 | loaders: [ 14 | { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader:"url?limit=10000&mimetype=application/font-woff" }, 15 | { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file" } 16 | ], 17 | 18 | rules: [ 19 | { 20 | test: /\.vue$/, 21 | loader: 'vue-loader', 22 | options: { 23 | loaders: { 24 | // Since sass-loader (weirdly) has SCSS as its default parse mode, we map 25 | // the "scss" and "sass" values for the lang attribute to the right configs here. 26 | // other preprocessors should work out of the box, no loader config like this necessary. 27 | 'scss': 'vue-style-loader!css-loader!sass-loader', 28 | 'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax' 29 | } 30 | // other vue-loader options go here 31 | } 32 | }, 33 | { 34 | test: /\.js$/, 35 | loader: 'babel-loader', 36 | exclude: /node_modules/ 37 | }, 38 | { 39 | test: /\.(png|jpg|gif|svg)$/, 40 | loader: 'file-loader', 41 | options: { 42 | name: '[name].[ext]?[hash]' 43 | } 44 | } 45 | ] 46 | }, 47 | resolve: { 48 | alias: { 49 | 'vue$': 'vue/dist/vue.common.js' 50 | } 51 | }, 52 | devServer: { 53 | historyApiFallback: true, 54 | noInfo: true 55 | }, 56 | performance: { 57 | hints: false 58 | }, 59 | devtool: '#eval-source-map' 60 | } 61 | 62 | if (process.env.NODE_ENV === 'production') { 63 | module.exports.devtool = '#source-map' 64 | // http://vue-loader.vuejs.org/en/workflow/production.html 65 | module.exports.plugins = (module.exports.plugins || []).concat([ 66 | new webpack.DefinePlugin({ 67 | 'process.env': { 68 | NODE_ENV: '"production"' 69 | } 70 | }), 71 | new webpack.optimize.UglifyJsPlugin({ 72 | sourceMap: true, 73 | compress: { 74 | warnings: false 75 | } 76 | }), 77 | new webpack.LoaderOptionsPlugin({ 78 | minimize: true 79 | }) 80 | ]) 81 | } 82 | -------------------------------------------------------------------------------- /images/name1.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wotamann/vue-form-base/a70906c69a530261a85a5ae50687b7e83fce90f5/images/name1.JPG -------------------------------------------------------------------------------- /images/name2.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wotamann/vue-form-base/a70906c69a530261a85a5ae50687b7e83fce90f5/images/name2.JPG -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | var FormBase = require('./FormBase.vue') 3 | module.exports = FormBase 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-form-base", 3 | "version": "0.0.4", 4 | "description": "Form-Generator: a Vue 2.0 component, reactive Result using Vuex, responsive Display", 5 | "main": "FormBase.vue", 6 | "scripts": { 7 | "test": "npm run unit" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/wotamann/vue-form-base.git" 12 | }, 13 | "keywords": [ 14 | "vue", 15 | "vue 2.0", 16 | "vuex", 17 | "formular", 18 | "generator", 19 | "json", 20 | "schema", 21 | "responsive", 22 | "reactive", 23 | "select", 24 | "multiselect" 25 | ], 26 | "author": "woko@aon.at", 27 | "license": "MIT", 28 | "bugs": { 29 | "url": "https://github.com/wotamann/vue-form-base/issues" 30 | }, 31 | "homepage": "https://github.com/wotamann/vue-form-base#readme" 32 | } 33 | -------------------------------------------------------------------------------- /publish-npm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | npm version patch 4 | npm publish --------------------------------------------------------------------------------