Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: microsoft/powercat-creator-kit#176 #324

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions DetailsList/DetailsList/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
SelectionMode,
ThemeProvider,
IDetailsRowProps,
IDetailsColumnProps,
} from '@fluentui/react';
import * as React from 'react';
import { IGridColumn } from './Component.types';
Expand Down Expand Up @@ -380,6 +381,22 @@ function mapToGridColumn(
cellType ? ClassNames.cellTypePrefix + cellType.toString().toLowerCase() : '',
]);

//Set padding-left for headercell
const onRenderHeader: IRenderFunction<IDetailsColumnProps> = (props) => {
if (props) {
return (
<span
style={{
paddingLeft: column.getValue(ColumnsColumns.ColHeaderPaddingLeft) as string,
}}
>
{props.column.name}
</span>
);
}
return null;
};

return {
// Give the column a unique key based on the input collection so changing the columns will recalculate widths etc.
key: 'col' + column.getRecordId(),
Expand Down Expand Up @@ -418,6 +435,7 @@ function mapToGridColumn(
verticalAligned: undefinedIfNullish(column.getValue(ColumnsColumns.ColVerticalAlign)),
horizontalAligned: undefinedIfNullish(column.getValue(ColumnsColumns.ColHorizontalAlign)),
isRowHeader: column.getValue(ColumnsColumns.ColRowHeader) === true,
onRenderHeader: onRenderHeader,
} as IGridColumn;

function undefinedIfNullish<T>(value: T) {
Expand Down