Skip to content

Commit

Permalink
Fix .editable-cell incorrectly set right text align (#4145)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Wooding <[email protected]>
  • Loading branch information
origami-z and joshwooding authored Sep 27, 2024
1 parent be58b13 commit 4f3bec9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .changeset/ninety-bottles-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@salt-ds/ag-grid-theme": patch
---

Fixed `.editable-cell` incorrectly setting text-align. For numeric columns, use both `.edtiable-cell` and `.numeric-cell` for `cellClass`. Fixes #4141.
4 changes: 2 additions & 2 deletions packages/ag-grid-theme/css/salt-ag-grid-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ div[class*="ag-theme-salt"] .editable-cell,
div[class*="ag-theme-salt"] .editable-numeric-cell {
outline: var(--salt-size-border) var(--salt-container-borderStyle) var(--salt-editable-borderColor);
outline-offset: -1px;
text-align: right;
}

div[class*="ag-theme-salt"] .ag-cell.numeric-cell {
div[class*="ag-theme-salt"] .ag-cell.numeric-cell,
div[class*="ag-theme-salt"] .editable-numeric-cell {
text-align: right;
}

Expand Down
15 changes: 5 additions & 10 deletions packages/ag-grid-theme/src/dependencies/dataGridExampleColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ const dataGridExampleColumns: ColDef[] = [
field: "capital",
filter: "agSetColumnFilter",
},
{
headerName: "Population",
type: "numericColumn",
field: "population",
filter: "agNumberColumnFilter",
editable: true,
cellClass: ["editable-cell"],
},
{
headerName: "Population",
type: "numericColumn",
Expand All @@ -47,17 +39,20 @@ const dataGridExampleColumns: ColDef[] = [
cellClass: ["numeric-cell", "editable-cell"],
},
{
headerName: "Population",
headerName: "Population (editable numeric)",
type: "numericColumn",
field: "population",
filter: "agNumberColumnFilter",
editable: true,
cellClass: ["numeric-cell", "editable-cell"],
// This is only here for backwards compatibility. Use the combination of the above two classes instead.
cellClass: ["editable-numeric-cell"],
},
{
headerName: "Date",
field: "date",
filter: "agDateColumnFilter",
editable: true,
cellClass: ["editable-cell"],
},
];
export default dataGridExampleColumns;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const dataGridExampleColumnsHdCompact: ColDef[] = [
field: "population",
filter: "agNumberColumnFilter",
editable: true,
cellClass: ["editable-cell"],
cellClass: ["numeric-cell", "editable-cell"],
},
{
headerName: "Date",
Expand Down
18 changes: 2 additions & 16 deletions site/src/examples/ag-grid-theme/data/defaultColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,11 @@ export const defaultColumns: ColDef[] = [
editable: true,
cellClass: ["numeric-cell", "editable-cell"],
},
{
headerName: "Population",
type: "numericColumn",
field: "population",
filter: "agNumberColumnFilter",
editable: true,
cellClass: ["numeric-cell", "editable-cell"],
},
{
headerName: "Population",
type: "numericColumn",
field: "population",
filter: "agNumberColumnFilter",
editable: true,
cellClass: ["numeric-cell", "editable-cell"],
},
{
headerName: "Date",
field: "date",
filter: "agDateColumnFilter",
editable: true,
cellClass: ["editable-cell"],
},
];

0 comments on commit 4f3bec9

Please sign in to comment.