@@ -284,6 +284,7 @@ export interface IrisGridProps {
284284 applyInputFiltersOnInit : boolean ;
285285 conditionalFormats : readonly SidebarFormattingRule [ ] ;
286286 customColumnFormatMap : Map < ColumnName , FormattingRule > ;
287+ columnAlignmentMap : Map < string , CanvasTextAlign > ;
287288 movedColumns : readonly MoveOperation [ ] ;
288289 movedRows : readonly MoveOperation [ ] ;
289290 inputFilters : readonly InputFilter [ ] ;
@@ -408,6 +409,8 @@ export interface IrisGridState {
408409 isMenuShown : boolean ;
409410 customColumnFormatMap : Map < ColumnName , FormattingRule > ;
410411
412+ columnAlignmentMap : Map < string , CanvasTextAlign > ;
413+
411414 conditionalFormats : readonly SidebarFormattingRule [ ] ;
412415 conditionalFormatEditIndex : number | null ;
413416 conditionalFormatPreview ?: SidebarFormattingRule ;
@@ -484,6 +487,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
484487 alwaysFetchColumns : EMPTY_ARRAY ,
485488 conditionalFormats : EMPTY_ARRAY ,
486489 customColumnFormatMap : EMPTY_MAP ,
490+ columnAlignmentMap : EMPTY_MAP ,
487491 isFilterBarShown : false ,
488492 applyInputFiltersOnInit : false ,
489493 movedColumns : EMPTY_ARRAY ,
@@ -591,6 +595,8 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
591595 this . handleTooltipRef = this . handleTooltipRef . bind ( this ) ;
592596 this . handleViewChanged = this . handleViewChanged . bind ( this ) ;
593597 this . handleFormatSelection = this . handleFormatSelection . bind ( this ) ;
598+ this . handleColumnAlignmentChange =
599+ this . handleColumnAlignmentChange . bind ( this ) ;
594600 this . handleConditionalFormatCreate =
595601 this . handleConditionalFormatCreate . bind ( this ) ;
596602 this . handleConditionalFormatEdit =
@@ -718,6 +724,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
718724 aggregationSettings,
719725 conditionalFormats,
720726 customColumnFormatMap,
727+ columnAlignmentMap,
721728 isFilterBarShown,
722729 isSelectingPartition,
723730 partitions,
@@ -841,6 +848,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
841848 formatter : new Formatter ( dh ) ,
842849 isMenuShown : false ,
843850 customColumnFormatMap : new Map ( customColumnFormatMap ) ,
851+ columnAlignmentMap : new Map ( columnAlignmentMap ) ,
844852
845853 conditionalFormats,
846854 conditionalFormatEditIndex : null ,
@@ -3129,6 +3137,24 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
31293137 this . updateFormatter ( { customColumnFormatMap } ) ;
31303138 }
31313139
3140+ handleColumnAlignmentChange (
3141+ modelIndex : ModelIndex ,
3142+ alignment : CanvasTextAlign | null
3143+ ) : void {
3144+ const { model } = this . props ;
3145+ const column = model . columns [ modelIndex ] ;
3146+
3147+ this . setState ( ( { columnAlignmentMap = EMPTY_MAP } ) => {
3148+ const newColumnAlignmentMap = new Map ( columnAlignmentMap ) ;
3149+ if ( alignment != null ) {
3150+ newColumnAlignmentMap . set ( column . name , alignment ) ;
3151+ } else {
3152+ newColumnAlignmentMap . delete ( column . name ) ;
3153+ }
3154+ return { columnAlignmentMap : newColumnAlignmentMap } ;
3155+ } ) ;
3156+ }
3157+
31323158 handleMenu ( e : React . MouseEvent < HTMLButtonElement > ) : void {
31333159 e . stopPropagation ( ) ;
31343160 this . setState ( { isMenuShown : true } ) ;
@@ -4389,6 +4415,8 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
43894415 conditionalFormatPreview,
43904416 conditionalFormatEditIndex,
43914417
4418+ columnAlignmentMap,
4419+
43924420 sorts,
43934421 reverse,
43944422 customColumns,
@@ -4980,6 +5008,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
49805008 right = { right }
49815009 filter = { filter }
49825010 formatter = { formatter }
5011+ columnAlignmentMap = { columnAlignmentMap }
49835012 sorts = { sorts }
49845013 reverse = { reverse }
49855014 movedColumns = { movedColumns }
0 commit comments