[Maps] use style-prop methods to determine state (#55607)
This commit is contained in:
parent
5daed94c30
commit
5a15ad123d
|
@ -24,7 +24,12 @@ import { RENDER_AS } from './render_as';
|
|||
import { CreateSourceEditor } from './create_source_editor';
|
||||
import { UpdateSourceEditor } from './update_source_editor';
|
||||
import { GRID_RESOLUTION } from '../../grid_resolution';
|
||||
import { SOURCE_DATA_ID_ORIGIN, ES_GEO_GRID, COUNT_PROP_NAME } from '../../../../common/constants';
|
||||
import {
|
||||
SOURCE_DATA_ID_ORIGIN,
|
||||
ES_GEO_GRID,
|
||||
COUNT_PROP_NAME,
|
||||
COLOR_MAP_TYPE,
|
||||
} from '../../../../common/constants';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { getDataSourceLabel } from '../../../../common/i18n_getters';
|
||||
import { AbstractESAggSource } from '../es_agg_source';
|
||||
|
@ -251,6 +256,7 @@ export class ESGeoGridSource extends AbstractESAggSource {
|
|||
origin: SOURCE_DATA_ID_ORIGIN,
|
||||
},
|
||||
color: COLOR_GRADIENTS[0].value,
|
||||
type: COLOR_MAP_TYPE.ORDINAL,
|
||||
},
|
||||
},
|
||||
[VECTOR_STYLES.LINE_COLOR]: {
|
||||
|
|
|
@ -55,7 +55,7 @@ export function DynamicColorForm({
|
|||
return null;
|
||||
}
|
||||
|
||||
if (styleOptions.type === COLOR_MAP_TYPE.ORDINAL) {
|
||||
if (styleProperty.isOrdinal()) {
|
||||
return (
|
||||
<ColorMapSelect
|
||||
colorMapOptions={COLOR_GRADIENTS}
|
||||
|
@ -95,7 +95,7 @@ export function DynamicColorForm({
|
|||
<EuiFlexItem>
|
||||
<FieldSelect
|
||||
fields={fields}
|
||||
selectedFieldName={_.get(styleOptions, 'field.name')}
|
||||
selectedFieldName={styleProperty.getFieldName()}
|
||||
onChange={onFieldChange}
|
||||
compressed
|
||||
/>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import { FieldSelect } from '../field_select';
|
||||
|
@ -27,7 +26,7 @@ export function DynamicLabelForm({
|
|||
<EuiFlexItem>
|
||||
<FieldSelect
|
||||
fields={fields}
|
||||
selectedFieldName={_.get(styleOptions, 'field.name')}
|
||||
selectedFieldName={styleProperty.getFieldName()}
|
||||
onChange={onFieldChange}
|
||||
compressed
|
||||
/>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { FieldSelect } from '../field_select';
|
||||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
|
@ -30,7 +29,7 @@ export function DynamicOrientationForm({
|
|||
<EuiFlexItem>
|
||||
<FieldSelect
|
||||
fields={fields}
|
||||
selectedFieldName={_.get(styleOptions, 'field.name')}
|
||||
selectedFieldName={styleProperty.getFieldName()}
|
||||
onChange={onFieldChange}
|
||||
compressed
|
||||
/>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import _ from 'lodash';
|
||||
import React, { Fragment } from 'react';
|
||||
import { FieldSelect } from '../field_select';
|
||||
import { SizeRangeSelector } from './size_range_selector';
|
||||
|
@ -50,7 +49,7 @@ export function DynamicSizeForm({
|
|||
<EuiFlexItem>
|
||||
<FieldSelect
|
||||
fields={fields}
|
||||
selectedFieldName={_.get(styleOptions, 'field.name')}
|
||||
selectedFieldName={styleProperty.getFieldName()}
|
||||
onChange={onFieldChange}
|
||||
compressed
|
||||
/>
|
||||
|
|
|
@ -32,6 +32,10 @@ export class DynamicStyleProperty extends AbstractStyleProperty {
|
|||
return this._field;
|
||||
}
|
||||
|
||||
getFieldName() {
|
||||
return this._field ? this._field.getName() : '';
|
||||
}
|
||||
|
||||
getComputedFieldName() {
|
||||
if (!this.isComplete()) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue