-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add idPrefix option for oneOf #883
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,17 +8,18 @@ | |
"build:dist": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.dist.js --optimize-minimize", | ||
"build:playground": "rimraf build && cross-env NODE_ENV=production webpack --config webpack.config.prod.js --optimize-minimize && cp playground/index.prod.html build/index.html", | ||
"cs-check": "prettier -l $npm_package_prettierOptions '{playground,src,test}/**/*.js'", | ||
"cs-format": "prettier $npm_package_prettierOptions '{playground,src,test}/**/*.js' --write", | ||
"cs-format": "prettier --jsx-bracket-same-line --trailing-comma es5 --use-tabs false --semi --tab-width 2 '{playground,src,test}/**/*.js' --write", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? It seems like this still corresponds to |
||
"dist": "npm run build:lib && npm run build:dist", | ||
"lint": "eslint src test playground", | ||
"precommit": "lint-staged", | ||
"publish-to-gh-pages": "npm run build:playground && gh-pages --dist build/", | ||
"publish-to-npm": "npm run build:readme && npm run dist && npm publish", | ||
"preversion": "npm run build:playground && npm run dist && npm run build:readme && npm run cs-check && npm run lint", | ||
"start": "node devServer.js", | ||
"tdd": "cross-env NODE_ENV=test mocha --compilers js:babel-register --watch --require ./test/setup-jsdom.js test/**/*_test.js", | ||
"test": "cross-env NODE_ENV=test mocha --compilers js:babel-register --require ./test/setup-jsdom.js test/**/*_test.js" | ||
}, | ||
"prettierOptions": "--jsx-bracket-same-line --trailing-comma es5 --semi", | ||
"prettierOptions": "--jsx-bracket-same-line --trailing-comma es5 --semi --tab-width 2", | ||
"lint-staged": { | ||
"{playground,src,test}/**/*.js": [ | ||
"npm run lint", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,9 @@ import PropTypes from "prop-types"; | |
import { | ||
isMultiSelect, | ||
retrieveSchema, | ||
toIdSchema, | ||
getDefaultRegistry, | ||
mergeObjects, | ||
getUiOptions, | ||
isFilesArray, | ||
deepEquals, | ||
|
@@ -153,7 +155,7 @@ function SchemaFieldRender(props) { | |
uiSchema, | ||
formData, | ||
errorSchema, | ||
idSchema, | ||
idPrefix, | ||
name, | ||
required, | ||
registry = getDefaultRegistry(), | ||
|
@@ -164,7 +166,12 @@ function SchemaFieldRender(props) { | |
formContext, | ||
FieldTemplate = DefaultTemplate, | ||
} = registry; | ||
let idSchema = props.idSchema; | ||
const schema = retrieveSchema(props.schema, definitions, formData); | ||
idSchema = mergeObjects( | ||
toIdSchema(schema, null, definitions, formData, idPrefix), | ||
idSchema | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to generate another I'm a little concerned that we're restarting with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question here, removing this piece of code doesn't seem to break any test. |
||
const FieldComponent = getFieldComponent(schema, uiSchema, idSchema, fields); | ||
const { DescriptionField } = fields; | ||
const disabled = Boolean(props.disabled || uiSchema["ui:disabled"]); | ||
|
@@ -199,6 +206,7 @@ function SchemaFieldRender(props) { | |
const field = ( | ||
<FieldComponent | ||
{...props} | ||
idSchema={idSchema} | ||
schema={schema} | ||
uiSchema={{ ...uiSchema, classNames: undefined }} | ||
disabled={disabled} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ import PropTypes from "prop-types"; | |
function BaseInput(props) { | ||
// Note: since React 15.2.0 we can't forward unknown element attributes, so we | ||
// exclude the "options" and "schema" ones here. | ||
if (!props.id) { | ||
console.log("No id for", props); | ||
throw new Error(`no id for props ${JSON.stringify(props)}`); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better for this code not to come between the comment and the code the comment describes. |
||
const { | ||
value, | ||
readonly, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the apostrophe here was correct ("the text input belonging to widgets").