diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 9fef7d9f4..3e4e57d40 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -617,7 +617,8 @@ "styles": { "tab": "Style", "no-source": "Please select a source before configuring style", - "secondarylabels": "Secondary styles" + "secondarylabels": "Secondary styles", + "step": "Step" } } }, diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index a39da7f08..fa29d3a27 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -619,7 +619,8 @@ "styles": { "tab": "Style", "no-source": "Veuillez choisir une source de données avant de configurer les styles", - "secondarylabels": "Styles secondaires" + "secondarylabels": "Styles secondaires", + "step": "Borne" } } }, diff --git a/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/ColorListField.js b/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/ColorListField.js index a946465d1..647797000 100644 --- a/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/ColorListField.js +++ b/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/ColorListField.js @@ -3,7 +3,11 @@ import randomColor from 'randomcolor'; import { makeStyles } from '@material-ui/core/styles'; +import { number, useTranslate } from 'react-admin'; +import { Field } from 'react-final-form'; +import { TextField } from '@material-ui/core'; import ColorPicker from '../../../../../../../components/react-admin/ColorPicker'; +import Condition from '../../../../../../../components/react-admin/Condition'; import styles from './styles'; @@ -11,8 +15,9 @@ const useStyles = makeStyles(styles); const DEFAULT_MAX_CLASSES = 15; -const ColorListField = ({ value, onChange = () => {}, maxClasses = DEFAULT_MAX_CLASSES }) => { +const ColorListField = ({ path, value, onChange = () => {}, maxClasses = DEFAULT_MAX_CLASSES }) => { const classes = useStyles(); + const translate = useTranslate(); const handleColorChange = index => newValue => { const newColorList = [...value]; @@ -35,13 +40,54 @@ const ColorListField = ({ value, onChange = () => {}, maxClasses = DEFAULT_MAX_C return (
{(value || []).map((color, index) => ( - + // eslint-disable-next-line react/no-array-index-key + + + Number(v)} + > + {({ meta, input: { value: boundValue, onChange: onBoundChange } }) => ( + + )} + + + + (v === 'manual' && index === (value.length - 1))} + > + Number(v)} + > + {({ meta, input: { value: boundValue, onChange: onBoundChange } }) => ( + + )} + + + ))} + diff --git a/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/GraduateValue.js b/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/GraduateValue.js index 090fe6460..8f2dcfa13 100644 --- a/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/GraduateValue.js +++ b/src/modules/RA/DataLayer/components/tabs/StyleTab/Style/GraduateValue.js @@ -30,7 +30,7 @@ const GraduateValue = ({ path, Component = ValueListField, defaultValue = defVal { id: 'jenks', name: translate('style-editor.graduate.method.jenks') }, { id: 'quantile', name: translate('style-editor.graduate.method.quantiles') }, { id: 'equal_interval', name: translate('style-editor.graduate.method.equal-interval') }, - /* { id: 'manual', name: translate('style-editor.graduate.method.manual') }, */ + { id: 'manual', name: translate('style-editor.graduate.method.manual') }, ]} />
@@ -38,7 +38,7 @@ const GraduateValue = ({ path, Component = ValueListField, defaultValue = defVal {translate('style-editor.graduate.steps')} {({ input: { value, onChange } }) => ( - + )}