Skip to content

Commit

Permalink
feat(components/ag-grid): add right aligned column type (#2917)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-ErikaMcVey authored Nov 21, 2024
1 parent d029b55 commit 1a874d6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class ReadonlyGridComponent implements OnInit {
{
field: 'startDate',
headerName: 'Start Date',
type: SkyCellType.Date,
type: [SkyCellType.RightAligned, SkyCellType.Date],
},
{
field: 'endDate',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ export class SkyAgGridService implements OnDestroy {
cellEditor: SkyAgGridCellEditorNumberComponent,
headerClass: getHeaderClass(SkyHeaderClass.RightAligned),
},
[SkyCellType.RightAligned]: {
cellClassRules: {
[SkyCellClass.RightAligned]: cellClassRuleTrueExpression,
},
headerClass: getHeaderClass(SkyHeaderClass.RightAligned),
},
[SkyCellType.RowSelector]: {
cellClassRules: {
[SkyCellClass.RowSelector]: cellClassRuleTrueExpression,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum SkyCellClass {
Invalid = 'sky-ag-grid-cell-invalid',
Lookup = 'sky-ag-grid-cell-lookup',
Number = 'sky-ag-grid-cell-number',
RightAligned = 'sky-ag-grid-cell-right-aligned',
RowSelector = 'sky-ag-grid-cell-row-selector',
Template = 'sky-ag-grid-cell-template',
Text = 'sky-ag-grid-cell-text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ export enum SkyCellType {
* Combines SkyCellType.Number and SkyCellType.Validator, where the value is displayed as a number and passed to a validator function.
*/
NumberValidator = 'skyCellNumberValidator',
/**
* **Edit and read-only modes**
* <br/>
* The header and cells in the column will render right aligned.
*/
RightAligned = 'skyCellRightAligned',
/**
* **Edit and read-only modes**
* <br/>
Expand Down
7 changes: 6 additions & 1 deletion libs/components/ag-grid/src/lib/styles/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,14 @@ ag-grid-angular {
display: none;
}
.sky-ag-grid-cell-number,
.sky-ag-grid-cell-currency {
.sky-ag-grid-cell-currency,
.sky-ag-grid-cell-right-aligned {
text-align: right;
padding-right: 12px;
}

.sky-ag-grid-cell-number,
.sky-ag-grid-cell-currency {
font-variant-numeric: tabular-nums;
}

Expand Down

0 comments on commit 1a874d6

Please sign in to comment.