@ -5,5 +5,5 @@ import { useSelectField } from '../../hooks/useSelectField';
|
||||
export const SelectFieldDisplay = () => {
|
||||
const { fieldValue } = useSelectField();
|
||||
|
||||
return <Tag color={fieldValue.color} text={fieldValue.text} />;
|
||||
return <Tag color={fieldValue.color} text={fieldValue.label} />;
|
||||
};
|
||||
|
||||
@ -26,15 +26,15 @@ export const useSelectField = () => {
|
||||
);
|
||||
const fieldSelectValue = isFieldSelectValue(fieldValue)
|
||||
? fieldValue
|
||||
: { color: 'green' as ThemeColor, text: '' };
|
||||
: { color: 'green' as ThemeColor, label: '' };
|
||||
|
||||
const fieldInitialValue = useFieldInitialValue();
|
||||
|
||||
const initialValue = {
|
||||
color: 'green' as ThemeColor,
|
||||
text: fieldInitialValue?.isEmpty
|
||||
label: fieldInitialValue?.isEmpty
|
||||
? ''
|
||||
: fieldInitialValue?.value ?? fieldSelectValue?.text ?? '',
|
||||
: fieldInitialValue?.value ?? fieldSelectValue?.label ?? '',
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@ -116,6 +116,6 @@ export type FieldCurrencyValue = {
|
||||
};
|
||||
export type FieldFullNameValue = { firstName: string; lastName: string };
|
||||
export type FieldProbabilityValue = number;
|
||||
export type FieldSelectValue = { color: ThemeColor; text: string };
|
||||
export type FieldSelectValue = { color: ThemeColor; label: string };
|
||||
|
||||
export type FieldRelationValue = EntityForSelect | null;
|
||||
|
||||
@ -5,7 +5,7 @@ import { mainColors, ThemeColor } from '@/ui/theme/constants/colors';
|
||||
const selectColors = Object.keys(mainColors) as [ThemeColor, ...ThemeColor[]];
|
||||
const selectValueSchema = z.object({
|
||||
color: z.enum(selectColors),
|
||||
text: z.string(),
|
||||
label: z.string(),
|
||||
});
|
||||
|
||||
export const isFieldSelectValue = (
|
||||
|
||||
Reference in New Issue
Block a user