forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps] Label style properties (elastic#52957)
* text styling * label style editor UI * wire up styles to mb * allow string values * remove console.log * default getFields to provide ordinal fields for vector source * fix vector_style jest test * add label styles to docs * fix prettier errors * use index-pattern field formatter to format label * rename LABEL to LABEL_TEXT * review feedback * fix problem with icons not displaying with labels * fix functional tests * fix canno read name of null error * update jest expect * fix eslint errors * do not display label text in legend * always show all label styling properties in editor * review feedback
- Loading branch information
Showing
28 changed files
with
554 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...egacy/plugins/maps/public/layers/styles/vector/components/label/dynamic_label_selector.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* 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'; | ||
|
||
export function DynamicLabelSelector({ fields, styleOptions, onChange }) { | ||
const onFieldChange = ({ field }) => { | ||
onChange({ ...styleOptions, field }); | ||
}; | ||
|
||
return ( | ||
<FieldSelect | ||
fields={fields} | ||
selectedFieldName={_.get(styleOptions, 'field.name')} | ||
onChange={onFieldChange} | ||
compressed | ||
/> | ||
); | ||
} |
28 changes: 28 additions & 0 deletions
28
...legacy/plugins/maps/public/layers/styles/vector/components/label/static_label_selector.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiFieldText } from '@elastic/eui'; | ||
|
||
export function StaticLabelSelector({ onChange, styleOptions }) { | ||
const onValueChange = event => { | ||
onChange({ value: event.target.value }); | ||
}; | ||
|
||
return ( | ||
<EuiFieldText | ||
placeholder={i18n.translate('xpack.maps.styles.staticLabel.valuePlaceholder', { | ||
defaultMessage: 'symbol label', | ||
})} | ||
value={styleOptions.value} | ||
onChange={onValueChange} | ||
aria-label={i18n.translate('xpack.maps.styles.staticLabel.valueAriaLabel', { | ||
defaultMessage: 'symbol label', | ||
})} | ||
/> | ||
); | ||
} |
21 changes: 21 additions & 0 deletions
21
...cy/plugins/maps/public/layers/styles/vector/components/label/vector_style_label_editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { StaticDynamicStyleRow } from '../static_dynamic_style_row'; | ||
import { DynamicLabelSelector } from './dynamic_label_selector'; | ||
import { StaticLabelSelector } from './static_label_selector'; | ||
|
||
export function VectorStyleLabelEditor(props) { | ||
return ( | ||
<StaticDynamicStyleRow | ||
{...props} | ||
DynamicSelector={DynamicLabelSelector} | ||
StaticSelector={StaticLabelSelector} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.