@@ -116,20 +116,15 @@ export const ConceptCard: FC<ConceptCardProps> = function ConceptCard({ field })
116
116
} ) ,
117
117
} ) ) ;
118
118
119
- let notInAnyTable = tables . some ( t => t . names . includes ( field . name ) ) ;
120
-
121
119
let notInFocusedTable : boolean ;
122
120
if ( field . source == "derived" ) {
123
121
let parentConceptNames = ( field . transform as ConceptTransformation )
124
122
. parentIDs . map ( ( parentID ) => conceptShelfItems . find ( c => c . id == parentID ) as FieldItem ) . map ( f => f . name ) ;
125
- console . log ( parentConceptNames )
126
123
notInFocusedTable = parentConceptNames . some ( name => ! focusedChartRefTable ?. names . includes ( name ) ) ;
127
124
} else {
128
125
notInFocusedTable = ! focusedChartRefTable ?. names . includes ( field . name ) ;
129
126
}
130
127
131
-
132
-
133
128
let opacity = isDragging ? 0.3 :( notInFocusedTable ? 0.65 : 1 ) ;
134
129
let fontStyle = "inherit" ;
135
130
let border = "hidden" ;
@@ -177,21 +172,6 @@ export const ConceptCard: FC<ConceptCardProps> = function ConceptCard({ field })
177
172
//deleteOption
178
173
]
179
174
180
- let exampleToComponent = ( values : any [ ] , exampleSize : number , label ?: string ) => {
181
- let examples = values . slice ( 0 , values . length > exampleSize ? exampleSize : values . length ) ;
182
- let incomplete = examples . length < values . length ;
183
-
184
- return (
185
- values . length == 0 ? "" : ( < Typography className = "draggable-card-example-values" key = { examples . toString ( ) }
186
- sx = { { fontSize : "inherit" , textOverflow : "ellipsis" , overflow : "hidden" , whiteSpace : "nowrap" } } >
187
- { label ? < Typography variant = "body2" sx = { { fontSize : 14 } } >
188
- { label } :
189
- </ Typography > : "" }
190
- { examples . map ( ( v : any ) => String ( v ) ) . join ( ", " ) } { incomplete ? "..." : "" }
191
- </ Typography > )
192
- ) ;
193
- }
194
-
195
175
const editModeCard = (
196
176
< CardContent className = "draggable-card-body-edit-mode" >
197
177
{ field . source == "derived" ? < DerivedConceptForm concept = { field } handleUpdateConcept = { handleUpdateConcept }
@@ -398,7 +378,6 @@ export const CustomConceptForm: FC<ConceptFormProps> = function CustomConceptFor
398
378
)
399
379
400
380
let cardTopComponents = undefined ;
401
- let cardBottomComponents = undefined ;
402
381
403
382
let childrenConceptIDs = [ concept . id ] ;
404
383
while ( true ) {
@@ -415,43 +394,6 @@ export const CustomConceptForm: FC<ConceptFormProps> = function CustomConceptFor
415
394
cardTopComponents = [
416
395
nameField ,
417
396
typeField ,
418
- // <Tooltip key="prompt-expand" title="Provide additional prompt to explain the concept">
419
- // <IconButton
420
- // key="prompt-expand"
421
- // color="primary" sx={{
422
- // margin: "auto"
423
- // }}
424
- // size="small" onClick={() => { setDescOptOpen(!descOptOpen); }}>
425
- // <ExpandCircleDownIcon sx={{
426
- // transform: descOptOpen ? "rotate(180deg)" : "rotate(0)",
427
- // transitionProperty: "transform",
428
- // fontSize: 16,
429
- // transitionTimingFunction: "ease-in-out",
430
- // transitionDuration: "0.1s"
431
- // }} />
432
- // </IconButton>
433
- // </Tooltip>
434
- ]
435
-
436
- cardBottomComponents = [
437
- < Box key = "codearea-container" width = "100%" >
438
- { /*descOptOpen ? <TextField fullWidth value={description} key={`input-description`} onChange={(event: any) => { setDescription(event.target.value) }}
439
- multiline variant="standard" label={"Additional prompt to explain the concept (optional)"} /> : ""*/ }
440
- { /* <Autocomplete
441
- id="free-solo-demo"
442
- freeSolo
443
- size="small"
444
- color="primary"
445
- value={description}
446
- onChange={(event: any, newValue: any | null) => { setDescription(newValue || ""); }}
447
- sx={{ flex: 1, "& .MuiAutocomplete-option": { fontSize: '12px' } }}
448
- options={[]}
449
- renderOption={(params, option) => <Typography {...params} style={{ fontSize: "12px" }}>{option}</Typography> }
450
- renderInput={(params) => {
451
- return
452
- }}
453
- /> */ }
454
- </ Box >
455
397
]
456
398
457
399
const checkCustomConceptDiff = ( ) => {
@@ -473,7 +415,6 @@ export const CustomConceptForm: FC<ConceptFormProps> = function CustomConceptFor
473
415
< Box sx = { { overflowX : "clip" , display : "flex" , flexDirection : "row" , justifyContent : "flex-start" , alignItems : "baseline" } } >
474
416
{ cardTopComponents }
475
417
</ Box >
476
- { cardBottomComponents }
477
418
< ButtonGroup size = "small" sx = { { "& button" : { textTransform : "none" , padding : "2px 4px" , marginLeft : "4px" } , flexGrow : 1 , justifyContent : "right" } } >
478
419
< IconButton size = "small"
479
420
color = "primary" aria-label = "Delete" component = "span"
@@ -603,6 +544,11 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
603
544
childrenConceptIDs = [ ...childrenConceptIDs , ...newChildrens ] ;
604
545
}
605
546
547
+ // this might be a hack, but it works
548
+ // the first parent is the concept that the user initially clicks to create the derived concept, thus its tableRef is the affiliated table
549
+ // since this locks out other tables to be used as parents, the affiliated table is an invariant for tables created here
550
+ let affiliatedTableId = conceptShelfItems . find ( f => f . id == conceptTransform . parentIDs [ 0 ] ) ?. tableRef ;
551
+
606
552
cardTopComponents = [
607
553
nameField ,
608
554
< FormControl fullWidth key = "derived-card-control" sx = { { minWidth : 120 } } size = "small" >
@@ -618,8 +564,6 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
618
564
renderValue = { ( selected ) =>
619
565
< Typography key = { selected [ 0 ] } sx = { { whiteSpace : "normal" , fontSize : "inherit" } } >
620
566
{ selected . map ( conceptID => {
621
- console . log ( conceptID )
622
- console . log ( conceptShelfItems . find ( f => f . id == conceptID ) ?. source )
623
567
let chipColor = conceptShelfItems . find ( f => f . id == conceptID ) ?. source == "original" ? theme . palette . primary . light : theme . palette . custom . main ;
624
568
return < Chip
625
569
key = { conceptID }
@@ -640,10 +584,8 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
640
584
typeof value === "string" ? setTransformParentIDs ( [ value ] ) : setTransformParentIDs ( value ) ;
641
585
} }
642
586
>
643
- { conceptShelfItems . filter ( ( t ) => t . name != "" ) . map ( ( t , i ) => (
587
+ { conceptShelfItems . filter ( ( t ) => t . name != "" && t . tableRef == affiliatedTableId ) . map ( ( t , i ) => (
644
588
< MenuItem value = { t . id } key = { `${ concept . id } -${ t . id } ` } sx = { { fontSize : 12 , marginLeft : "0px" } } disabled = { childrenConceptIDs . includes ( t . id ) } >
645
- { /* <Checkbox size="small" checked={transformParentIDs.indexOf(t.id) > -1} />
646
- <ListItemText sx={{fontSize: 12}} primary={t.name} /> */ }
647
589
{ < Checkbox sx = { { padding : 0.5 } } size = "small" checked = { transformParentIDs . indexOf ( t . id ) > - 1 } /> }
648
590
{ t . name }
649
591
</ MenuItem >
@@ -662,16 +604,6 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
662
604
let colNames : [ string [ ] , string ] = [ parentConcepts . map ( f => f . name ) , name ] ;
663
605
664
606
viewExamples = ( < Box key = "viewexample--box" width = "100%" sx = { { position : "relative" , } } >
665
- { /* <Tooltip title={collapseCode ? "view / edit transformation code" : "hide transformation code"}>
666
- <IconButton color="primary" sx={{
667
- position: "absolute", right: "4px", top: "4px", zIndex: 3,
668
- backgroundColor: collapseCode ? "" : "rgba(2, 136, 209, 0.3)",
669
- "&:hover": { backgroundColor: collapseCode ? "default" : "rgba(2, 136, 209, 0.3)" }
670
- }}
671
- size="small" onClick={() => { setCollapseCode(!collapseCode); setCollapseVisInspector(true); }}>
672
- <TerminalIcon fontSize="small" />
673
- </IconButton>
674
- </Tooltip> */ }
675
607
< InputLabel shrink > illustration of the generated function</ InputLabel >
676
608
< GroupItems sx = { { padding : "0px 0px 6px 0px" , margin : 0 } } >
677
609
{ simpleTableView ( transformResult , colNames , conceptShelfItems , 5 ) }
@@ -703,10 +635,9 @@ export const DerivedConceptForm: FC<ConceptFormProps> = function DerivedConceptF
703
635
let candidates = processCodeCandidates ( rawCodeList , transformParentIDs , conceptShelfItems , tables )
704
636
let candidate = candidates [ 0 ] ;
705
637
706
- setCodeCandidates ( candidates ) ; // setCodeCandidates(codeList)
638
+ setCodeCandidates ( candidates ) ;
707
639
setTransformCode ( candidate ) ;
708
640
709
-
710
641
if ( candidates . length > 0 ) {
711
642
dispatch ( dfActions . addMessages ( {
712
643
"timestamp" : Date . now ( ) ,
@@ -940,11 +871,12 @@ export const CodexDialogBox: FC<CodexDialogBoxProps> = function ({
940
871
let textBox = < Box key = "interaction-comp" width = '100%' sx = { { display : 'flex' } } >
941
872
< TextField
942
873
size = "small"
874
+ sx = { { fontSize : 12 } }
943
875
color = "primary"
944
876
fullWidth
945
877
disabled = { outputName == "" }
946
878
InputProps = { {
947
- endAdornment : formulateButton
879
+ endAdornment : formulateButton ,
948
880
} }
949
881
InputLabelProps = { { shrink : true } }
950
882
multiline
0 commit comments