Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…a-form into feature/bootstrap-4-additional-properties
  • Loading branch information
nickgros committed Jun 18, 2021
2 parents 28d9eb1 + e280c25 commit 62ffd68
Show file tree
Hide file tree
Showing 110 changed files with 43,286 additions and 34,963 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
interval: "monthly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
interval: "monthly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "monthly"
85 changes: 56 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,83 @@ on:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [8.x, 9.x, 10.x, 11.x, 12.x, 13.x]
node-version: [12.x, 14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v2.1.5
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build
- run: npm test
- run: npm ci
- run: npm run lint
- run: npm run cs-check

- name: Build with Netlify badge
if: github.ref != 'refs/heads/master'
run: npm run build
env:
CI: true

deploy:
SHOW_NETLIFY_BADGE: true
- name: Build
if: github.ref == 'refs/heads/master'
run: npm run build

- if: matrix.node-version == '14.x'
uses: actions/upload-artifact@v2
with:
name: dist
path: packages/playground/build
- run: npm test

deploy_preview:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
name: "Deploy preview (https://deploy-preview-${{ github.event.pull_request.number }}--rjsf.netlify.app/)"
needs: [build]
steps:
- name: Download built files
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: "Deploy to Netlify (https://deploy-preview-${{ github.event.pull_request.number }}--rjsf.netlify.app/)"
uses: netlify/actions/cli@master
with:
args: deploy --dir=dist --alias="deploy-preview-${PR_NUMBER}"
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}

deploy_playground:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
name: Deploy playground to GitHub Pages
needs: [build]
steps:
- uses: actions/checkout@v2
- name: Use Node.js 13.x
uses: actions/setup-node@v2.1.2
with:
node-version: 13.x
- run: npm install
- run: npm run build
- name: Deploy playground to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2.2.0
with:
keep_history: true
target-branch: gh-pages
build_dir: packages/playground/build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download built files
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Deploy playground
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
keep_history: true
target-branch: gh-pages
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2.1.4
uses: actions/setup-python@v2.2.2
with:
python-version: 3.6
- run: pip install -r requirements.docs.txt
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release
on:
release:
types: [published]

jobs:
release_to_npm:
name: Release to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2.1.5
with:
node-version: 14.x
- run: npm install
- run: npm run build
- run: npm test
- run: npm run lint
- run: npm run cs-check
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: npx lerna publish from-package --yes --no-verify-access
- if: always()
run: rm .npmrc
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ yarn.lock
# Code coverage
coverage
.nyc_output

venv
3 changes: 2 additions & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Please describe them here]

If this is related to existing tickets, include links to them as well.
If this is related to existing tickets, include links to them as well. Use the syntax `fixes #[issue number]` (ex: `fixes #123`).

### Checklist

Expand All @@ -13,3 +13,4 @@ If this is related to existing tickets, include links to them as well.
- [ ] I've updated [docs](https://react-jsonschema-form.readthedocs.io/) if needed
* [ ] **I'm adding a new feature**
- [ ] I've updated the playground with an example use of the feature

22 changes: 22 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const BABEL_ENV = process.env.BABEL_ENV;
const IS_TEST = BABEL_ENV === "test"
const ignore = IS_TEST ? [] : ['test/**/*.js']
const targets = IS_TEST ? { node: "current" } : { browsers: "defaults" }

module.exports = {
presets: [
[
"@babel/preset-env",
{
modules: ["cjs", "test"].includes(BABEL_ENV) ? "commonjs" : false,
targets
},
],
"@babel/preset-react"
],
plugins: [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-optional-chaining"
],
ignore,
};
25 changes: 25 additions & 0 deletions docs/3.x upgrade guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 3.x Upgrade Guide

## BREAKING

### Bring your own polyfills

