-
Notifications
You must be signed in to change notification settings - Fork 533
Grouping fields #209
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
Grouping fields #209
Conversation
* Add support for an optional legend for each schema/fieldset. Expects the schema to look something like this: ``` schema: { legend: "Contact Details", fields: [ { type: "input", inputType: "text", label: "Name", model: "name" }, ... ``` * Add support for field id prefixes, at the form level. So you can add a `fieldIdPrefix: 'prefix_here_'` to your `formOptions` and this will be prepended to _all_ field id's.
* Add support for schema.groups, schema.groups legend & field id prefixes * Add support for grouping fields. You still can to put fields as always in combination with groups. * Add support for an optional legend for each group/fieldset. Expects the schema to look something like this: ``` section1: { groups:[{ legend: "Contact Details", fields: [ { type: "input", inputType: "text", label: "Name", model: "name" }, { type: "input", inputType: "email", label: "Email", model: "email" } ] },{ legend: "Other Details", fields: [ { type: "input", inputType: "text", label: "More", model: "more" }, { type: "input", inputType: "text", label: "Things", model: "things" } ] }] }, ``` * Add support for field id prefixes, at the form level. So you can add a `fieldIdPrefix: 'prefix_here_'` to your `formOptions` and this will be prepended to _all_ field id's. Based on phemisystems@a6165c8 @dflock @phemisystems
add options prop to abstractField remove beforeMount
@icebob what I try to explain before is:
I'm recreating the schema each time the model changes as the schema has linked between them. Each time I update schema, a weird behaviour happen. First: https://cloud.githubusercontent.com/assets/2902073/26468867/43976b56-4198-11e7-8701-2a5928441104.png Then I select a VehicleType https://cloud.githubusercontent.com/assets/2902073/26468961/a941a4b2-4198-11e7-8116-4ce685a011eb.png |
@jmverges Could you create a jsfiddle? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thanks!
Further tasks before merge:
Somebody can help? At least with docs :) |
This looks good. I'd still advocate calling it |
I would like to have that somehow configurable, or "hackable" somehow. Think about doing some tabs for each "fieldset" you may need to change the group rendering. |
I think |
In the future we can add |
Ok, calling it groups is fine. I think if I was doing multiple tabs, I'd probably do the tab markup outside of vfg and have multiple calls to vfg, one per tab, maybe? Haven't thought about it too deeply. What about multiple tabs, with groups/fieldsets on each tab? I think the groups thing should just do fieldsets for now - don't try and make it do everything. |
I'll start updating the docs now. |
Thanks @dflock. Test fixed. |
|
…ect property Move core of `getFieldID` to utils
OK, docs changes are done (I think), here: https://www.gitbook.com/book/icebob/vueformgenerator/changes/7 |
Good morning guys, A lot of work you did! @icebob removing "sync" removes the possibility to update the schema and get the form rebuild. did you try it? Edit: Cheers |
How can I create a fiddle for Vue and Vue Form Generator? If you can provide me the barebones, I can put the code in there 👍 |
Fork it: https://jsfiddle.net/icebob/0mg1v81e/ |
I don't get it running int fiddle but something like this https://jsfiddle.net/ym6dn8zd/1/ |
Now it's running, but what is the exact problem? https://jsfiddle.net/ym6dn8zd/4/ |
https://jsfiddle.net/ym6dn8zd/7/ I cannot reproduce it in there, weird |
Forgot it, was my own problem, didn't see it |
This PR add two new features to vfg by @dflock & @jmverges.
Syntax:
Dev example: http://localhost:8080/grouping/