B: Fix RSForm editor layout

This commit is contained in:
Ivan 2024-08-24 08:24:05 +03:00
parent f86d847d64
commit 07974e3760
3 changed files with 20 additions and 15 deletions

View File

@ -49,7 +49,7 @@ function ToolbarConstituenta({
const controller = useRSEdit(); const controller = useRSEdit();
return ( return (
<Overlay position='top-1 right-4' className='cc-icons sm:right-1/2 sm:translate-x-1/2'> <Overlay position='top-1 right-4' className='cc-icons md:right-1/2 md:translate-x-1/2 transition-all duration-500'>
{controller.schema && controller.schema?.oss.length > 0 ? ( {controller.schema && controller.schema?.oss.length > 0 ? (
<MiniSelectorOSS <MiniSelectorOSS
items={controller.schema.oss} items={controller.schema.oss}

View File

@ -17,6 +17,7 @@ interface TableSideConstituentsProps {
activeCst?: IConstituenta; activeCst?: IConstituenta;
onOpenEdit: (cstID: ConstituentaID) => void; onOpenEdit: (cstID: ConstituentaID) => void;
denseThreshold?: number; denseThreshold?: number;
autoScroll?: boolean;
maxHeight: string; maxHeight: string;
} }
@ -25,6 +26,7 @@ const columnHelper = createColumnHelper<IConstituenta>();
function TableSideConstituents({ function TableSideConstituents({
items, items,
activeCst, activeCst,
autoScroll = true,
onOpenEdit, onOpenEdit,
maxHeight, maxHeight,
denseThreshold = 9999 denseThreshold = 9999
@ -38,17 +40,19 @@ function TableSideConstituents({
if (!activeCst) { if (!activeCst) {
return; return;
} }
setTimeout(() => { if (autoScroll) {
const element = document.getElementById(`${prefixes.cst_side_table}${activeCst.alias}`); setTimeout(() => {
if (element) { const element = document.getElementById(`${prefixes.cst_side_table}${activeCst.alias}`);
element.scrollIntoView({ if (element) {
behavior: 'smooth', element.scrollIntoView({
block: 'center', behavior: 'smooth',
inline: 'end' block: 'center',
}); inline: 'end'
} });
}, PARAMETER.refreshTimeout); }
}, [activeCst]); }, PARAMETER.refreshTimeout);
}
}, [activeCst, autoScroll]);
useLayoutEffect(() => { useLayoutEffect(() => {
setColumnVisibility(prev => { setColumnVisibility(prev => {

View File

@ -46,6 +46,7 @@ function ViewConstituents({ expression, schema, activeCst, isBottom, onOpenEdit
items={filteredData} items={filteredData}
activeCst={activeCst} activeCst={activeCst}
onOpenEdit={onOpenEdit} onOpenEdit={onOpenEdit}
autoScroll={!isBottom}
denseThreshold={COLUMN_EXPRESSION_HIDE_THRESHOLD} denseThreshold={COLUMN_EXPRESSION_HIDE_THRESHOLD}
/> />
), ),
@ -55,10 +56,10 @@ function ViewConstituents({ expression, schema, activeCst, isBottom, onOpenEdit
return ( return (
<motion.div <motion.div
className={clsx( className={clsx(
'border overflow-visible', // prettier: split-lines 'border', // prettier: split-lines
{ {
'mt-[2.2rem] rounded-l-md rounded-r-none h-fit': !isBottom, 'mt-[2.2rem] rounded-l-md rounded-r-none h-fit overflow-visible': !isBottom,
'mt-3 mx-6 rounded-md md:w-[45.8rem]': isBottom 'mt-3 mx-6 rounded-md md:max-w-[45.8rem] overflow-hidden': isBottom
} }
)} )}
initial={{ ...animateSideView.initial }} initial={{ ...animateSideView.initial }}