Skip to content

Commit

Permalink
Added header align same as content alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
BabyElias committed Sep 5, 2024
1 parent f39cd22 commit eb923d2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/KTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
:style="[getHeaderStyle(header),
isColumnSortActive(index) ? { color: $themeBrand.primary.v_1000 } : { color: $themePalette.grey.v_800 },
{ backgroundColor: $themePalette.white } ,
isColumnFocused(index) ? { backgroundColor: $themePalette.grey.v_50 } : {}]"
isColumnFocused(index) ? { backgroundColor: $themePalette.grey.v_50 } : {},
{ textAlign: getTextAlign(header.dataType) }]"
role="columnheader"
data-focus="true"
:aria-colindex="index + 1"
Expand Down Expand Up @@ -90,7 +91,12 @@
<script>
import { ref, computed, watch } from '@vue/composition-api';
import useSorting, { SORT_ORDER_ASC, SORT_ORDER_DESC, DATA_TYPE_OTHERS } from './useSorting';
import useSorting, {
SORT_ORDER_ASC,
SORT_ORDER_DESC,
DATA_TYPE_OTHERS,
DATA_TYPE_NUMERIC,
} from './useSorting';
import KTableGridItem from './KTableGridItem.vue';
export default {
Expand Down Expand Up @@ -497,6 +503,16 @@
}
});
},
getTextAlign(dataType) {
const alignLtr = dataType === DATA_TYPE_NUMERIC ? 'right' : 'left';
if (this.isRtl && alignLtr === 'right') {
return 'left';
}
if (this.isRtl && alignLtr === 'left') {
return 'right';
}
return alignLtr;
},
},
};
Expand Down

0 comments on commit eb923d2

Please sign in to comment.