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

feat: Remove inline styling logic from DataGrid #6886

Closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "change DataGridRow.updateRowStyle to protected member from private property",
"packageName": "@microsoft/fast-foundation",
"email": "[email protected]",
"dependentChangeType": "prerelease"
}
2 changes: 2 additions & 0 deletions packages/web-components/fast-foundation/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ export class FASTDataGridCell extends FASTElement {
export class FASTDataGridRow extends FASTElement {
// @internal
activeCellItemTemplate?: ViewTemplate;
// (undocumented)
protected applyGridTemplateColumns(): void;
// @internal
cellElements: HTMLElement[];
cellItemTemplate?: ViewTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export const myDataGrid = DataGrid.compose({
| `rowDataChanged` | protected | | | `void` | |
| `toggleSelected` | public | Attempts to set the selected state of the row | `detail: DataGridSelectionChangeDetail` | `void` | |
| `handleFocusout` | public | | `e: FocusEvent` | `void` | |
| `applyGridTemplateColumns` | public | | | `void` | |

#### Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class FASTDataGridRow extends FASTElement {
public gridTemplateColumns: string;
protected gridTemplateColumnsChanged(): void {
if (this.$fastController.isConnected) {
this.updateRowStyle();
this.applyGridTemplateColumns();
}
}

Expand Down Expand Up @@ -211,7 +211,7 @@ export class FASTDataGridRow extends FASTElement {
this.addEventListener(eventKeyDown, this.handleKeydown);
this.addEventListener(eventClick, this.handleClick);

this.updateRowStyle();
this.applyGridTemplateColumns();

if (this.refocusOnLoad) {
// if focus was on the row when data changed try to refocus on same cell
Expand Down Expand Up @@ -355,7 +355,13 @@ export class FASTDataGridRow extends FASTElement {
: this.defaultHeaderCellItemTemplate;
}

private updateRowStyle = (): void => {
/**
* @public
*
* @remarks
* Applies the column definitions of the parent data-grid to the row's grid-template-columns CSS property.
*/
protected applyGridTemplateColumns(): void {
this.style.gridTemplateColumns = this.gridTemplateColumns;
};
}
}
Loading