-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable antd (ant-design) support (#1561)
* Enable antd (ant-design) support * Change name of package in local package.json for consistency * Add local readme file * Tidy the package dependencies * Change README.md references to rjsf npm organisation * Update package.json an dimports to reflect the new rjsf organization * Deprecate antd custom withTheme as core now has forwardRef * Ensure Theme is not default export for consistency * Add scripts for building dist and lib in package.json * Fix test to use non-default import * Add babel-plugin-import to ensure styles are imported on demand * Add rjsf-antd theme to the playground * Migrate rjsf-antd code to antd v4 support * Implement EmailWidget and URLWidget for rjsf-antd * Reimplement rjsf-antd tests based on latest * Enable rjsf-antd support in the playground * Finalise rjsf-antd packages files * Remove useless build:lib script * Enable support for additionalProperties schemas * Update the test snapshots * Fix minor styling issues with descriptions * Ensure popups are rendered next to fields (even when used with iframes) * Implement AltDate/AltDateTimeWidgets for antd theme * update package-lock * Fix SelectWidget placeholder never being shown * Fix issue with the alternative date pickers * Fix issue with additionalProperties blanking out * Change license for consistency * Add semicolon * build cjs, es, and umd * antd - switch to new build process, fix global styles Co-authored-by: Ashwin Ramaswami <[email protected]>
- Loading branch information
Showing
53 changed files
with
14,384 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"react/jsx-uses-react": 2, | ||
"react/jsx-uses-vars": 2, | ||
"react/react-in-jsx-scope": 2, | ||
"react/jsx-tag-spacing": [1, { | ||
"beforeSelfClosing": "always" | ||
}], | ||
"curly": [2], | ||
"linebreak-style": [2, "unix"], | ||
"semi": [2, "always"], | ||
"comma-dangle": [0], | ||
"no-unused-vars": [2, { | ||
"vars": "all", | ||
"args": "none", | ||
"ignoreRestSiblings": true | ||
}], | ||
"no-console": [0], | ||
"object-curly-spacing": [2, "always"], | ||
"keyword-spacing": ["error"] | ||
}, | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"plugins": [ | ||
"jsx-a11y", | ||
"react" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
[![npm][npm-shield]][npm-url] | ||
[![npm downloads][npm-dl-shield]][npm-dl-url] | ||
|
||
<br /> | ||
<p align="center"> | ||
<h3 align="center">@rjsf/antd</h3> | ||
|
||
<p align="center"> | ||
Ant Design theme, fields and widgets for <a href="https://github.com/rjsf-team/react-jsonschema-form"><code>react-jsonschema-form</code></a>. | ||
<br /> | ||
<a href="https://react-jsonschema-form.readthedocs.io/"><strong>Explore the docs »</strong></a> | ||
<br /> | ||
<br /> | ||
<a href="https://rjsf-team.github.io/react-jsonschema-form/">View Playground (TBD)</a> | ||
· | ||
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Report Bug</a> | ||
· | ||
<a href="https://github.com/rjsf-team/react-jsonschema-form/issues">Request Feature</a> | ||
</p> | ||
</p> | ||
|
||
## Table of Contents | ||
|
||
- [Getting Started](#getting-started) | ||
- [Prerequisites](#prerequisites) | ||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Roadmap](#roadmap) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- `antd >= 4.0.0` | ||
- `react-jsonschema-form >= 2.0.0` | ||
|
||
```sh | ||
npm install antd @rjsf/core | ||
``` | ||
|
||
### Installation | ||
|
||
```sh | ||
npm install @rjsf/antd | ||
``` | ||
|
||
## Usage | ||
|
||
```javascript | ||
import Form from '@rjsf/antd'; | ||
``` | ||
|
||
or | ||
|
||
```javascript | ||
import { withTheme } from '@rjsf/core'; | ||
import { Theme } from '@rjsf/antd'; | ||
|
||
// Make modifications to the Theme with your own fields and widgets | ||
|
||
const Form = withTheme(Theme); | ||
``` | ||
|
||
## Roadmap | ||
|
||
See the general [open issues](https://github.com/rjsf-team/react-jsonschema-form/issues). | ||
|
||
## Contributing | ||
|
||
Read the general [contributors' guide](https://react-jsonschema-form.readthedocs.io/en/latest/#contributing) to get started. | ||
|
||
## License | ||
|
||
Apache 2 | ||
|
||
<!-- MARKDOWN LINKS & IMAGES --> | ||
|
||
[npm-shield]: https://img.shields.io/npm/v/react-jsonschema-form/latest.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.com/package/react-jsonschema-form | ||
[npm-dl-shield]: https://img.shields.io/npm/dm/react-jsonschema-form.svg?style=flat-square | ||
[npm-dl-url]: https://www.npmjs.com/package/react-jsonschema-form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Object.defineProperty(window, 'matchMedia', { | ||
writable: true, | ||
value: jest.fn().mockImplementation(query => ({ | ||
matches: false, | ||
media: query, | ||
onchange: null, | ||
addListener: jest.fn(), | ||
removeListener: jest.fn(), | ||
addEventListener: jest.fn(), | ||
removeEventListener: jest.fn(), | ||
dispatchEvent: jest.fn(), | ||
})), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const BABEL_ENV = process.env.BABEL_ENV; | ||
|
||
const defaultPlugins = []; | ||
|
||
module.exports = { | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
modules: ["cjs", "test"].includes(BABEL_ENV) ? "commonjs" : false, | ||
targets: | ||
BABEL_ENV === "test" ? { node: "current" } : { browsers: "defaults" }, | ||
}, | ||
], | ||
"@babel/preset-react" | ||
], | ||
"plugins": [ | ||
[ | ||
"import", | ||
{ | ||
"libraryName": "antd", | ||
"style": true | ||
} | ||
], | ||
"@babel/plugin-proposal-object-rest-spread", | ||
"@babel/plugin-proposal-class-properties", | ||
[ | ||
"@babel/plugin-transform-runtime", | ||
{ | ||
"corejs": 2 | ||
} | ||
] | ||
], | ||
"env": { | ||
cjs: { | ||
plugins: defaultPlugins, | ||
ignore: ['test/**/*.js'] | ||
}, | ||
umd: { | ||
plugins: defaultPlugins, | ||
ignore: ['test/**/*.js'] | ||
}, | ||
es: { | ||
plugins: [ | ||
...defaultPlugins, | ||
['@babel/plugin-transform-runtime', { useESModules: true, corejs: 2 }] | ||
], | ||
ignore: ['test/**/*.js'] | ||
}, | ||
test: { | ||
plugins: defaultPlugins, | ||
ignore: [] | ||
} | ||
} | ||
}; |
Oops, something went wrong.