Skip to content

Commit

Permalink
Changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgros committed Dec 29, 2022
1 parent b9a998d commit 774e1c0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Expand Up @@ -30,7 +30,10 @@ export default function BaseInputTemplate<
children,
extraProps,
}: WidgetProps<T, S, F>) {
const inputProps = { ...extraProps, ...getInputProps(schema, type, options) };
const inputProps = {
...extraProps,
...getInputProps<T, S, F>(schema, type, options),
};
const _onChange = ({
target: { value },
}: React.ChangeEvent<HTMLInputElement>) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap-4/src/CheckboxWidget/CheckboxWidget.tsx
Expand Up @@ -28,7 +28,7 @@ export default function CheckboxWidget<
// Because an unchecked checkbox will cause html5 validation to fail, only add
// the "required" attribute if the field value must be "true", due to the
// "const" or "enum" keywords
const required = schemaRequiresTrueValue(schema);
const required = schemaRequiresTrueValue<S>(schema);

const _onChange = ({
target: { checked },
Expand Down
6 changes: 3 additions & 3 deletions packages/bootstrap-4/src/SelectWidget/SelectWidget.tsx
Expand Up @@ -64,19 +64,19 @@ export default function SelectWidget<
onBlur &&
((event: React.FocusEvent) => {
const newValue = getValue(event, multiple);
onBlur(id, processSelectValue(schema, newValue, options));
onBlur(id, processSelectValue<T, S, F>(schema, newValue, options));
})
}
onFocus={
onFocus &&
((event: React.FocusEvent) => {
const newValue = getValue(event, multiple);
onFocus(id, processSelectValue(schema, newValue, options));
onFocus(id, processSelectValue<T, S, F>(schema, newValue, options));
})
}
onChange={(event: React.ChangeEvent) => {
const newValue = getValue(event, multiple);
onChange(processSelectValue(schema, newValue, options));
onChange(processSelectValue<T, S, F>(schema, newValue, options));
}}
>
{!multiple && schema.default === undefined && (
Expand Down
12 changes: 6 additions & 6 deletions packages/bootstrap-4/src/TitleField/TitleField.tsx
@@ -1,6 +1,7 @@
import React from "react";
import {
FormContextType,
getUiOptions,
RJSFSchema,
StrictRJSFSchema,
TitleFieldProps,
Expand All @@ -11,12 +12,11 @@ export default function TitleField<
S extends StrictRJSFSchema = RJSFSchema,
F extends FormContextType = any
>({ id, title, uiSchema }: TitleFieldProps<T, S, F>) {
const uiOptions = getUiOptions<T, S, F>(uiSchema);
return (
<>
<div id={id} className="my-1">
<h5>{(uiSchema && uiSchema["ui:title"]) || title}</h5>
<hr className="border-0 bg-secondary" style={{ height: "1px" }} />
</div>
</>
<div id={id} className="my-1">
<h5>{uiOptions.title || title}</h5>
<hr className="border-0 bg-secondary" style={{ height: "1px" }} />
</div>
);
}

0 comments on commit 774e1c0

Please sign in to comment.