mirror of
https://github.com/maputnik/editor.git
synced 2026-08-02 03:07:27 +00:00
More conversion from jsx to tsx
This commit is contained in:
@@ -14,8 +14,8 @@ import capitalize from 'lodash.capitalize'
|
|||||||
const iconProperties = ['background-pattern', 'fill-pattern', 'line-pattern', 'fill-extrusion-pattern', 'icon-image']
|
const iconProperties = ['background-pattern', 'fill-pattern', 'line-pattern', 'fill-extrusion-pattern', 'icon-image']
|
||||||
|
|
||||||
export type SpecFieldProps = {
|
export type SpecFieldProps = {
|
||||||
onChange(...args: unknown[]): unknown
|
onChange?(...args: unknown[]): unknown
|
||||||
fieldName: string
|
fieldName?: string
|
||||||
fieldSpec: {
|
fieldSpec: {
|
||||||
default?: unknown
|
default?: unknown
|
||||||
type: 'number' | 'enum' | 'resolvedImage' | 'formatted' | 'string' | 'color' | 'boolean' | 'array'
|
type: 'number' | 'enum' | 'resolvedImage' | 'formatted' | 'string' | 'color' | 'boolean' | 'array'
|
||||||
@@ -49,7 +49,7 @@ export default class SpecField extends React.Component<SpecFieldProps> {
|
|||||||
value: this.props.value,
|
value: this.props.value,
|
||||||
default: this.props.fieldSpec.default,
|
default: this.props.fieldSpec.default,
|
||||||
name: this.props.fieldName,
|
name: this.props.fieldName,
|
||||||
onChange: (newValue: string) => this.props.onChange(this.props.fieldName, newValue),
|
onChange: (newValue: string) => this.props.onChange!(this.props.fieldName, newValue),
|
||||||
'aria-label': this.props['aria-label'],
|
'aria-label': this.props['aria-label'],
|
||||||
}
|
}
|
||||||
switch(this.props.fieldSpec.type) {
|
switch(this.props.fieldSpec.type) {
|
||||||
@@ -70,7 +70,7 @@ export default class SpecField extends React.Component<SpecFieldProps> {
|
|||||||
case 'resolvedImage':
|
case 'resolvedImage':
|
||||||
case 'formatted':
|
case 'formatted':
|
||||||
case 'string':
|
case 'string':
|
||||||
if (iconProperties.indexOf(this.props.fieldName) >= 0) {
|
if (iconProperties.indexOf(this.props.fieldName!) >= 0) {
|
||||||
const options = this.props.fieldSpec.values || [];
|
const options = this.props.fieldSpec.values || [];
|
||||||
return <InputAutocomplete
|
return <InputAutocomplete
|
||||||
{...commonProps as Omit<InputAutocompleteProps, "options">}
|
{...commonProps as Omit<InputAutocompleteProps, "options">}
|
||||||
|
|||||||
@@ -21,15 +21,13 @@ type SpecFieldProps = InputFieldSpecProps & {
|
|||||||
|
|
||||||
export default class SpecField extends React.Component<SpecFieldProps> {
|
export default class SpecField extends React.Component<SpecFieldProps> {
|
||||||
render() {
|
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;
|
let TypeBlock;
|
||||||
if (typeBlockFn) {
|
if (typeBlockFn) {
|
||||||
TypeBlock = typeBlockFn(props);
|
TypeBlock = typeBlockFn(this.props);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.warn("No such type for '%s'", fieldType);
|
console.warn("No such type for '%s'", fieldType);
|
||||||
@@ -37,11 +35,11 @@ export default class SpecField extends React.Component<SpecFieldProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return <TypeBlock
|
return <TypeBlock
|
||||||
label={props.label}
|
label={this.props.label}
|
||||||
action={props.action}
|
action={this.props.action}
|
||||||
fieldSpec={this.props.fieldSpec}
|
fieldSpec={this.props.fieldSpec}
|
||||||
>
|
>
|
||||||
<InputSpec {...props} />
|
<InputSpec {...this.props} />
|
||||||
</TypeBlock>
|
</TypeBlock>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
import {MdDelete} from 'react-icons/md'
|
import {MdDelete} from 'react-icons/md'
|
||||||
|
|
||||||
|
|
||||||
export default class DeleteStopButton extends React.Component {
|
type DeleteStopButtonProps = {
|
||||||
static propTypes = {
|
onClick?(...args: unknown[]): unknown
|
||||||
onClick: PropTypes.func,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
export default class DeleteStopButton extends React.Component<DeleteStopButtonProps> {
|
||||||
render() {
|
render() {
|
||||||
return <InputButton
|
return <InputButton
|
||||||
className="maputnik-delete-stop"
|
className="maputnik-delete-stop"
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldString from './FieldString'
|
import FieldString from './FieldString'
|
||||||
|
|
||||||
export default class BlockComment extends React.Component {
|
type BlockCommentProps = {
|
||||||
static propTypes = {
|
value?: string
|
||||||
value: PropTypes.string,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockComment extends React.Component<BlockCommentProps> {
|
||||||
render() {
|
render() {
|
||||||
const fieldSpec = {
|
const fieldSpec = {
|
||||||
doc: "Comments for the current layer. This is non-standard and not in the spec."
|
doc: "Comments for the current layer. This is non-standard and not in the spec."
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import FieldAutocomplete from './FieldAutocomplete'
|
import FieldAutocomplete from './FieldAutocomplete'
|
||||||
|
|
||||||
export default class FieldFont extends React.Component {
|
type FieldFontProps = {
|
||||||
static propTypes = {
|
value?: string[]
|
||||||
value: PropTypes.array,
|
default?: string[]
|
||||||
default: PropTypes.array,
|
fonts?: unknown[]
|
||||||
fonts: PropTypes.array,
|
style?: object
|
||||||
style: PropTypes.object,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
label?: string
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default class FieldFont extends React.Component<FieldFontProps> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
fonts: []
|
fonts: []
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,7 @@ export default class FieldFont extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeFont(idx, newValue) {
|
changeFont(idx: number, newValue: string) {
|
||||||
const changedValues = this.values.slice(0)
|
const changedValues = this.values.slice(0)
|
||||||
changedValues[idx] = newValue
|
changedValues[idx] = newValue
|
||||||
const filteredValues = changedValues
|
const filteredValues = changedValues
|
||||||
@@ -45,7 +45,7 @@ export default class FieldFont extends React.Component {
|
|||||||
>
|
>
|
||||||
<FieldAutocomplete
|
<FieldAutocomplete
|
||||||
value={value}
|
value={value}
|
||||||
options={this.props.fonts.map(f => [f, f])}
|
options={this.props.fonts!.map(f => [f, f])}
|
||||||
onChange={this.changeFont.bind(this, i)}
|
onChange={this.changeFont.bind(this, i)}
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
@@ -1,18 +1,17 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldString from './FieldString'
|
import FieldString from './FieldString'
|
||||||
|
|
||||||
export default class BlockId extends React.Component {
|
type BlockIdProps = {
|
||||||
static propTypes = {
|
value: string
|
||||||
value: PropTypes.string.isRequired,
|
wdKey: string
|
||||||
wdKey: PropTypes.string.isRequired,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
error?: unknown[]
|
||||||
error: PropTypes.object,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockId extends React.Component<BlockIdProps> {
|
||||||
render() {
|
render() {
|
||||||
return <Block label={"ID"} fieldSpec={latest.layer.id}
|
return <Block label={"ID"} fieldSpec={latest.layer.id}
|
||||||
data-wd-key={this.props.wdKey}
|
data-wd-key={this.props.wdKey}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldNumber from './FieldNumber'
|
import FieldNumber from './FieldNumber'
|
||||||
|
|
||||||
export default class BlockMaxZoom extends React.Component {
|
type BlockMaxZoomProps = {
|
||||||
static propTypes = {
|
value?: number
|
||||||
value: PropTypes.number,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
error?: unknown[]
|
||||||
error: PropTypes.object,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockMaxZoom extends React.Component<BlockMaxZoomProps> {
|
||||||
render() {
|
render() {
|
||||||
return <Block label={"Max Zoom"} fieldSpec={latest.layer.maxzoom}
|
return <Block label={"Max Zoom"} fieldSpec={latest.layer.maxzoom}
|
||||||
error={this.props.error}
|
error={this.props.error}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldNumber from './FieldNumber'
|
import FieldNumber from './FieldNumber'
|
||||||
|
|
||||||
export default class BlockMinZoom extends React.Component {
|
type BlockMinZoomProps = {
|
||||||
static propTypes = {
|
value?: number
|
||||||
value: PropTypes.number,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
error?: unknown[]
|
||||||
error: PropTypes.object,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockMinZoom extends React.Component<BlockMinZoomProps> {
|
||||||
render() {
|
render() {
|
||||||
return <Block label={"Min Zoom"} fieldSpec={latest.layer.minzoom}
|
return <Block label={"Min Zoom"} fieldSpec={latest.layer.minzoom}
|
||||||
error={this.props.error}
|
error={this.props.error}
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldAutocomplete from './FieldAutocomplete'
|
import FieldAutocomplete from './FieldAutocomplete'
|
||||||
|
|
||||||
export default class BlockSource extends React.Component {
|
type BlockSourceProps = {
|
||||||
static propTypes = {
|
value?: string
|
||||||
value: PropTypes.string,
|
wdKey?: string
|
||||||
wdKey: PropTypes.string,
|
onChange?(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func,
|
sourceIds?: unknown[]
|
||||||
sourceIds: PropTypes.array,
|
error?: unknown[]
|
||||||
error: PropTypes.object,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockSource extends React.Component<BlockSourceProps> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
onChange: () => {},
|
onChange: () => {},
|
||||||
sourceIds: [],
|
sourceIds: [],
|
||||||
@@ -28,8 +27,8 @@ export default class BlockSource extends React.Component {
|
|||||||
>
|
>
|
||||||
<FieldAutocomplete
|
<FieldAutocomplete
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange!}
|
||||||
options={this.props.sourceIds.map(src => [src, src])}
|
options={this.props.sourceIds!.map(src => [src, src])}
|
||||||
/>
|
/>
|
||||||
</Block>
|
</Block>
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,17 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldAutocomplete from './FieldAutocomplete'
|
import FieldAutocomplete from './FieldAutocomplete'
|
||||||
|
|
||||||
export default class BlockSourceLayer extends React.Component {
|
type BlockSourceLayerProps = {
|
||||||
static propTypes = {
|
value?: string
|
||||||
value: PropTypes.string,
|
onChange?(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func,
|
sourceLayerIds?: unknown[]
|
||||||
sourceLayerIds: PropTypes.array,
|
isFixed?: boolean
|
||||||
isFixed: PropTypes.bool,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockSourceLayer extends React.Component<BlockSourceLayerProps> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
onChange: () => {},
|
onChange: () => {},
|
||||||
sourceLayerIds: [],
|
sourceLayerIds: [],
|
||||||
@@ -26,8 +25,8 @@ export default class BlockSourceLayer extends React.Component {
|
|||||||
<FieldAutocomplete
|
<FieldAutocomplete
|
||||||
keepMenuWithinWindowBounds={!!this.props.isFixed}
|
keepMenuWithinWindowBounds={!!this.props.isFixed}
|
||||||
value={this.props.value}
|
value={this.props.value}
|
||||||
onChange={this.props.onChange}
|
onChange={this.props.onChange!}
|
||||||
options={this.props.sourceLayerIds.map(l => [l, l])}
|
options={this.props.sourceLayerIds!.map(l => [l, l])}
|
||||||
/>
|
/>
|
||||||
</Block>
|
</Block>
|
||||||
}
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import FieldAutocomplete from './FieldAutocomplete'
|
|
||||||
|
|
||||||
|
|
||||||
export default class FieldSymbol extends React.Component {
|
|
||||||
static propTypes = {
|
|
||||||
value: PropTypes.string,
|
|
||||||
icons: PropTypes.array,
|
|
||||||
style: PropTypes.object,
|
|
||||||
onChange: PropTypes.func.isRequired,
|
|
||||||
}
|
|
||||||
|
|
||||||
static defaultProps = {
|
|
||||||
icons: []
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return <FieldAutocomplete
|
|
||||||
value={this.props.value}
|
|
||||||
options={this.props.icons.map(f => [f, f])}
|
|
||||||
onChange={this.props.onChange}
|
|
||||||
wrapperStyle={this.props.style}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import FieldAutocomplete from './FieldAutocomplete'
|
||||||
|
|
||||||
|
|
||||||
|
type FieldSymbolProps = {
|
||||||
|
value?: string
|
||||||
|
icons?: unknown[]
|
||||||
|
onChange(...args: unknown[]): unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default class FieldSymbol extends React.Component<FieldSymbolProps> {
|
||||||
|
static defaultProps = {
|
||||||
|
icons: []
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return <FieldAutocomplete
|
||||||
|
value={this.props.value}
|
||||||
|
options={this.props.icons!.map(f => [f, f])}
|
||||||
|
onChange={this.props.onChange}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldSelect from './FieldSelect'
|
import FieldSelect from './FieldSelect'
|
||||||
import FieldString from './FieldString'
|
import FieldString from './FieldString'
|
||||||
|
|
||||||
export default class BlockType extends React.Component {
|
type BlockTypeProps = {
|
||||||
static propTypes = {
|
value: string
|
||||||
value: PropTypes.string.isRequired,
|
wdKey?: string
|
||||||
wdKey: PropTypes.string,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
error?: unknown[]
|
||||||
error: PropTypes.object,
|
disabled?: boolean
|
||||||
disabled: PropTypes.bool,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class BlockType extends React.Component<BlockTypeProps> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
}
|
}
|
||||||
@@ -1,37 +1,17 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
import {MdFunctions, MdInsertChart} from 'react-icons/md'
|
import {MdFunctions, MdInsertChart} from 'react-icons/md'
|
||||||
import {mdiFunctionVariant} from '@mdi/js';
|
import {mdiFunctionVariant} from '@mdi/js';
|
||||||
|
|
||||||
|
type FunctionInputButtonsProps = {
|
||||||
|
fieldSpec?: any
|
||||||
|
onZoomClick?(...args: unknown[]): unknown
|
||||||
|
onDataClick?(...args: unknown[]): unknown
|
||||||
|
onExpressionClick?(...args: unknown[]): unknown
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
export default class FunctionInputButtons extends React.Component<FunctionInputButtonsProps> {
|
||||||
* So here we can't just check is `Array.isArray(value)` because certain
|
|
||||||
* properties accept arrays as values, for example `text-font`. So we must try
|
|
||||||
* and create an expression.
|
|
||||||
*/
|
|
||||||
function isExpression(value, fieldSpec={}) {
|
|
||||||
if (!Array.isArray(value)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
expression.createExpression(value, fieldSpec);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class FunctionInputButtons extends React.Component {
|
|
||||||
static propTypes = {
|
|
||||||
fieldSpec: PropTypes.object,
|
|
||||||
onZoomClick: PropTypes.func,
|
|
||||||
onDataClick: PropTypes.func,
|
|
||||||
onExpressionClick: PropTypes.func,
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let makeZoomInputButton, makeDataInputButton, expressionInputButton;
|
let makeZoomInputButton, makeDataInputButton, expressionInputButton;
|
||||||
|
|
||||||
@@ -1,25 +1,24 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import SpecField from './SpecField'
|
import SpecField from './SpecField'
|
||||||
import FunctionButtons from './_FunctionButtons'
|
import FunctionButtons from './_FunctionButtons'
|
||||||
import Block from './Block'
|
|
||||||
|
|
||||||
import labelFromFieldName from './_labelFromFieldName'
|
import labelFromFieldName from './_labelFromFieldName'
|
||||||
|
|
||||||
|
|
||||||
export default class SpecProperty extends React.Component {
|
type SpecPropertyProps = {
|
||||||
static propTypes = {
|
onZoomClick(...args: unknown[]): unknown
|
||||||
onZoomClick: PropTypes.func.isRequired,
|
onDataClick(...args: unknown[]): unknown
|
||||||
onDataClick: PropTypes.func.isRequired,
|
fieldName?: string
|
||||||
fieldName: PropTypes.string,
|
fieldType?: string
|
||||||
fieldType: PropTypes.string,
|
fieldSpec?: any
|
||||||
fieldSpec: PropTypes.object,
|
value?: any
|
||||||
value: PropTypes.any,
|
errors?: unknown[]
|
||||||
errors: PropTypes.object,
|
onExpressionClick?(...args: unknown[]): unknown
|
||||||
onExpressionClick: PropTypes.func,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
export default class SpecProperty extends React.Component<SpecPropertyProps> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
errors: {},
|
errors: {},
|
||||||
}
|
}
|
||||||
@@ -31,17 +30,16 @@ export default class SpecProperty extends React.Component {
|
|||||||
fieldSpec={this.props.fieldSpec}
|
fieldSpec={this.props.fieldSpec}
|
||||||
onZoomClick={this.props.onZoomClick}
|
onZoomClick={this.props.onZoomClick}
|
||||||
onDataClick={this.props.onDataClick}
|
onDataClick={this.props.onDataClick}
|
||||||
value={this.props.value}
|
|
||||||
onExpressionClick={this.props.onExpressionClick}
|
onExpressionClick={this.props.onExpressionClick}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
const error = errors[fieldType+"."+fieldName];
|
const error = errors![fieldType+"."+fieldName as any] as any;
|
||||||
|
|
||||||
return <SpecField
|
return <SpecField
|
||||||
{...this.props}
|
{...this.props}
|
||||||
error={error}
|
error={error}
|
||||||
fieldSpec={this.props.fieldSpec}
|
fieldSpec={this.props.fieldSpec}
|
||||||
label={labelFromFieldName(this.props.fieldName)}
|
label={labelFromFieldName(this.props.fieldName || '')}
|
||||||
action={functionBtn}
|
action={functionBtn}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import capitalize from 'lodash.capitalize'
|
import capitalize from 'lodash.capitalize'
|
||||||
|
|
||||||
export default function labelFromFieldName(fieldName) {
|
export default function labelFromFieldName(fieldName: string) {
|
||||||
let label;
|
let label;
|
||||||
const parts = fieldName.split('-');
|
const parts = fieldName.split('-');
|
||||||
if (parts.length > 1) {
|
if (parts.length > 1) {
|
||||||
Reference in New Issue
Block a user