From afe3ec0adb5b9763a131ec27b2e589e551dc7612 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Fri, 30 Aug 2024 09:58:31 +0300 Subject: [PATCH] M: Remove expression column from sideview --- .../TableSideConstituents.tsx | 44 ++----------------- .../ViewConstituents/ViewConstituents.tsx | 4 -- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/TableSideConstituents.tsx b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/TableSideConstituents.tsx index 4152e933..1bc903a4 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/TableSideConstituents.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/TableSideConstituents.tsx @@ -1,12 +1,11 @@ 'use client'; -import { useCallback, useLayoutEffect, useMemo, useState } from 'react'; +import { useCallback, useLayoutEffect, useMemo } from 'react'; import BadgeConstituenta from '@/components/info/BadgeConstituenta'; -import DataTable, { createColumnHelper, IConditionalStyle, VisibilityState } from '@/components/ui/DataTable'; +import DataTable, { createColumnHelper, IConditionalStyle } from '@/components/ui/DataTable'; import NoData from '@/components/ui/NoData'; import { useConceptOptions } from '@/context/ConceptOptionsContext'; -import useWindowSize from '@/hooks/useWindowSize'; import { ConstituentaID, IConstituenta } from '@/models/rsform'; import { isMockCst } from '@/models/rsformAPI'; import { PARAMETER, prefixes } from '@/utils/constants'; @@ -16,7 +15,6 @@ interface TableSideConstituentsProps { items: IConstituenta[]; activeCst?: IConstituenta; onOpenEdit: (cstID: ConstituentaID) => void; - denseThreshold?: number; autoScroll?: boolean; maxHeight: string; } @@ -28,13 +26,9 @@ function TableSideConstituents({ activeCst, autoScroll = true, onOpenEdit, - maxHeight, - denseThreshold = 9999 + maxHeight }: TableSideConstituentsProps) { const { colors } = useConceptOptions(); - const windowSize = useWindowSize(); - - const [columnVisibility, setColumnVisibility] = useState({ expression: true }); useLayoutEffect(() => { if (!activeCst) { @@ -54,17 +48,6 @@ function TableSideConstituents({ } }, [activeCst, autoScroll]); - useLayoutEffect(() => { - setColumnVisibility(prev => { - const newValue = (windowSize.width ?? 0) >= denseThreshold; - if (newValue === prev.expression) { - return prev; - } else { - return { expression: newValue }; - } - }); - }, [windowSize, denseThreshold]); - const handleRowClicked = useCallback( (cst: IConstituenta) => { if (!isMockCst(cst)) { @@ -103,25 +86,6 @@ function TableSideConstituents({ {props.getValue()} ) - }), - columnHelper.accessor('definition_formal', { - id: 'expression', - header: 'Выражение', - size: 2000, - minSize: 0, - maxSize: 2000, - enableHiding: true, - cell: props => ( -
- {props.getValue()} -
- ) }) ], [colors] @@ -162,8 +126,6 @@ function TableSideConstituents({ conditionalRowStyles={conditionalRowStyles} headPosition='0' enableHiding - columnVisibility={columnVisibility} - onColumnVisibilityChange={setColumnVisibility} noDataComponent={

Список конституент пуст

diff --git a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ViewConstituents.tsx b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ViewConstituents.tsx index 8ce5f480..a62075ca 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ViewConstituents.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/ViewConstituents/ViewConstituents.tsx @@ -14,9 +14,6 @@ import { animateSideView } from '@/styling/animations'; import ConstituentsSearch from './ConstituentsSearch'; import TableSideConstituents from './TableSideConstituents'; -// Window width cutoff for expression show -const COLUMN_EXPRESSION_HIDE_THRESHOLD = 1500; - // Window width cutoff for dense search bar const COLUMN_DENSE_SEARCH_THRESHOLD = 1100; @@ -47,7 +44,6 @@ function ViewConstituents({ expression, schema, activeCst, isBottom, onOpenEdit activeCst={activeCst} onOpenEdit={onOpenEdit} autoScroll={!isBottom} - denseThreshold={COLUMN_EXPRESSION_HIDE_THRESHOLD} /> ), [isBottom, filteredData, activeCst, onOpenEdit, calculateHeight, accessLevel]