@@ -26,6 +26,8 @@ import {
2626 getShowTimeZone ,
2727 getShowTSeparator ,
2828 getTruncateNumbersWithPound ,
29+ getShowEmptyStrings ,
30+ getShowNullStrings ,
2931 updateSettings as updateSettingsAction ,
3032 RootState ,
3133 WorkspaceSettings ,
@@ -52,6 +54,8 @@ interface FormattingSectionContentProps {
5254 showTSeparator : boolean ;
5355 timeZone : string ;
5456 truncateNumbersWithPound : boolean ;
57+ showEmptyStrings : boolean ;
58+ showNullStrings : boolean ;
5559 updateSettings : ( settings : Partial < WorkspaceSettings > ) => void ;
5660 defaultDecimalFormatOptions : FormatOption ;
5761 defaultIntegerFormatOptions : FormatOption ;
@@ -66,6 +70,8 @@ interface FormattingSectionContentState {
6670 defaultDecimalFormatOptions : FormatOption ;
6771 defaultIntegerFormatOptions : FormatOption ;
6872 truncateNumbersWithPound : boolean ;
73+ showEmptyStrings : boolean ;
74+ showNullStrings : boolean ;
6975 timestampAtMenuOpen : Date ;
7076}
7177
@@ -103,6 +109,10 @@ export class FormattingSectionContent extends PureComponent<
103109 this . handleResetTimeZone = this . handleResetTimeZone . bind ( this ) ;
104110 this . handleTruncateNumbersWithPoundChange =
105111 this . handleTruncateNumbersWithPoundChange . bind ( this ) ;
112+ this . handleShowEmptyStringsChange =
113+ this . handleShowEmptyStringsChange . bind ( this ) ;
114+ this . handleShowNullStringsChange =
115+ this . handleShowNullStringsChange . bind ( this ) ;
106116
107117 const {
108118 defaultDateTimeFormat,
@@ -112,6 +122,8 @@ export class FormattingSectionContent extends PureComponent<
112122 showTSeparator,
113123 timeZone,
114124 truncateNumbersWithPound,
125+ showEmptyStrings,
126+ showNullStrings,
115127 } = props ;
116128
117129 this . containerRef = React . createRef ( ) ;
@@ -125,6 +137,8 @@ export class FormattingSectionContent extends PureComponent<
125137 defaultDecimalFormatOptions,
126138 defaultIntegerFormatOptions,
127139 truncateNumbersWithPound,
140+ showEmptyStrings,
141+ showNullStrings,
128142 timestampAtMenuOpen : new Date ( ) ,
129143 } ;
130144 }
@@ -298,6 +312,24 @@ export class FormattingSectionContent extends PureComponent<
298312 this . queueUpdate ( update ) ;
299313 }
300314
315+ handleShowEmptyStringsChange ( ) : void {
316+ const { showEmptyStrings } = this . state ;
317+ const update = {
318+ showEmptyStrings : ! showEmptyStrings ,
319+ } ;
320+ this . setState ( update ) ;
321+ this . queueUpdate ( update ) ;
322+ }
323+
324+ handleShowNullStringsChange ( ) : void {
325+ const { showNullStrings } = this . state ;
326+ const update = {
327+ showNullStrings : ! showNullStrings ,
328+ } ;
329+ this . setState ( update ) ;
330+ this . queueUpdate ( update ) ;
331+ }
332+
301333 commitChanges ( ) : void {
302334 const { updateSettings } = this . props ;
303335 const updates = this . pendingUpdates . reduce (
@@ -322,6 +354,8 @@ export class FormattingSectionContent extends PureComponent<
322354 showTimeZone,
323355 showTSeparator,
324356 truncateNumbersWithPound,
357+ showEmptyStrings,
358+ showNullStrings,
325359 } = this . state ;
326360
327361 const {
@@ -527,7 +561,7 @@ export class FormattingSectionContent extends PureComponent<
527561 />
528562 </ div >
529563 </ div >
530- < div className = "form-row mb-3 " >
564+ < div className = "form-row mb-2 " >
531565 < div className = "offset-3 col-9" >
532566 < Checkbox
533567 checked = { truncateNumbersWithPound ?? null }
@@ -537,6 +571,31 @@ export class FormattingSectionContent extends PureComponent<
537571 </ Checkbox >
538572 </ div >
539573 </ div >
574+
575+ < div className = "form-row mb-3" >
576+ < label
577+ className = "col-form-label col-3"
578+ htmlFor = "default-integer-format-input"
579+ >
580+ String
581+ </ label >
582+ < div className = "col pr-0 pt-2" >
583+ < Checkbox
584+ checked = { showEmptyStrings ?? null }
585+ onChange = { this . handleShowEmptyStringsChange }
586+ >
587+ Show empty strings as{ ' ' }
588+ < span className = "font-italic text-muted" > empty</ span >
589+ </ Checkbox >
590+ < Checkbox
591+ checked = { showNullStrings ?? null }
592+ onChange = { this . handleShowNullStringsChange }
593+ >
594+ Show null strings as{ ' ' }
595+ < span className = "font-italic text-muted" > null</ span >
596+ </ Checkbox >
597+ </ div >
598+ </ div >
540599 </ div >
541600 </ div >
542601 ) ;
@@ -553,6 +612,8 @@ const mapStateToProps = (
553612 showTimeZone : getShowTimeZone ( state ) ,
554613 showTSeparator : getShowTSeparator ( state ) ,
555614 truncateNumbersWithPound : getTruncateNumbersWithPound ( state ) ,
615+ showEmptyStrings : getShowEmptyStrings ( state ) ,
616+ showNullStrings : getShowNullStrings ( state ) ,
556617 timeZone : getTimeZone ( state ) ,
557618 defaults : getDefaultSettings ( state ) ,
558619} ) ;
0 commit comments