[AAE-16964] Handle amount data table cloumn type (#8984)

* [AAE-16964] Handle amount data table cloumn type

* remove not needed reset testing module

* improve spacing

* update documentation

* remove code duplications in unit tests

* add type for default currency config

* update doc
This commit is contained in:
Tomasz Gnyp
2023-10-19 11:50:35 +02:00
committed by GitHub
parent 962a2be698
commit 6644f539fa
10 changed files with 242 additions and 5 deletions

View File

@@ -59,8 +59,35 @@ Defines column properties for DataTable, Tasklist, Document List and other compo
| sortingKey | `string` | | When using server side sorting the column used by the api call where the sorting will be performed |
| srTitle | `string` | | Title to be used for screen readers. |
| title | `string` | "" | Display title of the column, typically used for column headers. You can use the i18n resource key to get it translated automatically. |
| type | `string` | "text" | Value type for the column. Possible settings are 'text', 'boolean', 'icon', 'image', 'date', 'fileSize', 'location', and 'json'. |
| type | `string` | "text" | Value type for the column. Possible settings are 'text', 'boolean', 'icon', 'image', 'date', 'fileSize', 'location', 'json' and 'amount'. |
| order | `number` | | Sets position of column. |
| currencyConfig | `CurrencyConfig` | [Default currency config](#default-currency-config) | Currency configuration to customize the formatting and display of currency values within the component. |
## Properties configuration
### `currencyConfig` Input
The `currencyConfig` input allows you to customize the formatting and display of currency values within the component. It accepts an object of type `CurrencyConfig` with optional properties for specifying the currency code, display format, decimal precision, and locale.
#### Properties
- `code` (optional): A string representing the currency code (e.g., "USD" for US Dollars).
- `display` (optional): A string specifying how the currency value should be displayed.
- `digitsInfo` (optional): A string determining the number of decimal places and other formatting details.
- `locale` (optional): A string indicating the locale or region-specific formatting to use for the currency.
#### Default currency config
By default, the `currencyConfig` input is not required. If not provided, the component will use the following default values:
- `code`: "USD"
- `display`: "symbol"
- `digitsInfo`: undefined
- `locale`: undefined
These properties offer flexibility in customizing how currency values are presented within the component.
For more details on the possible use cases of the above properties, see the [official Angular documents](https://angular.io/api/common/CurrencyPipe).
## Properties configuration
@@ -76,7 +103,7 @@ The `type` input allows us to specify the type of hosted values for a given colu
- `fileSize` - TODO
- `location` - TODO
- `json` - TODO
- `currency` - This column is responsible for displaying currencies. It expects numerals represented by a string or a number. This type comes with `currencyConfig` (TODO: Add ref). The default setup use **USD** `code` with a **symbol** as a `display` option. Example output: $10.26 (for number 10.26)
- `amount` - This column is responsible for displaying currencies. It expects numerals represented by a string or a number. This type comes with [`currencyConfig`](#default-currency-config).
## Details