mirror of
https://git.vectorsigma.ru/public/AdGuardHome.git
synced 2026-08-04 04:39:25 +00:00
25 lines
791 B
TypeScript
25 lines
791 B
TypeScript
import React from 'react';
|
|
import { components, MultiValueProps } from 'react-select';
|
|
import intl from 'panel/common/intl';
|
|
|
|
export const CustomMultiValue = <T extends Record<string, any> = any>(props: MultiValueProps<T, true>) => {
|
|
const { getValue } = props;
|
|
const selectedValues = getValue();
|
|
const selectedCount = selectedValues.length;
|
|
|
|
if (props.index === 0) {
|
|
return (
|
|
<components.MultiValue
|
|
{...props}
|
|
cropWithEllipsis={false}
|
|
innerProps={{
|
|
...props.innerProps,
|
|
}}>
|
|
{selectedCount === 1 ? selectedValues[0]?.label : intl.getMessage('selected', { value: selectedCount })}
|
|
</components.MultiValue>
|
|
);
|
|
}
|
|
|
|
return null;
|
|
};
|