@@ -4,8 +4,7 @@ import 'reactflow/dist/style.css';
4
4
import TableNodeColumn from './TableNodeColumn' ;
5
5
import { FaRegPlusSquare } from 'react-icons/fa' ;
6
6
import useSettingsStore from '../../store/settingsStore' ;
7
- import { DataNodeData } from '@/Types'
8
-
7
+ import { DataNodeData } from '@/Types' ;
9
8
10
9
export default function TableNode ( { data } ) {
11
10
const tableName = data . table [ 0 ] ;
@@ -18,7 +17,7 @@ export default function TableNode({ data }) {
18
17
// schema edges to match source and target handles of edges to handle id
19
18
const tableHandles = [ ] ;
20
19
for ( let i = 0 ; i < data . edges . length ; i ++ ) {
21
- if ( data . edges [ i ] . source === tableName ) {
20
+ if ( data . edges [ i ] . source === tableName ) {
22
21
//make handle placement dynamic, we need to know the column of our source
23
22
let columnNumberSource =
24
23
columnData . findIndex ( ( obj ) => obj . Name === data . edges [ i ] . sourceHandle ) + 1 ;
@@ -31,7 +30,7 @@ export default function TableNode({ data }) {
31
30
id = { data . edges [ i ] . sourceHandle }
32
31
style = { {
33
32
background : 'transparent' ,
34
- top : 67 + ( ( columnNumberSource - 1 ) * 24 ) ,
33
+ top : 67 + ( columnNumberSource - 1 ) * 24 ,
35
34
// bottom: 'auto',
36
35
} }
37
36
/>
@@ -51,7 +50,7 @@ export default function TableNode({ data }) {
51
50
id = { data . edges [ i ] . targetHandle }
52
51
style = { {
53
52
background : 'transparent' ,
54
- top : 67 + ( ( columnNumberTarget - 1 ) * 24 ) ,
53
+ top : 67 + ( columnNumberTarget - 1 ) * 24 ,
55
54
// bottom: 'auto',
56
55
} }
57
56
/>
@@ -63,85 +62,84 @@ export default function TableNode({ data }) {
63
62
return (
64
63
< >
65
64
< div className = "table-node transition-colors duration-500" key = { tableName } >
66
- < div className = "flex items-center justify-between table-header relative bg-[#075985] dark:bg-opacity-75" >
65
+ < div className = "table-header relative flex items-center justify-between bg-[#075985] dark:bg-opacity-75" >
67
66
{ /* <NodeResizer minWidth={100} minHeight={30} /> */ }
68
67
{ tableHandles }
69
68
< div >
70
69
< label
71
- htmlFor = "text"
72
- className = "bg-[#075985] text-white text-stroke-black dark:bg-opacity-0"
73
- style = { {
74
- ' marginLeft' : '0px'
75
- } }
76
- >
77
- { tableName }
78
- </ label >
79
- </ div >
80
- < div className = "addRowBtn ml-3 mb-1.5" >
81
- < button
82
- className = "add-field transition-colors duration-500 hover:text-[#618fa7] dark:text-[#fbf3de] dark:hover:text-[#618fa7] bg-transparent "
83
- onClick = { ( ) => setInputModalState ( true , 'column' , tableName ) }
84
- >
85
- < FaRegPlusSquare size = { 20 } className = "text-white" />
86
- </ button >
87
- </ div >
88
- </ div >
70
+ htmlFor = "text"
71
+ className = "text-stroke-black bg-[#075985] text-white dark:bg-opacity-0"
72
+ style = { {
73
+ marginLeft : '0px' ,
74
+ } }
75
+ >
76
+ { tableName }
77
+ </ label >
78
+ </ div >
79
+ < div className = "addRowBtn mb-1.5 ml-3 " >
80
+ < button
81
+ className = "add-field bg-transparent transition-colors duration-500 hover:text-[#618fa7] dark:text-[#fbf3de] dark:hover:text-[#618fa7]"
82
+ onClick = { ( ) => setInputModalState ( true , 'column' , tableName ) }
83
+ >
84
+ < FaRegPlusSquare size = { 20 } className = "text-white" />
85
+ </ button >
86
+ </ div >
87
+ </ div >
89
88
90
- < div
91
- style = { { maxHeight : "325px" , maxWidth : "600px" } }
92
- className = "nowheel overflow-auto"
93
- >
94
- < div className = "table-bg transition-colors duration-500 dark:bg-slate-700" >
95
- < table className = "transition-colors duration-500 dark:text-[#fbf3de]" >
96
- < thead >
97
- < tr className = "head-column" >
98
- < th
99
- scope = "col"
100
- className = "transition-colors duration-500 dark:text-[#fbf3de]"
101
- >
102
- < b > Column</ b >
103
- </ th >
104
- < th
105
- scope = "col"
106
- className = "transition-colors duration-500 dark:text-[#fbf3de]"
107
- >
108
- < b > Type</ b >
109
- </ th >
110
- < th
111
- scope = "col"
112
- className = "transition-colors duration-500 dark:text-[#fbf3de]"
113
- >
114
- < b > Constraints</ b >
115
- </ th >
116
- < th
117
- scope = "col"
118
- className = "transition-colors duration-500 dark:text-[#fbf3de]"
119
- >
120
- < b > PK</ b >
121
- </ th >
122
- < th
123
- scope = "col"
124
- className = "transition-colors duration-500 dark:text-[#fbf3de]"
125
- >
126
- < b > FK</ b >
127
- </ th >
128
- </ tr >
129
- </ thead >
130
- < tbody >
131
- { /* generates dynamic columns */ }
132
- { columnData . map ( ( column , index ) => (
133
- < TableNodeColumn
134
- column = { column }
135
- key = { `${ tableName } -column${ index } ` }
136
- id = { `${ tableName } -column${ index } ` }
137
- />
138
- ) ) }
139
- </ tbody >
140
- </ table >
141
- </ div >
89
+ < div
90
+ style = { { maxHeight : '325px' , maxWidth : '600px' } }
91
+ className = "nowheel overflow-auto"
92
+ >
93
+ < div className = "table-bg transition-colors duration-500 dark:bg-slate-700" >
94
+ < table className = "transition-colors duration-500 dark:text-[#fbf3de]" >
95
+ < thead >
96
+ < tr className = "head-column" >
97
+ < th
98
+ scope = "col"
99
+ className = "transition-colors duration-500 dark:text-[#fbf3de]"
100
+ >
101
+ < b > Column</ b >
102
+ </ th >
103
+ < th
104
+ scope = "col"
105
+ className = "transition-colors duration-500 dark:text-[#fbf3de]"
106
+ >
107
+ < b > Type</ b >
108
+ </ th >
109
+ < th
110
+ scope = "col"
111
+ className = "transition-colors duration-500 dark:text-[#fbf3de]"
112
+ >
113
+ < b > Constraints</ b >
114
+ </ th >
115
+ < th
116
+ scope = "col"
117
+ className = "transition-colors duration-500 dark:text-[#fbf3de]"
118
+ >
119
+ < b > PK</ b >
120
+ </ th >
121
+ < th
122
+ scope = "col"
123
+ className = "transition-colors duration-500 dark:text-[#fbf3de]"
124
+ >
125
+ < b > FK</ b >
126
+ </ th >
127
+ </ tr >
128
+ </ thead >
129
+ < tbody >
130
+ { /* generates dynamic columns */ }
131
+ { columnData . map ( ( column , index ) => (
132
+ < TableNodeColumn
133
+ column = { column }
134
+ key = { `${ tableName } -column${ index } ` }
135
+ id = { `${ tableName } -column${ index } ` }
136
+ />
137
+ ) ) }
138
+ </ tbody >
139
+ </ table >
140
+ </ div >
141
+ </ div >
142
142
</ div >
143
- </ div >
144
143
</ >
145
144
) ;
146
145
}
147
-
0 commit comments