-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
Better automatic (passed through) options for a select, radio, checkboxes #23
Comments
Currently, props can be declared in SimpleSchema (it's covered here) within Idea: { ...
fileType: {
type: Number,
label: 'File Type (Upload, processing, tmp, log, etc)',
optional: true,
allowedValues: Enums.Buckets.fileTypes.values(),
uniforms: {
options: Enums.Buckets.fileTypes.options(),
},
},
... } Yes, I've just changed But to keep compatibility with existing if (_.isObject(options)) {
options = Object.keys(options).map(label => ({label, value: options[label]}));
}
transform = value => (options.find(option => option.value === value) || {label: value}).label; So it will be easier to transition from What do you think, @zeroasterisk? |
I think that sounds fine... For ease of use, for people migrating from I also think it (and all ported config) should be a cascading config: pseudocode: |
Yes, that I thought about allowing |
I think naming consistency is important. If we are using the component as |
@serkandurusoy: Ha, I thought the same at the beginning! But if you are new and want to know, what each form is doing... What |
I don't see an example that uses anything other than AutoForm, so why not call it Uniform: // These are equivalent:
const FullAutoForm = () =>
<AutoForm schema={PostSchema} onSubmit={doc => console.log(doc)} />
;
const SemiAutoForm = () =>
<AutoForm schema={PostSchema} onSubmit={doc => console.log(doc)}>
<AutoField name="category" />
<AutoField name="authors" />
<AutoField name="publishedDate" />
<AutoField name="published" />
<ErrorsField />
<SubmitField />
</AutoForm>
;
const ExplicitAutoForm = () =>
<AutoForm schema={PostSchema} onSubmit={doc => console.log(doc)}>
<SelectField name="category" />
<ListField name="authors">
<ListItemField name="$">
<NestField>
<TextField name="name" />
<NumField name="age" />
</NestField>
</ListItemField>
</ListField>
<DateField name="publishedDate" />
<BoolField name="published" />
<ErrorsField />
<SubmitField />
</AutoForm>
; I believe quickform is just redundant and should not be used. Baseform is a "developer" friendly component that should be used to creat custom top level form components. and UniForm should be our official top level component "implementation" and not be named autoform |
Yes, that would make sense if Yes, those intermediate forms are mostly unused, but in my first draft were only |
Ok, then the question is, what's your suggested best practice? Do you Using helper/shorthand names is not always a great thing due to the But if the separate components don't offer much value out of the context of (Now that I'm thinking about the docs site and examples, I think we should On Thu, Jun 9, 2016 at 8:27 PM, Radosław Miernik notifications@github.com
|
Use what you need, really. About other forms... In short (I want to write more about it in the documentation, or maybe in some Medium post...) - every |
Thanks @radekmie -- so to use this, it should be a simple as changing |
Yes. |
For example, here's a standard Enum based "select" field with
allowedValues
&autoform.options
I have this functionality somewhere -- I'll see if I can dig it up...
The text was updated successfully, but these errors were encountered: