Commit Graph

703 Commits

Author SHA1 Message Date
Ashwin Ramaswami
1e0704f564 fix: downgrade eslint to 4 to keep node 5/6 compatibility 2019-07-01 01:09:35 +00:00
Ashwin Ramaswami
657c206bd9 fix: update eslintrc and files to conform to no-prototype-builtins 2019-06-30 22:46:52 +00:00
Ashwin Ramaswami
6d8f3676e8 chore: upgrade packages to fix vulnerabilities 2019-06-30 22:36:50 +00:00
ealtunyay
a8319d79ce pass formContext to SchemaField (#1330) 2019-06-29 07:45:28 -07:00
Ashwin Ramaswami
e98a016a23 [WIP] Live omit (#1332)
* feat: add liveOmit prop

* fix: fix live omit

* fix: only live omit when liveOmit is true

* doc: update doc
2019-06-29 07:39:41 -07:00
Troy Jaeger
fe62b49a0e Minor changes: added lodash get to package.json, rename toNameSchema to toPathSchema (#1331) 2019-06-23 15:00:21 -07:00
Ashwin Ramaswami
a9e950aefb Merge branch 'omit-extra-data' of https://github.com/CodeGains/react-jsonschema-form into CodeGains-omit-extra-data 2019-06-22 16:35:34 +00:00
Ashwin Ramaswami
97865673a5 Fix nested dependencies updating (#1320)
* fix: nested dependencies updating

* fix: nested dependencies issue

* test: add tests
2019-06-19 15:39:47 -07:00
Ashwin Ramaswami
ef7e89122c Show netlify badge on deploy previews (#1323)
* feat: show netlify badge on deploy previews

* fix: use string to store netlify badge status
2019-06-18 16:07:58 +02:00
Ashwin Ramaswami
535df77cde doc: remove cs-format from PR template (#1310) 2019-06-18 07:24:53 +02:00
Ashwin Ramaswami
1f6758c219 Pass registry to ArrayFieldTemplate (#1317)
* fix: pass registry to ArrayFieldTemplate

* test: add test
2019-06-18 07:24:13 +02:00
Ankur Kaushal
7ed717a388 Upgrade to Babel 7 (#1322)
- Remove deprecated `babel-plugin-react-transform` with `@babel/plugin-transform-react-jsx`
- Update a few files with default exports as they were throwing warnings while running `dev`
2019-06-17 06:29:51 -07:00
Ethan Glasser-Camp
c1da820fe3 Bump version 1.6.1 v1.6.1 2019-06-07 21:34:41 -04:00
Ashwin Ramaswami
8c81cc768e fix: populate defaults for nested dependencies when formData is undefined (#1313)
* fix: populate defaults for nested dependencies when formData is undefined

* test: add test for null

* fix: handle null case as per @jrose-carecloud's suggestion
2019-06-07 21:33:19 -04:00
Ashwin Ramaswami
20511b9715 test: add test to merge required dependencies (#1306) 2019-06-07 09:10:37 +02:00
Ethan Glasser-Camp
83be9407b9 Bump version 1.6.0 v1.6.0 2019-06-06 15:18:54 -04:00
SlashBin
59f9d26b38 Allowing AnyOfField or OneOfField to use schema (#1302)
I have a use case where I'd like to be able to define an anyOf in the schema, but still render items from the schema. This should be allowable if I create my own AnyOfField, but currently SchemaField doesn't pass through my schema.
2019-06-02 18:36:46 -07:00
fsteger
41fce4aad1 Ensure defaults are passed along for multiselect arrays when minItems… (#1264)
* Ensure defaults are passed along for multiselect arrays when minItems present (#1258)

* Add test.

* Remove superfluous samples
2019-06-02 18:25:10 -07:00
fsteger
2a7e4e11fd Pass along label/placeholder/registry for custom multiselect widgets. (#1301) 2019-06-02 17:55:15 -07:00
Ashwin Ramaswami
bf0e8b819a remove describe.only for tests (#1305) 2019-06-02 17:48:37 -07:00
domharrington
09fda842ce Default type to object if undefined (#1292)
* Default type to `object` if undefined

Fixes #1265

* Tidy up if statement expression as per PR review
2019-06-02 08:59:19 -07:00
Ashwin Ramaswami
388612e41d Fix defaults with oneof/anyof and nested dependencies (#1304)
* fix: refactor out getMatchingOption

* fix: populate defaults for oneOf/anyOf

* fix: oneOf dependencies issue #1293

* fix: set defaults on oneof/anyof change

* fix: remove unneeded export

* test: reorg tests

* fix: populate defaults for nested dependencies

* fix: fix NIT by @lucianbuzzo

* fix: fix typo

* Update test/utils_test.js
2019-06-02 08:54:50 -07:00
Anatoly Leskovets
e6518e2cb4 #1209 | allow widget to be wrapped as React.ForwardedRef (#1227) 2019-06-01 20:57:50 -07:00
Dan Balarin
cc7e1b4f29 Added withTheme HOC (#1226)
* Added withTheme HOC

* prettier run

* renamed restData variable

* data.Fields -> data.fields

* Created documentation

* doc: update doc

* test: add test

* removed custom form

* removed custom form from documentation

* Updated withTheme + docs to show pass-through nature of all the props

* Apply suggestions from code review

Co-Authored-By: Ashwin Ramaswami <aramaswamis@gmail.com>

* Update test/withTheme_test.js

Co-Authored-By: Ashwin Ramaswami <aramaswamis@gmail.com>

* Updated tests
2019-05-24 21:28:19 -07:00
Jacob Levernier
753023021b Added example for collapsing fields. (#1294) 2019-05-23 17:05:58 -07:00
Sebastian Busch
48742bf20f Fix file widget tests (#1285)
* react-dom is external peerDependency, just like react.

fixes version conflicts, e.g. I got an error

  Uncaught TypeError: this.updater.enqueueCallback is not a function when using setState callback

because I use React 16.x and react-jsonschema-form bundled react-dom 15.x

See https://github.com/facebook/react/issues/10320#issuecomment-318754280

* Fix for new submit() method (PR #1058) also submitting the HTML form

..., navigating away from current page at least in Firefox. Reason:
dispatched event was not cancelable, so preventDefault in onSubmit
couldn't cancel it.

Links:

* <https://stackoverflow.com/a/40916998>
* <https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable>

* Synchronous call to onSubmit() from props

Due to the use of setImmediate() hack in setState utility function (utils.js),
onSubmit() handler from props is called asynchronously. This leads to massive
problems for operations requiring "trusted events", like window.open() or
programmatically submitting forms with target "_blank" (which we needed)

Because onSubmit() should not need the performance-related setImmiate() hack, I
replaced call to setState utility function with proper this.setState() from
React.

* fix failing FileWidget tests

by changing to proper use of setState() without setImmediate() hacks (see #1197)

* fix input type, fix test name

* Test with newer node versions

* Add node 12
2019-05-21 21:05:00 -07:00
Lucian Buzzo
67d17dd06f Correctly use $ref when matching options with oneOf (#1287)
* Correctly use $ref when matching options with oneOf

Fixes #1173

Additionally, if a matching option isn't found, preserve the currently
selected option

Change-type: patch
Signed-off-by: Lucian <lucian.buzzo@gmail.com>

* Update src/components/fields/MultiSchemaField.js
2019-05-19 12:41:07 -07:00
Troy Jaeger
a239d9dcb1 handle case where the form is a single input 2019-05-14 14:38:58 -07:00
Patrik Henningsson
98952b7f2a Support readOnly property from latest validation draft (#1282)
* Support `readOnly` property from draft-handrews-json-schema-validation-01

* Fix failing test

* Add note in docs about using the readOnly property

* Update to be consistent with the changes done in commit 497620f
2019-05-14 11:25:16 -07:00
Troy Jaeger
9bbbb74662 added omitExtraData as a playground live settings option 2019-05-13 15:31:18 -07:00
Troy Jaeger
a056ddeeed changed name to $name in the nameSchemas to avoid collisions, added tests 2019-05-13 15:17:36 -07:00
Troy Jaeger
b30714ff2d Added omitExtraData prop as described in PR #1190 2019-05-10 17:34:44 -07:00
Samantha Branham
1ee343d465 Make numbers nullable by allowing null values to be echoed from asNumber() (#1269)
* Make numbers nullable by allowing null values to be echoed from asNumber()

* fix: revert package-lock changes
2019-05-07 07:01:32 -07:00
Ashwin Ramaswami
fba5bee2ba Fix/warn unknown formats (#1277)
* fix: console warn on unknown format errors instead of showing an error

* fix: default to default widget if string format is not found

* test: update tests
2019-05-07 07:00:29 -07:00
Drew Brigham
c4322bfab6 Update wording for description text (#1266) 2019-04-25 09:37:34 -07:00
fsteger
2d63594e07 Pass along required for custom checkboxes widgets (#1259) 2019-04-24 06:07:16 -07:00
Ethan Glasser-Camp
45ff77f603 Bump version 1.5.0 v1.5.0 2019-04-17 14:42:05 -04:00
faissalMT
c5e8899701 Add NullField (#1238)
* Add NullField

* Always set the formData to null for a null field

* Don't overwrite existing data

* Use central fields propTypes
2019-04-12 13:35:05 -07:00
Ashwin Ramaswami
ac397cae49 fix: do not error when File is not defined (#1253) 2019-04-12 08:43:01 -07:00
Laney Smith
06b5e2f6a1 fix mistake in validation docs (#1251) 2019-04-08 17:46:28 -07:00
Eric Lanehart
e409be5388 Custom string formats (#1186)
* Accept custom string formats via `additionalFormats` prop

Follow AJV extension pattern established for meta schemas and passthrough to AJV's addFormat method

* Wire additionalFormats prop

* additionalFormats → customFormats

* Fix and test custom format prop updates

* Update docs/validation.md

Co-Authored-By: pushred <eric@pushred.co>
2019-04-05 10:19:47 -07:00
Andy Brown
f8d0d45ea5 use select widget to render oneOf / anyOf control (#1220)
* use select widget to render oneOf / anyOf control

* pass more props to widget

* change schema type to number
* get uiOptions to pass to widget

* do not pass props to custom widget in test

* update tests to actually pass custom widget
2019-04-05 10:18:02 -07:00
Ethan Glasser-Camp
73b1458bbe Bump version 1.4.0 v1.4.0 2019-04-04 15:13:39 -04:00
Ashwin Ramaswami
889871f90c docs: document placeholder and autofocus widget props (#1223) 2019-03-28 13:57:12 -04:00
Mozilla-GitHub-Standards
0f4889c224 Add Mozilla Code of Conduct file (#1240)
Fixes #1239.

_(Message COC002)_
2019-03-28 08:54:43 -04:00
oterral
de79e37df4 Fix #1233 : Exclude File object from isObject detection (#1234)
* Fix #1233 : Exclude File object from isObject detection

* Update test name

Co-Authored-By: oterral <oterral@users.noreply.github.com>
2019-03-27 09:35:10 -04:00
Igor Gubernat
3afb5f9fd3 Removed throwing error when there's an extraneous property in ui:order (#814)
* Removed throwing error when there's an extraneous property in ui:order

* Adding tests form orderProperties()

* Updated ObjectField tests to test extraneous properties handling in order list

* fix: keep order warning
2019-03-26 09:24:43 -04:00
Thomas Grainger
9104a71eb2 fix: schema is not an html attribute (#946) 2019-03-25 10:55:50 -04:00
Pathik Gandhi
b096c99965 #804 - Bug Fix - Empty divs are created (#1218)
* #804 - Bug Fix - Empty divs are created

* #804 - Bug Fix - Empty divs are created - Refactoring
2019-03-14 15:08:18 -07:00
Warren Seymour
d9bcf1acfa Basic support for 'nullable' types (#1213)
* Basic support for 'nullable' types

Modifies the implementation of `getSchemaType` so that when a property
has a type of `[<any>, 'null']`, then `<any>` will be passed. This
allows the library to render and validate the field correctly. For the
sake of simplicity, this change does not attempt any further
assumptions, coercions or transformations.

References #465

* Add some test cases to `getSchemaType` spec

* Add FAQ entry detailing nullable type behaviour

* Add Playground example for nullable field

* Tweak FAQ entry wording and fix typo

Co-Authored-By: warrenseymour <warren@fountainhead.tech>

* Correct example in FAQ entry

Co-Authored-By: warrenseymour <warren@fountainhead.tech>
2019-03-12 08:22:11 -07:00