Skip to content

Commit eb7dddc

Browse files
authored
fix(AnalyticalTable): align column popover based on hAlign (#7081)
Fixes #7080
1 parent cc0dc21 commit eb7dddc

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

packages/main/src/components/AnalyticalTable/AnalyticalTable.stories.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,17 @@ const meta = {
155155
},
156156
{
157157
Header: 'Age',
158-
accessor: 'age'
158+
accessor: 'age',
159+
hAlign: 'End'
159160
},
160161
{
161162
Header: 'Friend Name',
162163
accessor: 'friend.name'
163164
},
164165
{
165166
Header: 'Friend Age',
166-
accessor: 'friend.age'
167+
accessor: 'friend.age',
168+
hAlign: 'End'
167169
}
168170
],
169171
highlightField: 'status',

packages/main/src/components/AnalyticalTable/defaults/Column/ColumnHeaderModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ export const ColumnHeaderModal = (instance: TableInstanceWithPopoverProps) => {
139139
const horizontalAlign = (() => {
140140
switch (column.hAlign) {
141141
case TextAlign.Begin:
142-
return isRtl ? PopoverHorizontalAlign.End : PopoverHorizontalAlign.Start;
142+
return PopoverHorizontalAlign.Start;
143143
case TextAlign.End:
144-
return isRtl ? PopoverHorizontalAlign.Start : PopoverHorizontalAlign.End;
144+
return PopoverHorizontalAlign.End;
145145
case TextAlign.Left:
146-
return PopoverHorizontalAlign.Start;
146+
return isRtl ? PopoverHorizontalAlign.End : PopoverHorizontalAlign.Start;
147147
case TextAlign.Right:
148-
return PopoverHorizontalAlign.End;
148+
return isRtl ? PopoverHorizontalAlign.Start : PopoverHorizontalAlign.End;
149149
case TextAlign.Center:
150150
return PopoverHorizontalAlign.Center;
151151
default:
152-
return isRtl ? PopoverHorizontalAlign.End : PopoverHorizontalAlign.Start;
152+
return PopoverHorizontalAlign.Start;
153153
}
154154
})();
155155

packages/main/src/components/AnalyticalTable/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ export interface AnalyticalTableColumnDefinition {
512512
/**
513513
* Horizontal alignment of the cell.
514514
*/
515-
hAlign?: TextAlign;
515+
hAlign?: TextAlign | keyof typeof TextAlign;
516516
/**
517517
* Vertical alignment of the cell.
518518
*/
519-
vAlign?: VerticalAlign;
519+
vAlign?: VerticalAlign | keyof typeof VerticalAlign;
520520
/**
521521
* Allows passing a custom string for the internal width calculation of custom cells for `scaleWidthMode` `Grow` and `Smart`.
522522
*

0 commit comments

Comments
 (0)