mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
[i18n] add filters from the start (#9796)
This commit is contained in:
parent
932da387be
commit
e293243da9
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Label } from '@buffetjs/core';
|
||||
import { Inputs } from '@buffetjs/custom';
|
||||
import Select from 'react-select';
|
||||
import Select, { createFilter } from 'react-select';
|
||||
import { Col, Row } from 'reactstrap';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useTheme } from 'styled-components';
|
||||
@ -10,6 +10,12 @@ import { BaselineAlignment, selectStyles, DropdownIndicator } from 'strapi-helpe
|
||||
import { useFormikContext } from 'formik';
|
||||
import { getTrad } from '../../utils';
|
||||
|
||||
const reactSelectLocaleFilter = createFilter({
|
||||
ignoreCase: true,
|
||||
ignoreAccents: true,
|
||||
matchFrom: 'start',
|
||||
});
|
||||
|
||||
const BaseForm = ({ options, defaultOption }) => {
|
||||
const theme = useTheme();
|
||||
const { formatMessage } = useIntl();
|
||||
@ -34,6 +40,7 @@ const BaseForm = ({ options, defaultOption }) => {
|
||||
aria-labelledby="locale-code"
|
||||
options={options}
|
||||
defaultValue={defaultOption}
|
||||
filterOption={reactSelectLocaleFilter}
|
||||
onChange={selection => {
|
||||
setFieldValue('displayName', selection.value);
|
||||
setFieldValue('code', selection.label);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user