From dc667092b34953fc81f3556f4e2c6255d2f8674c Mon Sep 17 00:00:00 2001 From: tlartem Date: Mon, 28 Jul 2025 09:35:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=B0=D0=BB=D0=BE=D1=87=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=B8=D0=BD=D0=BF=D1=83=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +- .../components/CellRenderer.tsx | 13 +- .../TemplateManager/ElementConstructor.tsx | 3 +- .../model/implementations/ButtonGroup.tsx | 6 +- .../model/implementations/SelectElement.tsx | 42 +-- .../StandardsElement/definition.tsx | 6 +- .../model/implementations/TextElement.tsx | 167 +++++++++- .../VerificationConditionsRender.tsx | 295 +++++++++--------- .../VerificationConditionsElement/types.ts | 2 + src/entitiy/element/ui/cellsBadge.tsx | 33 ++ src/page/ProtocolCreation/Page.tsx | 30 +- yarn.lock | 10 + 12 files changed, 399 insertions(+), 212 deletions(-) create mode 100644 src/entitiy/element/ui/cellsBadge.tsx diff --git a/package.json b/package.json index d7a0895..fd8ef7a 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@types/lodash.isequal": "^4.5.8", "@types/react-grid-layout": "^1.3.5", "@types/react-window": "^1.8.8", + "@types/uuid": "^10.0.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "date-fns": "^4.1.0", @@ -50,7 +51,8 @@ "redux": "^4.2.1", "tailwind-merge": "^3.3.1", "tailwindcss-animate": "^1.0.7", - "use-debounce": "^10.0.5" + "use-debounce": "^10.0.5", + "uuid": "^11.1.0" }, "devDependencies": { "@types/node": "^24.0.15", diff --git a/src/component/DualSpreadsheet/components/CellRenderer.tsx b/src/component/DualSpreadsheet/components/CellRenderer.tsx index ee9257f..724a3ee 100644 --- a/src/component/DualSpreadsheet/components/CellRenderer.tsx +++ b/src/component/DualSpreadsheet/components/CellRenderer.tsx @@ -123,13 +123,14 @@ export const CellRenderer = ({ : undefined // Проверяем, является ли ячейка скопированной - const isCopied = + const isCopied = Boolean( copiedCells && - copiedCells.sourceSheet === sheetType && - copiedCells.data.some( - cell => cell.row === rowIndex && cell.col === columnIndex - ) - const isCut = isCopied && copiedCells?.isCut + copiedCells.sourceSheet === sheetType && + copiedCells.data.some( + cell => cell.row === rowIndex && cell.col === columnIndex + ) + ) + const isCut = Boolean(isCopied && copiedCells?.isCut) return ( = ({ const newElement: TemplateElement = { ...formData, // Копируем все поля из formData, включая специфичные для элемента - id: Date.now().toString(), + id: uuidv4(), type: formData.type as ElementType, name: formData.label || '', label: formData.label, diff --git a/src/entitiy/element/model/implementations/ButtonGroup.tsx b/src/entitiy/element/model/implementations/ButtonGroup.tsx index e3a3854..df3bed8 100644 --- a/src/entitiy/element/model/implementations/ButtonGroup.tsx +++ b/src/entitiy/element/model/implementations/ButtonGroup.tsx @@ -1,6 +1,7 @@ import { Button } from '@/component/ui/button' import { Input } from '@/component/ui/input' import { ElementDefinition } from '@/entitiy/element/model/interface' +import { CellsBadge } from '@/entitiy/element/ui/cellsBadge' import { ElementOption } from '@/type/template' import { Plus, Square, Trash2 } from 'lucide-react' @@ -194,7 +195,10 @@ export const buttonGroupDefinition: ElementDefinition< ), Render: ({ config, value, onChange }) => ( -
+
+ {/* Бейдж ячеек */} + + {config.name && (