import { Table, Plus, GripVertical, Trash2, X, Calculator, Sigma } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { Badge } from '@/components/ui/badge'; import { selectOptionsToText, textToSelectOptions } from '@/lib/fieldOptions'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import type { TabModule, TabModuleProps, TabConfigProps, FormTab, TableColumnDef } from './types'; import { registerTabModule } from './registry'; import { FormulaInput } from '@/components/FormulaInput'; import { FIELD_TYPE_DEFINITIONS } from '@shared/field-types'; import * as LucideIcons from 'lucide-react'; interface RegularTableTabContentProps extends TabModuleProps { dataTables?: Array<{ id: number; name: string; columns?: Array<{ name: string }> }>; onAddColumn: (tabIndex: number) => void; onUpdateColumn: (tabIndex: number, colIndex: number, updates: Partial) => void; onRemoveColumn: (tabIndex: number, colIndex: number) => void; } function RegularTableTabContent({ tab, tabIndex, allFields, dataTables, onAddColumn, onUpdateColumn, onRemoveColumn }: RegularTableTabContentProps) { const columns = tab.tableColumns || []; const linkedForms = allFields .filter(f => f.type === 'task' && f.linkedFormId) .map(f => ({ id: f.linkedFormId!, name: f.code })); if (columns.length === 0) { return (
Нет колонок. Нажмите "Колонка" чтобы добавить.
); } return (
{columns.map((col, colIndex) => (
onUpdateColumn(tabIndex, colIndex, { name: e.target.value })} placeholder="Название колонки" className="h-8 flex-1" data-testid={`input-column-name-${tabIndex}-${colIndex}`} /> onUpdateColumn(tabIndex, colIndex, { width: parseInt(e.target.value) || 100 })} className="h-8 w-20" placeholder="Ширина" data-testid={`input-column-width-${tabIndex}-${colIndex}`} />
{col.type === 'select' && (