Skip to content

Conversation

teameh
Copy link
Contributor

@teameh teameh commented Sep 16, 2016

Added an example to the numbers examples as well so you can check it out.

This works only if user provided an enum for that integer or number.

This could optionally be added to this pr. Something like this in getAlternativeWidget could check that:

if(
    (schema.type === 'integer' || schema.type === 'integer')
  && widget === 'radio' && !widgetOptions.enumOptions
) {
  throw new Error(`No radio possible without enumOptions`);
}

@n1k0
Copy link
Collaborator

n1k0 commented Sep 16, 2016

A very useful addition, thank you. I've deployed the patch to gh-pages, works just fine; test and code look good 👍

I'm torn adding specific checks as you suggest in the description, though if they're extracted to a dedicated, separated function it's probably a very worthy addition.

@teameh
Copy link
Contributor Author

teameh commented Sep 16, 2016

I'm torn adding specific checks as you suggest in the description, though if they're extracted to a dedicated, separated function it's probably a very worthy addition.

Yeah that needs to go in a seperate function. I can work on it

@leplatrem
Copy link
Contributor

Do not hesitate to open a new PR/issue with the validation/check that you suggested.

@n1k0 n1k0 merged commit acad10f into rjsf-team:master Oct 14, 2016
@teameh teameh deleted the radio-int-number branch October 14, 2016 16:22
@teameh
Copy link
Contributor Author

teameh commented Oct 14, 2016

Great, thanks. Will do, when I use it again.

n1k0 added a commit that referenced this pull request Nov 9, 2016
This release has been made possible by the combined work of @olzraiti, @maartenth, @vinhlh, @tiemevanveen , @dehli, @enjoylife, @PabloEn, @israelshirk, @sjhewitt and @rom10. Thank you folks!

Breaking changes
----------------

Support for passing `DescriptionField`, `TitleField` and `SchemaField` as `Form` props as been dropped in this release. You now have to always pass them through the `fields` prop.

Deprecations
------------

* Leverage `ui:options` everywhere (fix #370) (#378)

There's now a unique recommended way to specify options for widgets in uiSchema, which is the `ui:options` directive. Previous ways are still supported, but you'll get a warning in the console if you use them.

New features
------------

* Allow overriding the default fields/widgets (#371)
* Pass data to `FieldTemplate` as strings instead of as React components (#341)
* Pass `schema` & `uiSchema` to the field template component (#379)
* Add `ui:order` wildcard feature and improve error messages (#368)
* Add support for widget autofocus (#288)
* Array field optional sortability (#345)
* Radio widget support for integers and numbers (#325)
* Add support for inline radios and checkboxes. (fix #346) (#348)
* Added ref to `FileWidget`. (#355)
* Added `removable` and `addable` options for array items (#373)
* Enable Windows development (#320)

Enhancements and bugfixes
-------------------------

* Fix `minimum/maximum==0` for `UpDownWidget` and `RangeWidget` (#344)
* Handle numbers requiring trailing zeros with more grace (#334)
* Pass empty title to `TitleField` instead of name (#311)
* `asNumber`: return `undefined` when value is empty string (#369)
* Use [glyphicons](http://getbootstrap.com/components/#glyphicons) for buttons by default. (fix #337) (#375)
* Support old versions of React (#312)
@n1k0
Copy link
Collaborator

n1k0 commented Nov 9, 2016

Released in v0.41.0.

@teameh
Copy link
Contributor Author

teameh commented Nov 9, 2016

\0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants