Skip to content

Commit 4cf5f7f

Browse files
committed
Merge branch 'master' of https://github.com/rjsf-team/react-jsonschema-form into conditional-support
2 parents 23288ae + dec3ef4 commit 4cf5f7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+623
-320
lines changed

.github/workflows/ci.yml

+21-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Use Node.js ${{ matrix.node-version }}
19-
uses: actions/[email protected].2
19+
uses: actions/[email protected].5
2020
with:
2121
node-version: ${{ matrix.node-version }}
2222
- run: npm ci
@@ -71,14 +71,33 @@ jobs:
7171
name: dist
7272
path: dist
7373
- name: Deploy playground
74-
uses: crazy-max/ghaction-github-pages@v2.2.0
74+
uses: crazy-max/ghaction-github-pages@v2.5.0
7575
with:
7676
keep_history: true
7777
target-branch: gh-pages
7878
build_dir: dist
7979
env:
8080
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8181

82+
deploy_canary:
83+
runs-on: ubuntu-latest
84+
if: github.ref == 'refs/heads/master'
85+
name: Deploy canary version of packages to npm
86+
needs: [build]
87+
steps:
88+
- uses: actions/checkout@v2
89+
- name: Use Node.js 14.x
90+
uses: actions/[email protected]
91+
with:
92+
node-version: 14.x
93+
- run: npm ci
94+
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
95+
env:
96+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
97+
- run: npx lerna publish from-package --yes --no-verify-access --canary
98+
- if: always()
99+
run: rm .npmrc
100+
82101
docs:
83102
runs-on: ubuntu-latest
84103
steps:

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212
- name: Use Node.js 14.x
13-
uses: actions/[email protected].2
13+
uses: actions/[email protected].5
1414
with:
1515
node-version: 14.x
16-
- run: npm install
16+
- run: npm ci
1717
- run: npm run build
1818
- run: npm test
1919
- run: npm run lint

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ yarn.lock
130130
# Code coverage
131131
coverage
132132
.nyc_output
133+
134+
venv

PULL_REQUEST_TEMPLATE.md

-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,3 @@ If this is related to existing tickets, include links to them as well. Use the s
1414
* [ ] **I'm adding a new feature**
1515
- [ ] I've updated the playground with an example use of the feature
1616

17-
### Deploy preview
18-
19-
Once CI finishes, you should be able to view a deploy preview of the playground from this PR at this link: https://deploy-preview-[PR_NUMBER]--rjsf.netlify.app/

docs/2.x upgrade guide.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# 2.x Upgrade Guide
2+
3+
## Changes from v1 -> v2
4+
5+
### Breaking changes
6+
7+
* We now officially support the @rjsf/material-ui theme. We use a monorepo with Lerna and have published two packages (@rjsf/core and @rjsf/material-ui) with this version number. Note that react-jsonschema-form has been renamed to @rjsf/core ([#1642](https://github.com/rjsf-team/react-jsonschema-form/pull/1642))
8+
* Combine all themes into a single playground ([#1539](https://github.com/rjsf-team/react-jsonschema-form/pull/1539), [#1607](https://github.com/rjsf-team/react-jsonschema-form/pull/1607), [#1623](https://github.com/rjsf-team/react-jsonschema-form/pull/1623))
9+
* Remove ui:order console warning about extraneous properties ([#1508](https://github.com/rjsf-team/react-jsonschema-form/pull/1508))
10+
* Capitalized Yes and No defaults ([#1395](https://github.com/rjsf-team/react-jsonschema-form/pull/1395))
11+
* Fix id of oneof and anyof select ([#1212](https://github.com/rjsf-team/react-jsonschema-form/pull/1212)). The oneof select id is now suffixed by \_\_oneof\_select and the anyof select by \_\_anyof\_select.
12+
* React 16+ is now a peer dependency ([#1408](https://github.com/rjsf-team/react-jsonschema-form/pull/1408))
13+
* We no longer actively support Node version < 8 ([#1462](https://github.com/rjsf-team/react-jsonschema-form/pull/1462))
14+
* Removed setState, setImmediate, safeRenderCompletion helpers/hacks ([#1454](https://github.com/rjsf-team/react-jsonschema-form/pull/1454), [#1720](https://github.com/rjsf-team/react-jsonschema-form/pull/1720))
15+
* Inject defaults in arrays ([#1499](https://github.com/rjsf-team/react-jsonschema-form/pull/1499))
16+
17+
### Features
18+
19+
* Add material-ui theme in the main repo ([#1420](https://github.com/rjsf-team/react-jsonschema-form/pull/1420)) (note: has not been fully integrated yet -- this will be fully integrated when we publish multiple packages with lerna - [#1501](https://github.com/rjsf-team/react-jsonschema-form/pull/1501))
20+
* Add extraErrors prop for async validation ([#1444](https://github.com/rjsf-team/react-jsonschema-form/pull/1444))
21+
* Add support for overriding UnsupportedField ([#1660](https://github.com/rjsf-team/react-jsonschema-form/pull/1660))
22+
23+
### Fixes
24+
25+
* Fix issue with false as formData on radio components ([#1438](https://github.com/rjsf-team/react-jsonschema-form/pull/1438))
26+
* Security patches ([#1458](https://github.com/rjsf-team/react-jsonschema-form/pull/1458), [#1459](https://github.com/rjsf-team/react-jsonschema-form/pull/1459))
27+
* Memo components in custom widgets and fields. ([#1447](https://github.com/rjsf-team/react-jsonschema-form/pull/1447))
28+
* Introduce Form autoComplete attribute and deprecate autocomplete ([#1483](https://github.com/rjsf-team/react-jsonschema-form/pull/1483))
29+
* Rewrite mergeSchemas to fix schema dependencies merging ([#1476](https://github.com/rjsf-team/react-jsonschema-form/pull/1476))
30+
* Update arrays correctly when changing index ([#1485](https://github.com/rjsf-team/react-jsonschema-form/pull/1485))
31+
* Update anyOf schema to correctly update items in an array ([#1491](https://github.com/rjsf-team/react-jsonschema-form/pull/1491))
32+
* Update schema to re-render when idschema changes ([#1493](https://github.com/rjsf-team/react-jsonschema-form/pull/1493))
33+
* Make sure BooleanField supports an overridable DescriptionField ([#1594](https://github.com/rjsf-team/react-jsonschema-form/pull/1594))
34+
* Export typings ([#1607](https://github.com/rjsf-team/react-jsonschema-form/pull/1607))
35+

docs/3.x upgrade guide.md

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
# 3.x Upgrade Guide
22

3-
## BREAKING
3+
## Breaking changes
4+
5+
### Node support
6+
7+
Dropped support for Node 8, 9, 10. Minimum supported version of Node.js is now 12.
8+
9+
### Dereferenced schemas for `anyOf`/`allOf` options
10+
11+
`MultiSchemaField`'s `options` interface is different. Before, an option could include a `$ref`. Now, any option with a reference will be resolved/dereferenced when given as props for `MultiSchemaField`.
12+
13+
### Help field IDs
14+
15+
IDs for [Help fields](https://react-jsonschema-form.readthedocs.io/en/latest/api-reference/uiSchema/#help) are now suffixed by `__help` so that the IDs are unique. Previously, their IDs would be the same as the fields that they were describing.
416

517
### Bring your own polyfills
618

@@ -16,10 +28,3 @@ From `@babel/preset-env`'s docs
1628

1729
> We leverage [`browserslist`, `compat-table`, and `electron-to-chromium`] to maintain mappings of which version of our supported target environments gained support of a JavaScript syntax or browser feature, as well as a mapping of those syntaxes and features to Babel transform plugins and core-js polyfills.
1830
19-
### Dereferenced schemas for `anyOf`/`allOf` options
20-
21-
`options` prop for `MultiSchemaField` has been changed slightly.
22-
23-
Before an option could include a `$ref`.
24-
25-
Now any option with a reference will be resolved/dereferenced when given as props for `MultiSchemaField`.

docs/advanced-customization/custom-templates.md

+1
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,6 @@ The following props are part of each element in `properties`:
219219
- `name`: A string representing the property name.
220220
- `disabled`: A boolean value stating if the object property is disabled.
221221
- `readonly`: A boolean value stating if the property is read-only.
222+
- `hidden`: A boolean value stating if the property should be hidden.
222223

223224
> Note: Array and object field templates are always rendered inside of the FieldTemplate. To fully customize an object field template, you may need to specify both `ui:FieldTemplate` and `ui:ObjectFieldTemplate`.

docs/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $(".language-jsx").each(function() {
1212
var prefill = {
1313
"title":"RJSF example",
1414
"tags":[],
15-
"scripts":["https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.production.min.js","https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.production.min.js","https://unpkg.com/@rjsf/core/dist/react-jsonschema-form.js"],
15+
"scripts":["https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.production.min.js","https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.production.min.js","https://unpkg.com/@rjsf/core@2.5.1/dist/react-jsonschema-form.js"],
1616
"stylesheets":["//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"]
1717
};
1818
var div = $("<div><div class=\"codepen\" data-height=\"400\" data-theme-id=\"light\" data-default-tab=\"js,result\" data-prefill='" + JSON.stringify(prefill) + " '>\"<pre data-lang=\"html\">\n&lt;div id=\"app\">&lt;/div></pre><pre data-lang=\"babel\">" + text + "</pre></div></div>").css("margin", "30px 0px");

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "2.5.1"
5+
"version": "3.0.0"
66
}

mkdocs.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ nav:
2525
- Other Internals: advanced-customization/internals.md
2626
- Contributing: contributing.md
2727
- API Reference:
28-
- uiSchema:
29-
- General Reference: api-reference/uiSchema.md
30-
- Theme-Specific Reference:
31-
- semantic-ui: api-reference/themes/semantic-ui/uiSchema.md
28+
- General uiSchema Reference: api-reference/uiSchema.md
29+
- semantic-ui uiSchema Reference: api-reference/themes/semantic-ui/uiSchema.md
3230
- "&lt;Form /&gt; props": api-reference/form-props.md
3331
- 3.x Migration: 3.x upgrade guide.md
32+
- 2.x Migration: 2.x upgrade guide.md
3433

3534
markdown_extensions:
3635
- toc:

packages/antd/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/antd/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rjsf/antd",
3-
"version": "2.5.1",
3+
"version": "3.0.0",
44
"description": "Ant Design theme, fields and widgets for react-jsonschema-form",
55
"main": "dist/cjs/index.js",
66
"module": "dist/es/index.js",
@@ -44,7 +44,7 @@
4444
"@babel/preset-env": "^7.10.3",
4545
"@babel/preset-react": "^7.0.0",
4646
"@babel/register": "^7.4.4",
47-
"@rjsf/core": "^2.5.1",
47+
"@rjsf/core": "^3.0.0",
4848
"antd": "^4.0.0",
4949
"atob": "^2.0.3",
5050
"babel-eslint": "^10.0.1",
@@ -95,6 +95,5 @@
9595
"homepage": "https://github.com/rjsf-team/react-jsonschema-form",
9696
"publishConfig": {
9797
"access": "public"
98-
},
99-
"dependencies": {}
98+
}
10099
}

packages/antd/src/templates/ObjectFieldTemplate/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ const ObjectFieldTemplate = ({
7575
return defaultColSpan;
7676
};
7777

78-
const filterHidden = (element) =>
79-
element.content.props.uiSchema['ui:widget'] !== 'hidden';
80-
8178
return (
8279
<fieldset id={idSchema.$id}>
8380
<Row gutter={rowGutter}>
@@ -99,7 +96,7 @@ const ObjectFieldTemplate = ({
9996
/>
10097
</Col>
10198
)}
102-
{properties.filter(filterHidden).map((element) => (
99+
{properties.filter((e) => !e.hidden).map((element) => (
103100
<Col key={element.name} span={calculateColSpan(element)}>
104101
{element.content}
105102
</Col>

packages/antd/test/Form.test.js

+19
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,23 @@ describe("single fields", () => {
7878
.toJSON();
7979
expect(tree).toMatchSnapshot();
8080
});
81+
test("hidden field", () => {
82+
const schema = {
83+
type: "object",
84+
properties: {
85+
"my-field": {
86+
type: "string",
87+
},
88+
},
89+
};
90+
const uiSchema = {
91+
"my-field": {
92+
"ui:widget": "hidden",
93+
},
94+
};
95+
const tree = renderer
96+
.create(<Form schema={schema} uiSchema={uiSchema} />)
97+
.toJSON();
98+
expect(tree).toMatchSnapshot();
99+
});
81100
});

packages/antd/test/__snapshots__/Form.test.js.snap

+34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`single fields hidden field 1`] = `
4+
<form
5+
className="rjsf"
6+
noValidate={false}
7+
onSubmit={[Function]}
8+
>
9+
<div
10+
className="form-group field field-object"
11+
>
12+
<fieldset
13+
id="root"
14+
>
15+
<div
16+
className="ant-row"
17+
style={
18+
Object {
19+
"marginLeft": -12,
20+
"marginRight": -12,
21+
}
22+
}
23+
/>
24+
</fieldset>
25+
</div>
26+
<div>
27+
<button
28+
className="btn btn-info"
29+
type="submit"
30+
>
31+
Submit
32+
</button>
33+
</div>
34+
</form>
35+
`;
36+
337
exports[`single fields null field 1`] = `
438
<form
539
className="rjsf"

0 commit comments

Comments
 (0)