@rjsf/core
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -277,12 +277,4 @@ "use strict"; | ||
DescriptionField = fields.DescriptionField; | ||
var schema = (0, _utils.retrieveSchema)(this.props.schema, rootSchema, formData); // If this schema has a title defined, but the user has set a new key/label, retain their input. | ||
var title; | ||
if (this.state.wasPropertyKeyModified) { | ||
title = name; | ||
} else { | ||
title = schema.title === undefined ? name : schema.title; | ||
} | ||
var schema = (0, _utils.retrieveSchema)(this.props.schema, rootSchema, formData); | ||
var title = schema.title === undefined ? name : schema.title; | ||
var description = uiSchema["ui:description"] || schema.description; | ||
@@ -289,0 +281,0 @@ var orderedProperties; |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _utils = require("../../utils"); | ||
var _IconButton = _interopRequireDefault(require("../IconButton")); | ||
@@ -19,2 +17,4 @@ | ||
var _utils = require("../../utils"); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } } | ||
@@ -299,22 +299,4 @@ | ||
var uiOptions = (0, _utils.getUiOptions)(uiSchema); | ||
var _uiOptions$label = uiOptions.label, | ||
displayLabel = _uiOptions$label === void 0 ? true : _uiOptions$label; | ||
var displayLabel = (0, _utils.getDisplayLabel)(schema, uiSchema, rootSchema); | ||
if (schema.type === "array") { | ||
displayLabel = (0, _utils.isMultiSelect)(schema, rootSchema) || (0, _utils.isFilesArray)(schema, uiSchema, rootSchema); | ||
} | ||
if (schema.type === "object") { | ||
displayLabel = false; | ||
} | ||
if (schema.type === "boolean" && !uiSchema["ui:widget"]) { | ||
displayLabel = false; | ||
} | ||
if (uiSchema["ui:field"]) { | ||
displayLabel = false; | ||
} | ||
var __errors = errorSchema.__errors, | ||
@@ -321,0 +303,0 @@ fieldErrorSchema = _objectWithoutProperties(errorSchema, ["__errors"]); // See #439: uiSchema: Don't pass consumed class names to child components |
@@ -66,2 +66,3 @@ "use strict"; | ||
schema: schema, | ||
uiSchema: uiSchema, | ||
id: idSchema && idSchema.$id, | ||
@@ -68,0 +69,0 @@ label: title === undefined ? name : title, |
@@ -44,6 +44,7 @@ "use strict"; | ||
schema = props.schema, | ||
uiSchema = props.uiSchema, | ||
formContext = props.formContext, | ||
registry = props.registry, | ||
rawErrors = props.rawErrors, | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "options", "schema", "formContext", "registry", "rawErrors"]); // If options.inputType is set use that as the input type | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors"]); // If options.inputType is set use that as the input type | ||
@@ -50,0 +51,0 @@ |
@@ -35,3 +35,3 @@ "use strict"; | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
value: value ? value : "", | ||
placeholder: placeholder, | ||
@@ -38,0 +38,0 @@ required: required, |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.getUiOptions = getUiOptions; | ||
exports.getDisplayLabel = getDisplayLabel; | ||
exports.isObject = isObject; | ||
@@ -414,2 +415,26 @@ exports.mergeObjects = mergeObjects; | ||
function getDisplayLabel(schema, uiSchema, rootSchema) { | ||
var uiOptions = getUiOptions(uiSchema); | ||
var _uiOptions$label = uiOptions.label, | ||
displayLabel = _uiOptions$label === void 0 ? true : _uiOptions$label; | ||
if (schema.type === "array") { | ||
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema); | ||
} | ||
if (schema.type === "object") { | ||
displayLabel = false; | ||
} | ||
if (schema.type === "boolean" && !uiSchema["ui:widget"]) { | ||
displayLabel = false; | ||
} | ||
if (uiSchema["ui:field"]) { | ||
displayLabel = false; | ||
} | ||
return displayLabel; | ||
} | ||
function isObject(thing) { | ||
@@ -922,3 +947,3 @@ if (typeof File !== "undefined" && thing instanceof File) { | ||
// Assume all functions are equivalent | ||
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255 | ||
// see https://github.com/rjsf-team/react-jsonschema-form/issues/255 | ||
return true; | ||
@@ -925,0 +950,0 @@ } else if (_typeof(a) !== "object" || _typeof(b) !== "object") { |
@@ -244,12 +244,4 @@ import _JSON$stringify from "@babel/runtime-corejs2/core-js/json/stringify"; | ||
DescriptionField = fields.DescriptionField; | ||
var schema = retrieveSchema(this.props.schema, rootSchema, formData); // If this schema has a title defined, but the user has set a new key/label, retain their input. | ||
var title; | ||
if (this.state.wasPropertyKeyModified) { | ||
title = name; | ||
} else { | ||
title = schema.title === undefined ? name : schema.title; | ||
} | ||
var schema = retrieveSchema(this.props.schema, rootSchema, formData); | ||
var title = schema.title === undefined ? name : schema.title; | ||
var description = uiSchema["ui:description"] || schema.description; | ||
@@ -256,0 +248,0 @@ var orderedProperties; |
@@ -10,3 +10,2 @@ import _classCallCheck from "@babel/runtime-corejs2/helpers/esm/classCallCheck"; | ||
import _Object$keys from "@babel/runtime-corejs2/core-js/object/keys"; | ||
import { ADDITIONAL_PROPERTY_FLAG } from "../../utils"; | ||
import IconButton from "../IconButton"; | ||
@@ -16,3 +15,3 @@ import React from "react"; | ||
import * as types from "../../types"; | ||
import { isMultiSelect, isSelect, retrieveSchema, toIdSchema, getDefaultRegistry, mergeObjects, getUiOptions, isFilesArray, deepEquals, getSchemaType } from "../../utils"; | ||
import { ADDITIONAL_PROPERTY_FLAG, isSelect, retrieveSchema, toIdSchema, getDefaultRegistry, mergeObjects, deepEquals, getSchemaType, getDisplayLabel } from "../../utils"; | ||
var REQUIRED_FIELD_SYMBOL = "*"; | ||
@@ -265,22 +264,4 @@ var COMPONENT_TYPES = { | ||
var uiOptions = getUiOptions(uiSchema); | ||
var _uiOptions$label = uiOptions.label, | ||
displayLabel = _uiOptions$label === void 0 ? true : _uiOptions$label; | ||
var displayLabel = getDisplayLabel(schema, uiSchema, rootSchema); | ||
if (schema.type === "array") { | ||
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema); | ||
} | ||
if (schema.type === "object") { | ||
displayLabel = false; | ||
} | ||
if (schema.type === "boolean" && !uiSchema["ui:widget"]) { | ||
displayLabel = false; | ||
} | ||
if (uiSchema["ui:field"]) { | ||
displayLabel = false; | ||
} | ||
var __errors = errorSchema.__errors, | ||
@@ -287,0 +268,0 @@ fieldErrorSchema = _objectWithoutProperties(errorSchema, ["__errors"]); // See #439: uiSchema: Don't pass consumed class names to child components |
@@ -47,2 +47,3 @@ import _objectSpread from "@babel/runtime-corejs2/helpers/esm/objectSpread"; | ||
schema: schema, | ||
uiSchema: uiSchema, | ||
id: idSchema && idSchema.$id, | ||
@@ -49,0 +50,0 @@ label: title === undefined ? name : title, |
@@ -25,6 +25,7 @@ import _Set from "@babel/runtime-corejs2/core-js/set"; | ||
schema = props.schema, | ||
uiSchema = props.uiSchema, | ||
formContext = props.formContext, | ||
registry = props.registry, | ||
rawErrors = props.rawErrors, | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "options", "schema", "formContext", "registry", "rawErrors"]); // If options.inputType is set use that as the input type | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors"]); // If options.inputType is set use that as the input type | ||
@@ -31,0 +32,0 @@ |
@@ -25,3 +25,3 @@ import React from "react"; | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
value: value ? value : "", | ||
placeholder: placeholder, | ||
@@ -28,0 +28,0 @@ required: required, |
@@ -344,2 +344,25 @@ import _Symbol$toPrimitive from "@babel/runtime-corejs2/core-js/symbol/to-primitive"; | ||
} | ||
export function getDisplayLabel(schema, uiSchema, rootSchema) { | ||
var uiOptions = getUiOptions(uiSchema); | ||
var _uiOptions$label = uiOptions.label, | ||
displayLabel = _uiOptions$label === void 0 ? true : _uiOptions$label; | ||
if (schema.type === "array") { | ||
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema); | ||
} | ||
if (schema.type === "object") { | ||
displayLabel = false; | ||
} | ||
if (schema.type === "boolean" && !uiSchema["ui:widget"]) { | ||
displayLabel = false; | ||
} | ||
if (uiSchema["ui:field"]) { | ||
displayLabel = false; | ||
} | ||
return displayLabel; | ||
} | ||
export function isObject(thing) { | ||
@@ -837,3 +860,3 @@ if (typeof File !== "undefined" && thing instanceof File) { | ||
// Assume all functions are equivalent | ||
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255 | ||
// see https://github.com/rjsf-team/react-jsonschema-form/issues/255 | ||
return true; | ||
@@ -840,0 +863,0 @@ } else if (_typeof(a) !== "object" || _typeof(b) !== "object") { |
@@ -102,2 +102,3 @@ // Originally from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/@rjsf/core/index.d.ts | ||
schema: JSONSchema7; | ||
uiSchema: UiSchema; | ||
value: any; | ||
@@ -114,3 +115,2 @@ required: boolean; | ||
label: string; | ||
type: string; | ||
multiple: boolean; | ||
@@ -187,4 +187,5 @@ rawErrors: string[]; | ||
index: number; | ||
onDropIndexClick: (index: number) => (event: any) => void; | ||
onReorderClick: (index: number, newIndex: number) => (event: any) => void; | ||
onAddIndexClick: (index: number) => (event?: any) => void; | ||
onDropIndexClick: (index: number) => (event?: any) => void; | ||
onReorderClick: (index: number, newIndex: number) => (event?: any) => void; | ||
readonly: boolean; | ||
@@ -317,2 +318,4 @@ key: string; | ||
export function getDisplayLabel(schema: JSONSchema7, uiSchema: UiSchema, rootSchema?: JSONSchema7): boolean; | ||
export function isObject(thing: any): boolean; | ||
@@ -319,0 +322,0 @@ |
@@ -244,12 +244,4 @@ import _JSON$stringify from "@babel/runtime-corejs2/core-js/json/stringify"; | ||
DescriptionField = fields.DescriptionField; | ||
var schema = retrieveSchema(this.props.schema, rootSchema, formData); // If this schema has a title defined, but the user has set a new key/label, retain their input. | ||
var title; | ||
if (this.state.wasPropertyKeyModified) { | ||
title = name; | ||
} else { | ||
title = schema.title === undefined ? name : schema.title; | ||
} | ||
var schema = retrieveSchema(this.props.schema, rootSchema, formData); | ||
var title = schema.title === undefined ? name : schema.title; | ||
var description = uiSchema["ui:description"] || schema.description; | ||
@@ -256,0 +248,0 @@ var orderedProperties; |
@@ -10,3 +10,2 @@ import _classCallCheck from "@babel/runtime-corejs2/helpers/esm/classCallCheck"; | ||
import _Object$keys from "@babel/runtime-corejs2/core-js/object/keys"; | ||
import { ADDITIONAL_PROPERTY_FLAG } from "../../utils"; | ||
import IconButton from "../IconButton"; | ||
@@ -16,3 +15,3 @@ import React from "react"; | ||
import * as types from "../../types"; | ||
import { isMultiSelect, isSelect, retrieveSchema, toIdSchema, getDefaultRegistry, mergeObjects, getUiOptions, isFilesArray, deepEquals, getSchemaType } from "../../utils"; | ||
import { ADDITIONAL_PROPERTY_FLAG, isSelect, retrieveSchema, toIdSchema, getDefaultRegistry, mergeObjects, deepEquals, getSchemaType, getDisplayLabel } from "../../utils"; | ||
var REQUIRED_FIELD_SYMBOL = "*"; | ||
@@ -265,22 +264,4 @@ var COMPONENT_TYPES = { | ||
var uiOptions = getUiOptions(uiSchema); | ||
var _uiOptions$label = uiOptions.label, | ||
displayLabel = _uiOptions$label === void 0 ? true : _uiOptions$label; | ||
var displayLabel = getDisplayLabel(schema, uiSchema, rootSchema); | ||
if (schema.type === "array") { | ||
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema); | ||
} | ||
if (schema.type === "object") { | ||
displayLabel = false; | ||
} | ||
if (schema.type === "boolean" && !uiSchema["ui:widget"]) { | ||
displayLabel = false; | ||
} | ||
if (uiSchema["ui:field"]) { | ||
displayLabel = false; | ||
} | ||
var __errors = errorSchema.__errors, | ||
@@ -287,0 +268,0 @@ fieldErrorSchema = _objectWithoutProperties(errorSchema, ["__errors"]); // See #439: uiSchema: Don't pass consumed class names to child components |
@@ -47,2 +47,3 @@ import _objectSpread from "@babel/runtime-corejs2/helpers/esm/objectSpread"; | ||
schema: schema, | ||
uiSchema: uiSchema, | ||
id: idSchema && idSchema.$id, | ||
@@ -49,0 +50,0 @@ label: title === undefined ? name : title, |
@@ -25,6 +25,7 @@ import _Set from "@babel/runtime-corejs2/core-js/set"; | ||
schema = props.schema, | ||
uiSchema = props.uiSchema, | ||
formContext = props.formContext, | ||
registry = props.registry, | ||
rawErrors = props.rawErrors, | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "options", "schema", "formContext", "registry", "rawErrors"]); // If options.inputType is set use that as the input type | ||
inputProps = _objectWithoutProperties(props, ["value", "readonly", "disabled", "autofocus", "onBlur", "onFocus", "options", "schema", "uiSchema", "formContext", "registry", "rawErrors"]); // If options.inputType is set use that as the input type | ||
@@ -31,0 +32,0 @@ |
@@ -25,3 +25,3 @@ import React from "react"; | ||
className: "form-control", | ||
value: typeof value === "undefined" ? "" : value, | ||
value: value ? value : "", | ||
placeholder: placeholder, | ||
@@ -28,0 +28,0 @@ required: required, |
@@ -344,2 +344,25 @@ import _Symbol$toPrimitive from "@babel/runtime-corejs2/core-js/symbol/to-primitive"; | ||
} | ||
export function getDisplayLabel(schema, uiSchema, rootSchema) { | ||
var uiOptions = getUiOptions(uiSchema); | ||
var _uiOptions$label = uiOptions.label, | ||
displayLabel = _uiOptions$label === void 0 ? true : _uiOptions$label; | ||
if (schema.type === "array") { | ||
displayLabel = isMultiSelect(schema, rootSchema) || isFilesArray(schema, uiSchema, rootSchema); | ||
} | ||
if (schema.type === "object") { | ||
displayLabel = false; | ||
} | ||
if (schema.type === "boolean" && !uiSchema["ui:widget"]) { | ||
displayLabel = false; | ||
} | ||
if (uiSchema["ui:field"]) { | ||
displayLabel = false; | ||
} | ||
return displayLabel; | ||
} | ||
export function isObject(thing) { | ||
@@ -837,3 +860,3 @@ if (typeof File !== "undefined" && thing instanceof File) { | ||
// Assume all functions are equivalent | ||
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255 | ||
// see https://github.com/rjsf-team/react-jsonschema-form/issues/255 | ||
return true; | ||
@@ -840,0 +863,0 @@ } else if (_typeof(a) !== "object" || _typeof(b) !== "object") { |
{ | ||
"name": "@rjsf/core", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "A simple React component capable of building HTML forms out of a JSON schema.", | ||
@@ -76,3 +76,3 @@ "scripts": { | ||
"create-react-ref": "^0.1.0", | ||
"cross-env": "^2.0.1", | ||
"cross-env": "^7.0.2", | ||
"css-loader": "^0.23.1", | ||
@@ -109,3 +109,3 @@ "eslint": "^4.9.0", | ||
"rimraf": "^2.5.4", | ||
"sinon": "^7.5.0", | ||
"sinon": "^9.0.2", | ||
"style-loader": "^0.13.1", | ||
@@ -122,3 +122,3 @@ "webpack": "^4.42.1", | ||
"type": "git", | ||
"url": "git+https://github.com/mozilla-services/react-jsonschema-form.git" | ||
"url": "git+https://github.com/rjsf-team/react-jsonschema-form.git" | ||
}, | ||
@@ -132,7 +132,7 @@ "author": "Nicolas Perriault <nperriault@mozilla.com>", | ||
"license": "Apache-2.0", | ||
"homepage": "https://github.com/mozilla-services/react-jsonschema-form#readme", | ||
"homepage": "https://github.com/rjsf-team/react-jsonschema-form", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "3e0ee100385e662fecefad8c4be5dce8c3c2a75d" | ||
"gitHead": "f64ca087af05412e14bf115b7520148e40c1e30b" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3599866
133
17506
0
113