Migration of jsx files to tsx 2 (#850)

This is to continue the work of migrating all the jsx files into tsx
files.
The MO is basically described here: #848.

About 7 files to go...
This commit is contained in:
Harel M
2023-12-22 23:32:25 +02:00
committed by GitHub
parent fa182e66fa
commit 974dd7bfd9
57 changed files with 827 additions and 827 deletions

View File

@@ -15,21 +15,19 @@ const typeMap = {
formatted: () => Block,
};
type SpecFieldProps = InputFieldSpecProps & {
export type SpecFieldProps = InputFieldSpecProps & {
name?: string
};
export default class SpecField extends React.Component<SpecFieldProps> {
render() {
const {props} = this;
const fieldType = this.props.fieldSpec?.type;
const fieldType = props.fieldSpec.type;
const typeBlockFn = typeMap[fieldType];
const typeBlockFn = typeMap[fieldType!];
let TypeBlock;
if (typeBlockFn) {
TypeBlock = typeBlockFn(props);
TypeBlock = typeBlockFn(this.props);
}
else {
console.warn("No such type for '%s'", fieldType);
@@ -37,11 +35,11 @@ export default class SpecField extends React.Component<SpecFieldProps> {
}
return <TypeBlock
label={props.label}
action={props.action}
label={this.props.label}
action={this.props.action}
fieldSpec={this.props.fieldSpec}
>
<InputSpec {...props} />
<InputSpec {...this.props} />
</TypeBlock>
}
}