File tree Expand file tree Collapse file tree 3 files changed +38
-8
lines changed
packages/ui/src/elements/TreeView/NestedSectionsTable Expand file tree Collapse file tree 3 files changed +38
-8
lines changed Original file line number Diff line number Diff line change 1414 z-index : 1 ;
1515 }
1616
17- & --on-split {
18- bottom : 0 ;
19- transform : translateY (50% );
17+ & --on-split-bottom ,
18+ & --on-split-top {
2019 min-width : unset ;
2120
2221 & .is-dragging.is-over {
2625 }
2726 }
2827 }
28+
29+ & --on-split-bottom {
30+ bottom : 0 ;
31+ transform : translateY (50% );
32+ }
33+
34+ & --on-split-top {
35+ top : 0 ;
36+ transform : translateY (-50% );
37+ }
2938}
3039
3140.row-drop-area__split-marker {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ const baseClass = 'row-drop-area'
1010const DEFAULT_SEGMENT_WIDTH = 30
1111const THROTTLE_MS = 16
1212
13- type Placement = 'middle' | 'split'
13+ type Placement = 'middle' | 'split-bottom' | 'split-top '
1414
1515export type RowDropAreaProps = {
1616 disabled ?: boolean
@@ -30,7 +30,7 @@ export const RowDropArea = ({
3030 dropContextName,
3131 isDragging = false ,
3232 onHover,
33- placement = 'split' ,
33+ placement = 'split-bottom ' ,
3434 segmentWidth = DEFAULT_SEGMENT_WIDTH ,
3535 style,
3636 targetItems = [ ] ,
@@ -83,7 +83,7 @@ export const RowDropArea = ({
8383 width : '100%' ,
8484 } }
8585 >
86- { placement === 'split' && (
86+ { ( placement === 'split-bottom' || placement === 'split-top' ) && (
8787 < div
8888 className = { `${ baseClass } __split-marker` }
8989 style = { {
Original file line number Diff line number Diff line change @@ -387,6 +387,27 @@ export const DivTableSection: React.FC<DivTableSectionProps> = ({
387387 ) ,
388388 ) }
389389 < div >
390+ { /* Add split-top drop area for first root-level row */ }
391+ { level === 0 && sectionRowIndex === 0 && (
392+ < RowDropArea
393+ disabled = { isInvalidTarget }
394+ dropContextName = { dropContextName }
395+ isDragging = { isDragging }
396+ onHover = { ( data ) => {
397+ onDroppableHover ( { ...data , hoveredRowID : rowItem . rowID } )
398+ } }
399+ placement = "split-top"
400+ segmentWidth = { segmentWidth }
401+ style = { {
402+ left : 0 ,
403+ width : '100%' ,
404+ } }
405+ targetItems = { [ null ] }
406+ xDragOffset = { firstCellXOffset + firstCellWidth + 28 }
407+ xSplitOffset = { `calc(${ firstCellWidth + 28 } px + var(--cell-inline-padding-start))` }
408+ />
409+ ) }
410+ { /* Add row-drop-area on row */ }
390411 < RowDropArea
391412 disabled = { isInvalidTarget }
392413 dropContextName = { dropContextName }
@@ -399,15 +420,15 @@ export const DivTableSection: React.FC<DivTableSectionProps> = ({
399420 style = { { left : 0 , width : '100%' } }
400421 targetItems = { [ rowItem ] }
401422 />
402-
423+ { /* Add split-bottom drop area on row */ }
403424 < RowDropArea
404425 disabled = { isInvalidTarget }
405426 dropContextName = { dropContextName }
406427 isDragging = { isDragging }
407428 onHover = { ( data ) => {
408429 onDroppableHover ( { ...data , hoveredRowID : rowItem . rowID } )
409430 } }
410- placement = "split"
431+ placement = "split-bottom "
411432 segmentWidth = { segmentWidth }
412433 style = { {
413434 left : 0 ,
You can’t perform that action at this time.
0 commit comments