Skip to content

Commit

Permalink
- Ran cs-format to fix formatting issues and fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
heath-freenome committed Jul 20, 2022
1 parent cf3f28a commit 8f608c1
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 41 deletions.
2 changes: 1 addition & 1 deletion packages/playground/src/DemoFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function DemoFrame(props) {
});
const instanceRef = React.useRef();

const handleRef = React.useCallback(ref => {
const handleRef = React.useCallback((ref) => {
instanceRef.current = {
contentDocument: ref ? ref.node.contentDocument : null,
contentWindow: ref ? ref.node.contentWindow : null,
Expand Down
47 changes: 20 additions & 27 deletions packages/playground/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Form, { withTheme } from "@rjsf/core";
import { shouldRender } from "@rjsf/utils";
import DemoFrame from "./DemoFrame";

const log = type => console.log.bind(console, type);
const toJson = val => JSON.stringify(val, null, 2);
const log = (type) => console.log.bind(console, type);
const toJson = (val) => JSON.stringify(val, null, 2);
const liveSettingsSchema = {
type: "object",
properties: {
Expand All @@ -33,7 +33,7 @@ class GeoPosition extends Component {
}

onChange(name) {
return event => {
return (event) => {
this.setState({ [name]: parseFloat(event.target.value) });
setImmediate(() => this.props.onChange(this.state));
};
Expand Down Expand Up @@ -96,7 +96,7 @@ class Editor extends Component {
return false;
}

onCodeChange = code => {
onCodeChange = (code) => {
try {
const parsedCode = JSON.parse(code);
this.setState({ valid: true, code }, () =>
Expand Down Expand Up @@ -140,8 +140,8 @@ class Selector extends Component {
return shouldRender(this, nextProps, nextState);
}

onLabelClick = label => {
return event => {
onLabelClick = (label) => {
return (event) => {
event.preventDefault();
this.setState({ current: label });
setImmediate(() => this.props.onSelected(samples[label]));
Expand Down Expand Up @@ -232,17 +232,15 @@ function ValidatorSelector({ validator, validators, select }) {
schema={schema}
uiSchema={uiSchema}
formData={validator}
onChange={({ formData }) =>
formData && select(formData)
}
onChange={({ formData }) => formData && select(formData)}
>
<div />
</Form>
);
}

class CopyLink extends Component {
onCopyClick = event => {
onCopyClick = (event) => {
this.input.select();
document.execCommand("copy");
};
Expand All @@ -260,7 +258,7 @@ class CopyLink extends Component {
<div className="input-group">
<input
type="text"
ref={input => (this.input = input)}
ref={(input) => (this.input = input)}
className="form-control"
defaultValue={shareURL}
/>
Expand Down Expand Up @@ -330,7 +328,7 @@ class Playground extends Component {
return shouldRender(this, nextProps, nextState);
}

load = data => {
load = (data) => {
// Reset the ArrayFieldTemplate whenever you load new data
const { ArrayFieldTemplate, ObjectFieldTemplate, extraErrors } = data;
// uiSchema is missing on some examples. Provide a default to
Expand All @@ -354,13 +352,13 @@ class Playground extends Component {
);
};

onSchemaEdited = schema => this.setState({ schema, shareURL: null });
onSchemaEdited = (schema) => this.setState({ schema, shareURL: null });

onUISchemaEdited = uiSchema => this.setState({ uiSchema, shareURL: null });
onUISchemaEdited = (uiSchema) => this.setState({ uiSchema, shareURL: null });

onFormDataEdited = formData => this.setState({ formData, shareURL: null });
onFormDataEdited = (formData) => this.setState({ formData, shareURL: null });

onExtraErrorsEdited = extraErrors =>
onExtraErrorsEdited = (extraErrors) =>
this.setState({ extraErrors, shareURL: null });

onThemeSelected = (
Expand Down Expand Up @@ -393,14 +391,8 @@ class Playground extends Component {
this.setState({ formData, shareURL: null });

onShare = () => {
const {
formData,
schema,
uiSchema,
liveSettings,
errorSchema,
theme,
} = this.state;
const { formData, schema, uiSchema, liveSettings, errorSchema, theme } =
this.state;
const {
location: { origin, pathname },
} = document;
Expand Down Expand Up @@ -486,7 +478,7 @@ class Playground extends Component {
validators={validators}
validator={validator}
select={this.onValidatorSelected}
/>
/>
<CopyLink shareURL={this.state.shareURL} onShare={this.onShare} />
</div>
</div>
Expand Down Expand Up @@ -538,8 +530,9 @@ class Playground extends Component {
{theme === "antd" && (
<div
dangerouslySetInnerHTML={{
__html: document.getElementById("antd-styles-iframe")
.contentDocument.head.innerHTML,
__html:
document.getElementById("antd-styles-iframe")
.contentDocument.head.innerHTML,
}}
/>
)}
Expand Down
7 changes: 5 additions & 2 deletions packages/playground/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Playground from "./app";
import { render } from "react-dom";

const validators = {
"AJV6": validator,
AJV6: validator,
};

const themes = {
Expand Down Expand Up @@ -126,4 +126,7 @@ const themes = {
},
};

render(<Playground themes={themes} validators={validators} />, document.getElementById("app"));
render(
<Playground themes={themes} validators={validators} />,
document.getElementById("app")
);
2 changes: 1 addition & 1 deletion packages/playground/src/samples/customArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function ArrayFieldTemplate(props) {
return (
<div className={props.className}>
{props.items &&
props.items.map(element => (
props.items.map((element) => (
<div key={element.key} className={element.className}>
<div>{element.children}</div>
{element.hasMoveDown && (
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/samples/customObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function ObjectFieldTemplate({ TitleField, properties, title, description }) {
<div>
<TitleField title={title} />
<div className="row">
{properties.map(prop => (
{properties.map((prop) => (
<div
className="col-lg-2 col-md-4 col-sm-6 col-xs-12"
key={prop.content.key}
Expand Down
6 changes: 2 additions & 4 deletions packages/playground/src/samples/propertyDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ module.exports = {
properties: {
unidirectional: {
title: "Unidirectional",
src:
"https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies",
src: "https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies",
type: "object",
properties: {
name: {
Expand All @@ -27,8 +26,7 @@ module.exports = {
},
bidirectional: {
title: "Bidirectional",
src:
"https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies",
src: "https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies",
description:
"Dependencies are not bidirectional, you can, of course, define the bidirectional dependencies explicitly.",
type: "object",
Expand Down
3 changes: 1 addition & 2 deletions packages/playground/src/samples/schemaDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module.exports = {
type: "object",
properties: {
simple: {
src:
"https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies",
src: "https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies",
title: "Simple",
type: "object",
properties: {
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/src/samples/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function validate({ pass1, pass2 }, errors) {
}

function transformErrors(errors) {
return errors.map(error => {
return errors.map((error) => {
if (error.name === "minimum" && error.property === "instance.age") {
return Object.assign({}, error, {
message: "You need to be 18 because of some legal thing",
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/src/samples/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default {
return (
<input
className="form-control"
onChange={event => onChange(event.target.value)}
onChange={(event) => onChange(event.target.value)}
style={{ backgroundColor }}
value={value}
/>
Expand All @@ -151,7 +151,7 @@ export default {
className="form-control"
style={{ backgroundColor }}
value={value}
onChange={event => onChange(event.target.value)}
onChange={(event) => onChange(event.target.value)}
>
{enumOptions.map(({ label, value }, i) => {
return (
Expand Down

0 comments on commit 8f608c1

Please sign in to comment.