@@ -3,8 +3,10 @@ import { extend } from '../utilities.js'
33
44export class SelectEditor extends AbstractEditor {
55 setValue ( value , initial ) {
6+ const correctValue = initial && value === null && this . value === undefined ? 'undefined' : value
67 /* Sanitize value before setting it */
7- let sanitized = this . typecast ( value || '' )
8+ let sanitized = this . typecast ( correctValue || '' )
9+ console . log ( 'SETVALUE ' , 'CURRENT ' , this . value , 'SET ' , value , 'INITIAL ' , initial , 'SANITIZED' , sanitized )
810
911 if ( ! this . enum_values . includes ( sanitized ) ) sanitized = this . enum_values [ 0 ]
1012
@@ -52,7 +54,9 @@ export class SelectEditor extends AbstractEditor {
5254 if ( ! this . dependenciesFulfilled ) {
5355 return undefined
5456 }
55- return this . typecast ( this . value )
57+ const value = this . typecast ( this . value )
58+ console . log ( 'GET VALUE ' , value , this . value )
59+ return value
5660 }
5761
5862 preBuild ( ) {
@@ -170,6 +174,7 @@ export class SelectEditor extends AbstractEditor {
170174 this . setInputAttributes ( [ ] )
171175
172176 this . input . addEventListener ( 'change' , ( e ) => {
177+ console . log ( 'SELECT CHANGE ' )
173178 e . preventDefault ( )
174179 e . stopPropagation ( )
175180 this . onInputChange ( )
@@ -178,8 +183,9 @@ export class SelectEditor extends AbstractEditor {
178183 this . control = this . theme . getFormControl ( this . label , this . input , this . description , this . infoButton )
179184 this . container . appendChild ( this . control )
180185
186+ console . log ( 'ENUM VALUES ' , this . enum_values )
181187 this . value = this . enum_values [ 0 ]
182-
188+ console . log ( 'SET ' , this . value )
183189 /* Any special formatting that needs to happen after the input is added to the dom */
184190 window . requestAnimationFrame ( ( ) => {
185191 if ( this . input . parentNode ) this . afterInputReady ( )
0 commit comments