@@ -8,6 +8,7 @@ import { usePopper } from "react-popper";
88import { PopperProps } from "cdm/ComponentsModel" ;
99import { CellContext } from "components/contexts/CellContext" ;
1010import CrossIcon from "components/img/CrossIcon" ;
11+ import { TableColumn } from "cdm/FolderModel" ;
1112
1213const PopperSelectPortal = ( popperProps : PopperProps ) => {
1314 const { dispatch, row, column, columns, note, intialState } = popperProps ;
@@ -24,6 +25,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
2425 // Selector popper state
2526 const [ domReady , setDomReady ] = useState ( false ) ;
2627
28+ const tableColumn = column . columnDef as TableColumn ;
2729 React . useEffect ( ( ) => {
2830 setDomReady ( true ) ;
2931 } ) ;
@@ -32,7 +34,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
3234 dispatch ( {
3335 type : ActionTypes . UPDATE_OPTION_CELL ,
3436 file : note . getFile ( ) ,
35- key : column . key ,
37+ key : tableColumn . key ,
3638 value : "" ,
3739 row : row ,
3840 columnId : column . id ,
@@ -50,7 +52,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
5052 dispatch ( {
5153 type : ActionTypes . UPDATE_OPTION_CELL ,
5254 file : note . getFile ( ) ,
53- key : column . key ,
55+ key : tableColumn . key ,
5456 value : option . label ,
5557 row : row ,
5658 columnId : column . id ,
@@ -78,10 +80,12 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
7880 }
7981 function addNewOption ( e : any ) {
8082 // check if option already exists
81- const alreadyExist = column . options . find ( ( option : { label : string } ) => {
82- if ( option . label === e . target . value ) {
83+ const alreadyExist = tableColumn . options . find (
84+ ( option : { label : string } ) => {
85+ if ( option . label === e . target . value ) {
86+ }
8387 }
84- } ) ;
88+ ) ;
8589 if ( ! alreadyExist ) {
8690 dispatch ( {
8791 type : ActionTypes . ADD_OPTION_TO_COLUMN ,
@@ -93,7 +97,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
9397 }
9498
9599 function getColor ( ) {
96- const match = column . options . find (
100+ const match = tableColumn . options . find (
97101 ( option : { label : string } ) => option . label === contextValue . value
98102 ) ;
99103 return ( match && match . backgroundColor ) || grey ( 200 ) ;
@@ -125,7 +129,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
125129 className = "d-flex flex-wrap-wrap"
126130 style = { { marginTop : "-0.5rem" } }
127131 >
128- { column . options . map ( ( option : any ) => (
132+ { tableColumn . options . map ( ( option : any ) => (
129133 < div
130134 key = { option . label }
131135 className = "cursor-pointer"
@@ -198,6 +202,7 @@ const PopperSelectPortal = (popperProps: PopperProps) => {
198202 ref = { setSelectRef }
199203 className = "cell-padding d-flex cursor-default align-items-center flex-1"
200204 onClick = { ( ) => setShowSelect ( true ) }
205+ style = { { width : column . getSize ( ) } }
201206 >
202207 { contextValue . value && (
203208 < Relationship
0 commit comments