@@ -15,8 +15,8 @@ import {CellValue} from "app/common/DocActions";
1515import { CompiledPredicateFormula } from 'app/common/PredicateFormula' ;
1616import { EmptyRecordView } from 'app/common/RecordView' ;
1717import { decodeObject , encodeObject } from 'app/plugin/objtypes' ;
18- import { ChoiceOptions , getRenderFillColor , getRenderTextColor } from 'app/client/widgets/ChoiceTextBox' ;
19- import { choiceToken , cssChoiceACItem , cssChoiceToken } from 'app/client/widgets/ChoiceToken' ;
18+ import { ChoiceOptions } from 'app/client/widgets/ChoiceTextBox' ;
19+ import { choiceToken , choiceTokenDomArgs , cssChoiceACItem } from 'app/client/widgets/ChoiceToken' ;
2020import { icon } from 'app/client/ui2018/icons' ;
2121import { dom , styled } from 'grainjs' ;
2222
@@ -95,17 +95,14 @@ export class ChoiceListEditor extends NewBaseEditor {
9595
9696 this . _tokenField = TokenField . ctor < ChoiceItem > ( ) . create ( this , {
9797 initialValue : startTokens ,
98- renderToken : item => [
98+ renderToken : item => choiceTokenDomArgs (
9999 item . isBlank ? '[Blank]' : item . label ,
100- dom . style ( 'background-color' , getRenderFillColor ( this . _choiceOptionsByName [ item . label ] ) ) ,
101- dom . style ( 'color' , getRenderTextColor ( this . _choiceOptionsByName [ item . label ] ) ) ,
102- dom . cls ( 'font-bold' , this . _choiceOptionsByName [ item . label ] ?. fontBold ?? false ) ,
103- dom . cls ( 'font-underline' , this . _choiceOptionsByName [ item . label ] ?. fontUnderline ?? false ) ,
104- dom . cls ( 'font-italic' , this . _choiceOptionsByName [ item . label ] ?. fontItalic ?? false ) ,
105- dom . cls ( 'font-strikethrough' , this . _choiceOptionsByName [ item . label ] ?. fontStrikethrough ?? false ) ,
106- cssChoiceToken . cls ( '-invalid' , item . isInvalid ) ,
107- cssChoiceToken . cls ( '-blank' , item . isBlank ) ,
108- ] ,
100+ {
101+ ...( this . _choiceOptionsByName [ item . label ] || { } ) ,
102+ invalid : item . isInvalid ,
103+ blank : item . isBlank ,
104+ } ,
105+ ) ,
109106 createToken : label => new ChoiceItem ( label , ! this . _choicesSet . has ( label ) , label . trim ( ) === '' ) ,
110107 acOptions,
111108 openAutocompleteOnFocus : true ,
0 commit comments