fix(ContractNumberField): wider select, prevent text truncation
- compact: max-w-[180px] → w-auto (fit content) - SelectTrigger: + w-auto min-w-0 (shrink to fit) - Preview: + whitespace-nowrap, w-auto - flex-wrap → flex-nowrap (prevent line breaks) - Switch: scale-75 → scale-[0.65] (more compact) - Fixes '#8 ООО...' truncation and label wrapping
This commit is contained in:
@@ -143,14 +143,14 @@ export default function ContractNumberField({
|
|||||||
const isGenerated = !!(parsed.mode === 'mine' && parsed.value && parsed.value !== '');
|
const isGenerated = !!(parsed.mode === 'mine' && parsed.value && parsed.value !== '');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(compact ? 'flex items-center gap-2 flex-wrap' : 'space-y-2')}>
|
<div className={cn(compact ? 'flex items-center gap-1.5 flex-nowrap' : 'space-y-2')}>
|
||||||
<div className="flex items-center space-x-2 shrink-0">
|
<div className="flex items-center space-x-1.5 shrink-0">
|
||||||
<Switch
|
<Switch
|
||||||
id={`contract-number-mode-${fieldId}`}
|
id={`contract-number-mode-${fieldId}`}
|
||||||
checked={mode === 'mine'}
|
checked={mode === 'mine'}
|
||||||
onCheckedChange={(checked: boolean) => handleModeChange(checked ? 'mine' : 'customer')}
|
onCheckedChange={(checked: boolean) => handleModeChange(checked ? 'mine' : 'customer')}
|
||||||
disabled={disabled || isGenerated}
|
disabled={disabled || isGenerated}
|
||||||
className={compact ? 'scale-75' : ''}
|
className={compact ? 'scale-[0.65]' : ''}
|
||||||
/>
|
/>
|
||||||
{!compact && (
|
{!compact && (
|
||||||
<Label htmlFor={`contract-number-mode-${fieldId}`} className="cursor-pointer text-xs">
|
<Label htmlFor={`contract-number-mode-${fieldId}`} className="cursor-pointer text-xs">
|
||||||
@@ -159,13 +159,13 @@ export default function ContractNumberField({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={cn('flex-1', compact ? 'min-w-[120px] max-w-[180px]' : 'min-w-[160px] w-full')}>
|
<div className={cn(compact ? 'w-auto min-w-[100px]' : 'flex-1 min-w-[160px] w-full')}>
|
||||||
<Select
|
<Select
|
||||||
value={legalEntityTaskId?.toString() || ''}
|
value={legalEntityTaskId?.toString() || ''}
|
||||||
onValueChange={handleLegalEntityChange}
|
onValueChange={handleLegalEntityChange}
|
||||||
disabled={disabled || isGenerated}
|
disabled={disabled || isGenerated}
|
||||||
>
|
>
|
||||||
<SelectTrigger className={cn(compact && 'h-7 text-xs px-2')}>
|
<SelectTrigger className={cn(compact && 'h-7 text-xs px-2 min-w-0 w-auto')}>
|
||||||
<SelectValue placeholder={compact ? 'Юрлицо' : 'Выберите юрлицо'} />
|
<SelectValue placeholder={compact ? 'Юрлицо' : 'Выберите юрлицо'} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
@@ -185,12 +185,12 @@ export default function ContractNumberField({
|
|||||||
onChange={(e) => handleCustomerChange(e.target.value)}
|
onChange={(e) => handleCustomerChange(e.target.value)}
|
||||||
placeholder={compact ? 'Шифр' : 'Введите шифр заказчика'}
|
placeholder={compact ? 'Шифр' : 'Введите шифр заказчика'}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={cn('flex-1', compact ? 'h-7 text-xs px-2 min-w-[80px] max-w-[160px]' : 'min-w-[160px]')}
|
className={cn('flex-1', compact ? 'h-7 text-xs px-2 min-w-[60px] w-auto' : 'min-w-[160px]')}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className={cn('relative flex-1', compact ? 'min-w-[100px] max-w-[180px]' : 'min-w-[160px]')}>
|
<div className={cn('relative', compact ? 'min-w-[80px] w-auto' : 'flex-1 min-w-[160px]')}>
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'flex items-center gap-1.5 rounded-md border border-input bg-muted/30',
|
'flex items-center gap-1.5 rounded-md border border-input bg-muted/30 whitespace-nowrap',
|
||||||
compact ? 'px-2 h-7' : 'px-3 py-2'
|
compact ? 'px-2 h-7' : 'px-3 py-2'
|
||||||
)}>
|
)}>
|
||||||
<FileSignature className="h-4 w-4 text-muted-foreground shrink-0" />
|
<FileSignature className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||||
|
|||||||
Reference in New Issue
Block a user