core-js@2 has been removed from @rjsf/core. See more about [the rationale here](https://github.com/rjsf-team/react-jsonschema-form/pull/2211#issue-563700810).

If you're using a framework like [Create React App](https://create-react-app.dev/docs/supported-browsers-features#supported-browsers), [Gatsby](https://www.gatsbyjs.com/docs/how-to/custom-configuration/browser-support/), [Next.js](https://nextjs.org/docs/basic-features/supported-browsers-features), or transpiling code through something like `@babel/preset-env`, polyfills are already included there and you won't have to do anything.

If you were directly depending on @rjsf/core's @babel/runtime pulling in core-js@2, just `npm install core-js` and using a side effectful import at the top of your entry point (`import 'core-js'`) might be enough.

For a slightly more elaborate setup, [@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env#how-does-it-work) is probably a good second choice.

From `@babel/preset-env`'s docs

> 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.
### Dereferenced schemas for `anyOf`/`allOf` options

`options` prop for `MultiSchemaField` has been changed slightly.

Before an option could include a `$ref`.

Now any option with a reference will be resolved/dereferenced when given as props for `MultiSchemaField`.
3 changes: 3 additions & 0 deletions docs/advanced-customization/custom-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ The following props are passed to a custom field template component:
- `fields`: An array containing all Form's fields including your [custom fields](#custom-field-components) and the built-in fields.
- `schema`: The schema object for this field.
- `uiSchema`: The uiSchema object for this field.
- `onChange`: The value change event handler; Can be called with a new value to change the value for this field.
- `formContext`: The `formContext` object that you passed to Form.
- `formData`: The formData for this field.
- `registry`: The `registry` object.

> Note: you can only define a single global field template for a form, but you can set individual field templates per property using `"ui:FieldTemplate"`.
Expand Down Expand Up @@ -217,5 +219,6 @@ The following props are part of each element in `properties`:
- `name`: A string representing the property name.
- `disabled`: A boolean value stating if the object property is disabled.
- `readonly`: A boolean value stating if the property is read-only.
- `hidden`: A boolean value stating if the property should be hidden.

> 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`.
6 changes: 3 additions & 3 deletions docs/advanced-customization/custom-widgets-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ The default fields you can override are:
- `ArrayField`
- `BooleanField`
- `DescriptionField`
- `MultiSchemaField`
- `OneOfField`
- `AnyOfField`
- `NullField`
- `NumberField`
- `ObjectField`
Expand Down Expand Up @@ -133,11 +134,10 @@ The following props are passed to custom widget components:
- `onBlur`: The input blur event handler; call it with the the widget id and value;
- `onFocus`: The input focus event handler; call it with the the widget id and value;
- `options`: A map of options passed as a prop to the component (see [Custom widget options](#custom-widget-options)).
- `options.enumOptions`: For enum fields, this property contains the list of options for the enum as an array of { label, value } objects. If the enum is defined using the oneOf/anyOf syntax, the entire schema object for each option is appended onto the { schema, label, value } object.
- `formContext`: The `formContext` object that you passed to Form.
- `rawErrors`: An array of strings listing all generated error messages from encountered errors for this widget.

> Note: Prior to v0.35.0, the `options` prop contained the list of options (`label` and `value`) for `enum` fields. Since v0.35.0, it now exposes this list as the `enumOptions` property within the `options` object.
### Custom component registration

Alternatively, you can register them all at once by passing the `widgets` prop to the `Form` component, and reference their identifier from the `uiSchema`:
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/form-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ render((
## schema

Form schema. We support JSON schema draft-07 by default. See [Schema Reference]((https://json-schema.org/draft-07/json-schema-release-notes.html) for more information.
Form schema. We support JSON schema draft-07 by default. See [Schema Reference](https://json-schema.org/draft-07/json-schema-release-notes.html) for more information.

## showErrorList

Expand Down
14 changes: 10 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ The full report can be seen by opening `./coverage/lcov-report/index.html`.

## Releasing

To release, run:
To release, go to the master branch and then run:

```bash
lerna version
lerna run build
lerna publish from-git
```

Make sure you use [semver](https://semver.org/) for version numbering. Once a new version has been released, create a release in the Github "Releases" tab and add the version history.
Make sure you use [semver](https://semver.org/) for version numbering when selecting the version.
The command above will create a new version tag and push it to GitHub. Then, create a release in
the Github "Releases" tab and add a description of the changes in the new release.

This will trigger a GitHub Actions pipeline that will build and publish all packages to npm.

The package is published through an automation token belonging to the
[rjsf-bot](https://www.npmjs.com/~rjsf-bot) user on npm. This token
is stored as the `NPM_TOKEN` secret on GitHub Actions.

### Releasing docs

Expand Down
10 changes: 5 additions & 5 deletions docs/usage/validation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Validation

When the form is submitted, the form data is validated to conform to the given JSON schema; this library uses the [ajv](https://github.com/epoberezkin/ajv) validator by default.
When the form is submitted, the form data is validated to conform to the given JSON schema; this library uses the [ajv](https://github.com/ajv-validator/ajv) validator by default.

## Live validation

Expand Down Expand Up @@ -110,10 +110,10 @@ Each element in the `errors` list passed to `transformErrors` has the following

- `name`: name of the error, for example, "required" or "minLength"
- `message`: message, for example, "is a required property" or "should NOT be shorter than 3 characters"
- `params`: an object with the error params returned by ajv ([see doc](https://github.com/epoberezkin/ajv/tree/6a671057ea6aae690b5967ee26a0ddf8452c6297#error-parameters) for more info).
- `params`: an object with the error params returned by ajv ([see doc](https://github.com/ajv-validator/ajv/tree/6a671057ea6aae690b5967ee26a0ddf8452c6297#error-parameters) for more info).
- `property`: a string in Javascript property accessor notation to the data path of the field with the error. For example, `.name` or `['first-name']`.
- `stack`: full error name, for example ".name is a required property".
- `schemaPath`: JSON pointer to the schema of the keyword that failed validation. For example, `#/fields/firstName/required`. (Note: this may sometimes be wrong due to a [bug in ajv](https://github.com/epoberezkin/ajv/issues/512)).
- `schemaPath`: JSON pointer to the schema of the keyword that failed validation. For example, `#/fields/firstName/required`. (Note: this may sometimes be wrong due to a [bug in ajv](https://github.com/ajv-validator/ajv/issues/512)).

## Error List Display

Expand Down Expand Up @@ -224,7 +224,7 @@ render((
), document.getElementById("app"));
```

Format values can be anything AJV’s [`addFormat` method](https://github.com/epoberezkin/ajv/tree/6a671057ea6aae690b5967ee26a0ddf8452c6297#addformatstring-name-stringregexpfunctionobject-format---ajv) accepts.
Format values can be anything AJV’s [`addFormat` method](https://github.com/ajv-validator/ajv/tree/6a671057ea6aae690b5967ee26a0ddf8452c6297#addformatstring-name-stringregexpfunctionobject-format---ajv) accepts.

## Async validation

Expand Down Expand Up @@ -267,4 +267,4 @@ render((
), document.getElementById("app"));
```

An important note is that these errors are "display only" and will not block the user from submitting the form again.
An important note is that these errors are "display only" and will not block the user from submitting the form again.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "2.4.2"
"version": "2.5.1"
}
7 changes: 3 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ nav:
- Other Internals: advanced-customization/internals.md
- Contributing: contributing.md
- API Reference:
- uiSchema:
- General Reference: api-reference/uiSchema.md
- Theme-Specific Reference:
- semantic-ui: api-reference/themes/semantic-ui/uiSchema.md
- General uiSchema Reference: api-reference/uiSchema.md
- semantic-ui uiSchema Reference: api-reference/themes/semantic-ui/uiSchema.md
- "<Form /> props": api-reference/form-props.md
- 3.x Migration: 3.x upgrade guide.md

markdown_extensions:
- toc:
Expand Down
Empty file modified netlify-ignore.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

[build.environment]
SHOW_NETLIFY_BADGE = "true"
NODE_VERSION = "14"
Loading

0 comments on commit 62ffd68

Please sign in to comment.