@@ -10,7 +10,7 @@ import {
1010 isNotNil ,
1111 truncate ,
1212} from '@/utils/index'
13- import { EnumSide , toID , type Side } from './types'
13+ import { toID , type PartialColumnHandleId , type Side } from './types'
1414import { NoSymbolIcon } from '@heroicons/react/24/solid'
1515import { ClockIcon , ExclamationCircleIcon } from '@heroicons/react/24/outline'
1616import clsx from 'clsx'
@@ -38,7 +38,7 @@ export function ModelColumns({
3838 columns,
3939 disabled,
4040 className,
41- limit = 5 ,
41+ limit,
4242 withHandles = false ,
4343 withDescription = true ,
4444 maxHeight = '50vh' ,
@@ -47,7 +47,7 @@ export function ModelColumns({
4747 columns : Column [ ]
4848 disabled ?: boolean
4949 className ?: string
50- limit ? : number
50+ limit : number
5151 withHandles ?: boolean
5252 withDescription ?: boolean
5353 maxHeight ?: string
@@ -125,7 +125,7 @@ export function ModelColumns({
125125 }
126126
127127 const isSelectManually = useCallback (
128- function isSelectManually ( columnName : string ) : boolean {
128+ function isSelectManually ( columnName : ColumnName ) : boolean {
129129 if ( isNil ( manuallySelectedColumn ) ) return false
130130
131131 const [ selectedModel , selectedColumn ] = manuallySelectedColumn
@@ -138,12 +138,10 @@ export function ModelColumns({
138138 )
139139
140140 const removeEdges = useCallback (
141- function removeEdges ( columnId : string ) : void {
141+ function removeEdges ( columnId : PartialColumnHandleId ) : void {
142142 const visited = new Set < string > ( )
143143
144- removeActiveEdges (
145- walk ( columnId , EnumSide . Left ) . concat ( walk ( columnId , EnumSide . Right ) ) ,
146- )
144+ removeActiveEdges ( walk ( columnId , 'left' ) . concat ( walk ( columnId , 'right' ) ) )
147145
148146 if ( connections . size === 0 && isNotNil ( lineageCache ) ) {
149147 setLineage ( lineageCache )
@@ -164,12 +162,12 @@ export function ModelColumns({
164162 return edges
165163 . map ( edge =>
166164 [
167- side === EnumSide . Left
168- ? [ toID ( EnumSide . Left , id ) , toID ( EnumSide . Right , edge ) ]
169- : [ toID ( EnumSide . Left , edge ) , toID ( EnumSide . Right , id ) ] ,
165+ side === 'left'
166+ ? [ toID ( 'left' , id ) , toID ( 'right' , edge ) ]
167+ : [ toID ( 'left' , edge ) , toID ( 'right' , id ) ] ,
170168 ] . concat ( walk ( edge , side ) ) ,
171169 )
172- . flat ( ) as Array < [ string , string ] >
170+ . flat ( ) as Array < [ PartialColumnHandleId , PartialColumnHandleId ] >
173171 }
174172 } ,
175173 [ removeActiveEdges , connections ] ,
@@ -324,8 +322,8 @@ function ModelColumn({
324322 withHandles = false ,
325323 withDescription = true ,
326324} : {
327- id : string
328- nodeId : string
325+ id : PartialColumnHandleId
326+ nodeId : ModelEncodedFQN
329327 column : Column
330328 disabled ?: boolean
331329 isActive ?: boolean
@@ -337,7 +335,7 @@ function ModelColumn({
337335 updateColumnLineage : (
338336 lineage : ColumnLineageApiLineageModelNameColumnNameGet200 ,
339337 ) => void
340- removeEdges : ( columnId : string ) => void
338+ removeEdges : ( columnId : PartialColumnHandleId ) => void
341339 selectManually ?: React . Dispatch <
342340 React . SetStateAction <
343341 [ ModelSQLMeshModel < InitialSQLMeshModel > , Column ] | undefined
@@ -454,8 +452,8 @@ function ColumnHandles({
454452 children,
455453 className,
456454} : {
457- nodeId : string
458- id : string
455+ nodeId : ModelEncodedFQN
456+ id : PartialColumnHandleId
459457 children : React . ReactNode
460458 className ?: string
461459 hasLeft ?: boolean
@@ -482,7 +480,7 @@ function ColumnHandles({
482480 { hasLeft && (
483481 < Handle
484482 type = "target"
485- id = { toID ( EnumSide . Left , id ) }
483+ id = { toID ( 'left' , id ) }
486484 position = { Position . Left }
487485 isConnectable = { false }
488486 className = "w-2 h-2 rounded-full"
@@ -492,7 +490,7 @@ function ColumnHandles({
492490 { hasRight && (
493491 < Handle
494492 type = "source"
495- id = { toID ( EnumSide . Right , id ) }
493+ id = { toID ( 'right' , id ) }
496494 position = { Position . Right }
497495 isConnectable = { false }
498496 className = "w-2 h-2 rounded-full"
@@ -510,19 +508,13 @@ function ColumnDisplay({
510508 disabled = false ,
511509 withDescription = true ,
512510} : {
513- columnName : string
511+ columnName : ColumnName
514512 columnType : string
515513 columnDescription ?: ColumnDescription
516514 disabled ?: boolean
517515 withDescription ?: boolean
518516 className ?: string
519517} ) : JSX . Element {
520- let decodedColumnName = columnName
521-
522- try {
523- decodedColumnName = decodeURI ( columnName )
524- } catch { }
525-
526518 return (
527519 < div
528520 className = { clsx (
@@ -533,7 +525,7 @@ function ColumnDisplay({
533525 >
534526 < div className = "w-full flex justify-between items-center" >
535527 < span
536- title = { decodedColumnName }
528+ title = { columnName }
537529 className = { clsx ( 'flex items-center' , disabled && 'opacity-50' ) }
538530 >
539531 { disabled && (
@@ -542,7 +534,7 @@ function ColumnDisplay({
542534 className = "w-3 h-3 mr-2"
543535 />
544536 ) }
545- { truncate ( decodedColumnName , 50 , 20 ) }
537+ { truncate ( columnName , 50 , 20 ) }
546538 </ span >
547539 < span
548540 title = { columnType }
0 commit comments