CPV Field
This field is very special, since it is giving you an opportunity to adjust visual part after user will select codes from the CPV Picker
.
Let's take a look at 2 examples
1st - Default version shipped with @mercell/form-react
package.
Please select some codes and see the 'end result'
interface DefaultCPVProps {
selectedCPVs: string[];
setCPVPickerVisibility: Dispatch<SetStateAction<boolean>>;
setSelectedCPVs: Dispatch<SetStateAction<string[]>>;
isDisabled: boolean;
showErrors: boolean;
errors: string;
onChangeFieldValue: (event: any) => void;
name: string;
allowToSelectOnlyOne?: boolean;
}
type CPVFieldStructure<T extends DefaultCPVProps = DefaultCPVProps> = {
type: 'cpv-selector';
elementProperties?: JSX.IntrinsicElements['div'];
fieldToTrackToDisableCodes?: FieldTrackerInterface;
Component?: FC<T>;
} & Omit<
CPVProps,
| 'onCloseCPVPickerCallback'
| 'isCPVPickerOpen'
| 'onCPVListChange'
| 'selectedCPVs'
> &
Omit<FieldStructure, 'placeholder'>;
Live Editor
Result
2nd example - custom component for selected codes.
Live Editor
Result