mirror of
https://github.com/maputnik/editor.git
synced 2026-08-31 17:37:25 +00:00
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:
@@ -0,0 +1,46 @@
|
||||
import React from 'react'
|
||||
|
||||
import SpecField, {SpecFieldProps} from './SpecField'
|
||||
import FunctionButtons from './_FunctionButtons'
|
||||
|
||||
import labelFromFieldName from './_labelFromFieldName'
|
||||
|
||||
|
||||
type SpecPropertyProps = SpecFieldProps & {
|
||||
onZoomClick(...args: unknown[]): unknown
|
||||
onDataClick(...args: unknown[]): unknown
|
||||
fieldName?: string
|
||||
fieldType?: string
|
||||
fieldSpec?: any
|
||||
value?: any
|
||||
errors?: unknown[]
|
||||
onExpressionClick?(...args: unknown[]): unknown
|
||||
};
|
||||
|
||||
|
||||
export default class SpecProperty extends React.Component<SpecPropertyProps> {
|
||||
static defaultProps = {
|
||||
errors: {},
|
||||
}
|
||||
|
||||
render() {
|
||||
const {errors, fieldName, fieldType} = this.props;
|
||||
|
||||
const functionBtn = <FunctionButtons
|
||||
fieldSpec={this.props.fieldSpec}
|
||||
onZoomClick={this.props.onZoomClick}
|
||||
onDataClick={this.props.onDataClick}
|
||||
onExpressionClick={this.props.onExpressionClick}
|
||||
/>
|
||||
|
||||
const error = errors![fieldType+"."+fieldName as any] as any;
|
||||
|
||||
return <SpecField
|
||||
{...this.props}
|
||||
error={error}
|
||||
fieldSpec={this.props.fieldSpec}
|
||||
label={labelFromFieldName(this.props.fieldName || '')}
|
||||
action={functionBtn}
|
||||
/>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user