-
Notifications
You must be signed in to change notification settings - Fork 531
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
Streamlining of schema #481
Streamlining of schema #481
Conversation
fieldClasses and styleClasses are different. fieldClasses defines the CSS Class used on the This allows you to define 'form-control' class on the input, and 'col-md-4' on the form-group that contains your field, for layout control. |
why is 'default' being deprecated? Do we not allow the form schema to define default values for fields anymore (or was this not used for that?). |
My bad, I did not understand that. I will add
If you want to add |
I assumed default was just a default value for a field if the model did not define one. |
Hi guys, currently I have no time to review this PRs. I don't want to block the development, so don't wait for me, I trust you :) Thanks. |
I'm having a hard time with the test, but I think I'm finally starting to get them to work. const allowedKeys = [
// used in form group only
"type",
"model",
"label",
"hint",
"help",
"featured",
"visible",
"styleClasses",
"labelClasses",
"buttons",
// used in both
"id",
"disabled",
"required",
"readonly",
"fieldOptions",
// used in fields only
"inputName",
"placeholder",
"validator",
"fieldClasses",
"values",
"attributes",
"get",
"set",
"onChanged",
"onValidated"
];
EDIT: my bad for accidentally closing the PR |
The test where a real pain to get to work, but I was able to make it. I have added If this is ok with you, I will stop here on this. I will do the documentation later. After that I will start to work on a better way to create group alongside fields (and group in group in group, because why not ?). I have an idea on how to do it, but I need to get my hand dirty and face real code ! |
At least ! Travis is fixed ! |
The ways schema is written is changed to make it easy to create custom fields and write documentation.
For any given field, it's option are not really enforced.
Depending on the field, top level key are a mix of this and whatever the (custom) field decide to put in.
Also, other options can be put into
***Option
(e.g. radiosOptions, selectOptions, pikadayOptions).In the end, it make it hard to guess where to put options when creating custom fields and prevent some ease of use.
With this PR, top keys are restricted to this list :
Nothing actually stop you from adding anything else to this list, but be aware that it will be frown upon and will prevent your custom field from being part of the "official" list.
fieldOptions
was created to replace***Options
. This mean that any option not in the list must go under this key.This is the first step toward the future V3 and more tools (builders, etc).
There are multiple breaking changes.
You will need to modify your schema to fit the new system.
If you are a custom field creator, you need to change the logic and keys to fit.
multi
,multiple
anddefault
are deprecated. Their related functions will be removed when the new group system will be created in a following PR.Other changes include making
inputName
,placeholder
,disabled
,required
,readonly
,fieldClasses
,fieldOptions
andvalues
as computed of fields. It make these options directly available to field (schema.readonly
becomereadonly
). They can also all be defined with a function that return their value if needed.