diff --git a/src/component/BasicElements/CalibrationConditionsElement.tsx b/src/component/BasicElements/CalibrationConditionsElement.tsx index 5e5b1cf..c7894a8 100644 --- a/src/component/BasicElements/CalibrationConditionsElement.tsx +++ b/src/component/BasicElements/CalibrationConditionsElement.tsx @@ -11,6 +11,7 @@ import { SelectValue, } from '@/component/ui/select' import { ElementDefinition } from '@/entitiy/element/model/interface' +import { cn } from '@/lib/utils' import { AlertCircle, Check, @@ -255,8 +256,7 @@ function CalibrationCondInfo({ return ( <> - {/* Компактное отображение */} -
+
{fieldConfigs.map(({ key, icon: Icon, unit }) => (
@@ -268,19 +268,24 @@ function CalibrationCondInfo({
))}
- - {isOutdated && ( -
- )} + +
+ {isOutdated && ( +
+ )} + + +
{/* Модальное окно */} @@ -729,23 +734,20 @@ export const calibrationConditionsDefinition: ElementDefinition< }, Preview: ({ config }) => (
-
Предпросмотр
-
- true} - /> -
+ } + isOutdated={false} + onUpdate={async () => true} + />
), Render: ({ config, value, onChange }) => { diff --git a/src/component/DualSpreadsheet/DualSpreadsheet.tsx b/src/component/DualSpreadsheet/DualSpreadsheet.tsx index 18c0163..57f84e5 100644 --- a/src/component/DualSpreadsheet/DualSpreadsheet.tsx +++ b/src/component/DualSpreadsheet/DualSpreadsheet.tsx @@ -773,7 +773,7 @@ const DualSpreadsheet: FC = ({ const autoSaveOptions = useMemo( () => ({ templateId, - autoSaveDelay: 2000, + autoSaveDelay: 4000, enableAutoSave: enableAutoSave && userEdited, }), [templateId, enableAutoSave, userEdited] @@ -824,7 +824,6 @@ const DualSpreadsheet: FC = ({ if (fileData && Object.keys(fileData.data).length > 0) { finalBaseData = { [SHEET_NAMES.report]: fileData.data } setBaseFileData(finalBaseData) - // Сохраняем baseline, чтобы в листы попадали только пользовательские изменения setTemplateData(finalBaseData) } diff --git a/src/component/TemplateManager/ElementConstructor.tsx b/src/component/TemplateManager/ElementConstructor.tsx index 2b49660..0869707 100644 --- a/src/component/TemplateManager/ElementConstructor.tsx +++ b/src/component/TemplateManager/ElementConstructor.tsx @@ -3,11 +3,7 @@ import { getElementDefinition, } from '@/entitiy/element/model/interface' import { useToast } from '@/lib/hooks/useToast' -import { - autoArrangeElements, - findFreePosition, - generateDefaultLayout, -} from '@/lib/utils' +import { generateDefaultLayout } from '@/lib/utils' import { CellTarget, ElementType, @@ -591,15 +587,8 @@ export const ElementConstructor: React.FC = ({ } // Генерируем layout для нового элемента - const existingLayouts = elements.map(e => e.layout).filter(Boolean) const defaultLayout = generateDefaultLayout(elements.length) - const layout = findFreePosition( - defaultLayout, - existingLayouts as any[], - layoutSettings.gridSize - ) - // Используем targetCells из формы или генерируем через mapToCells let targetCells = formData.targetCells || [] if (!targetCells.length) { @@ -609,14 +598,14 @@ export const ElementConstructor: React.FC = ({ const newElement: TemplateElement = { id: Date.now().toString(), type: formData.type as ElementType, - name: formData.label?.toLowerCase().replace(/\s+/g, '_') || '', + name: formData.label || '', label: formData.label, targetCells, placeholder: formData.placeholder, required: formData.required, options: formData.options, order: elements.length, - layout, + layout: defaultLayout, } onElementAdd(newElement) @@ -666,21 +655,6 @@ export const ElementConstructor: React.FC = ({ resetForm() } - const handleAutoArrange = () => { - const arrangedElements = autoArrangeElements( - elements, - layoutSettings.gridSize - ) - - arrangedElements.forEach((element, index) => { - onElementUpdate(element.id, { - ...element, - layout: element.layout, - order: index, - }) - }) - } - const handleDeleteAndSelect = (elementId: string) => { onElementDelete(elementId) setEditingElement(null) @@ -697,7 +671,6 @@ export const ElementConstructor: React.FC = ({ setIsAddDialogOpen(true)} - onAutoArrange={handleAutoArrange} disabled={disabled} hasUnsavedChanges={hasUnsavedChanges} isSaving={isSaving} diff --git a/src/component/TemplateManager/HeaderBar.tsx b/src/component/TemplateManager/HeaderBar.tsx index 5f4c546..9890241 100644 --- a/src/component/TemplateManager/HeaderBar.tsx +++ b/src/component/TemplateManager/HeaderBar.tsx @@ -30,7 +30,7 @@ export const HeaderBar: React.FC = ({ template, onBack }) => {
-
= ({ element, value, onChange }) => { ) return ( -
+
{/* Показываем индикатор ячеек для всех элементов */} {element.targetCells && element.targetCells.length > 0 && ( -
-
- -
-
Целевые ячейки:
- {element.targetCells.map((cell, i) => ( -
- {cell.sheet}!{cell.cell} - {cell.displayName && ( - - ({cell.displayName}) - - )} -
- ))} -
+
+ +
+
Целевые ячейки:
+ {element.targetCells.map((cell, i) => ( +
+ {cell.sheet}!{cell.cell} + {cell.displayName && ( + + ({cell.displayName}) + + )} +
+ ))}
)} @@ -78,6 +76,7 @@ const ProtocolForm: FC = ({ template, onSave, onBack }) => { const [showSpreadsheet, setShowSpreadsheet] = useState(false) const engineRef = useRef(null) const toast = useToast() + const navigate = useNavigate() const handleFieldChange = (elementId: string, value: any) => { setFormData(prev => ({ @@ -266,7 +265,8 @@ const ProtocolForm: FC = ({ template, onSave, onBack }) => { return (
-
+
+ {/* Левая часть: кнопка назад и заголовок */}
-
+ {/* Кнопки справа */} +
+ + +
+ {/* Центрированные кнопки */} +
- diff --git a/src/widget/template/ui/TemplateCard.tsx b/src/widget/template/ui/TemplateCard.tsx index 6e80637..a0393db 100644 --- a/src/widget/template/ui/TemplateCard.tsx +++ b/src/widget/template/ui/TemplateCard.tsx @@ -23,8 +23,6 @@ const TemplateCard: React.FC = ({ }) => { const navigate = useNavigate() - // const isConfigured = - // template.elements.length > 0 && template.excelFile !== undefined const isConfigured = true // TODO: remove return ( @@ -37,12 +35,11 @@ const TemplateCard: React.FC = ({ : undefined } className={clsx( - 'group relative shadow-sm transition-all duration-200', selectionMode && 'hover:cursor-pointer', selectionMode && isSelected && 'border-2 border-primary ring-4 ring-primary/30 ring-offset-2', - 'hover:border-2 hover:border-primary hover:shadow-lg' + 'hover:border-2 hover:border-primary' )} > {selectionMode && ( @@ -98,6 +95,7 @@ const TemplateCard: React.FC = ({