Skip to content

Commit

Permalink
add thousands format
Browse files Browse the repository at this point in the history
  • Loading branch information
wusteven815 committed Oct 21, 2024
1 parent 6b949d5 commit 3b390d4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class DecimalFormatContextMenu {
format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,
group: DecimalFormatContextMenu.presetGroup,
},
{
format: DecimalColumnFormatter.FORMAT_THOUSANDS,
group: DecimalFormatContextMenu.presetGroup,
},
{
format: DecimalColumnFormatter.FORMAT_MILLIONS,
group: DecimalFormatContextMenu.presetGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class IntegerFormatContextMenu {
onCustomFormatChange: (value: IntegerColumnFormat | null) => void
): FormatContextMenuOption[] {
const formatItems = [
{
format: IntegerColumnFormatter.FORMAT_THOUSANDS,
group: IntegerFormatContextMenu.presetGroup,
},
{
format: IntegerColumnFormatter.FORMAT_MILLIONS,
group: IntegerFormatContextMenu.presetGroup,
Expand Down
6 changes: 6 additions & 0 deletions packages/jsapi-utils/src/formatters/DecimalColumnFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ export class DecimalColumnFormatter extends TableColumnFormatter<number> {
10000
);

static FORMAT_THOUSANDS = DecimalColumnFormatter.makePresetFormat(
'Thousands',
'##0.000 k',
0.001
);

static FORMAT_MILLIONS = DecimalColumnFormatter.makePresetFormat(
'Millions',
'###,##0.000 mm',
Expand Down
6 changes: 6 additions & 0 deletions packages/jsapi-utils/src/formatters/IntegerColumnFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ export class IntegerColumnFormatter extends TableColumnFormatter<number> {

static DEFAULT_FORMAT_STRING = '###,##0';

static FORMAT_THOUSANDS = IntegerColumnFormatter.makePresetFormat(
'Thousands',
'##0.000 k',
0.001
);

static FORMAT_MILLIONS = IntegerColumnFormatter.makePresetFormat(
'Millions',
'###,##0.000 mm',
Expand Down

0 comments on commit 3b390d4

Please sign in to comment.