diff --git a/README.md b/README.md index b932dfc..97ebb7f 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ If you also like this module and want to thank, please rate this repository with maxWidth: "100%", numberDecimalsPercentages: 1, numberDecimalsValues: 2, - displayMode: "vertical", // One of ["none", "vertical", "horizontal", "table"] + displayMode: "vertical", // One of ["none", "vertical", "horizontal", "table", "default-table"] showColors: true, showCurrency: true, showChangePercent: true, @@ -113,9 +113,9 @@ If you also like this module and want to thank, please rate this repository with ### Options | Option | Description | -| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `currencyStyle` | Style of currency.

**Type:** `String`
**Allowed values:** `"code"` (EUR), `"symbol"` (€) or `"name"` (Euro)
**Default value:** `code` | -| `displayMode` | Display mode for ticker.

**Type:** `String`
**Allowed Values:** `"none"`, `"vertical"`, `"horizontal"` or `"table"`
**Default value:** `"vertical"` | +| `displayMode` | Display mode for ticker.

**Type:** `String`
**Allowed Values:** `"none"`, `"vertical"`, `"horizontal"`, `"table"` or `"default-table"`
**Default value:** `"vertical"` | | `fadeSpeedInSeconds` | Animation speed for ticker.

**Type:** `Number`
**Default value:** `3.5` | | `lastUpdateFormat` | Define dateformat, if the last update should be displayed.

**Type:** `String`
**Default value:** `"HH:mm"` | | `locale` | Option to override the global/system locale for value formatting.

**Type:** `String`
**Default value:** `undefined` (system locale) | diff --git a/src/types/Config.ts b/src/types/Config.ts index ed7e033..fbcccce 100644 --- a/src/types/Config.ts +++ b/src/types/Config.ts @@ -7,7 +7,7 @@ export type Config = { maxWidth: string numberDecimalsPercentages: number numberDecimalsValues: number - displayMode: 'vertical' | 'horizontal' | 'none' | 'table' + displayMode: 'vertical' | 'horizontal' | 'none' | 'table' | 'default-table' scroll?: 'vertical' | 'horizontal' | 'none' | 'table' showCurrency: boolean showColors: boolean diff --git a/templates/DefaultTableStockList.njk b/templates/DefaultTableStockList.njk new file mode 100644 index 0000000..703fee3 --- /dev/null +++ b/templates/DefaultTableStockList.njk @@ -0,0 +1,26 @@ +{% macro render() %} + + {% for stock in stocks %} + + + + + + {% endfor %} +
{{ utils.getStockName(stock) }} + {% if utils.getStockChange(stock) > 0 %} + {% set colorStyle = "green" %} + {% elif utils.getStockChange(stock) < 0 %} + {% set colorStyle = "red" %} + {% else %} + {% set colorStyle = "" %} + {% endif %} + {{ utils.getCurrentValueAsString(stock, config) }} + + + + {% if colorStyle == "green" %}+{%endif%}{{ utils.getStockChangePercentAsString(stock, config) }} + + +
+{% endmacro %} \ No newline at end of file diff --git a/templates/MMM-Jast.njk b/templates/MMM-Jast.njk index ea0149d..256a0d8 100755 --- a/templates/MMM-Jast.njk +++ b/templates/MMM-Jast.njk @@ -1,17 +1,22 @@ {% import "templates/VerticalStockList.njk" as verticalStockList with context %} {% import "templates/HorizontalStockList.njk" as horizontalStockList with context %} {% import "templates/TableStockList.njk" as tableStockList with context %} +{% import "templates/DefaultTableStockList.njk" as defaultTableStockList with context %} {% if stocks.length > 0 %} -
- {% if config.displayMode == "horizontal" %} - {{ horizontalStockList.render() }} - {{ horizontalStockList.render("2") }} - {% elif config.displayMode == "table" %} - {{ tableStockList.render() }} - {% else %} - {{ verticalStockList.render() }} - {% endif %} -
+ {% if config.displayMode == "default-table" %} + {{ defaultTableStockList.render() }} + {% else %} +
+ {% if config.displayMode == "horizontal" %} + {{ horizontalStockList.render() }} + {{ horizontalStockList.render("2") }} + {% elif config.displayMode == "table" %} + {{ tableStockList.render() }} + {% else %} + {{ verticalStockList.render() }} + {% endif %} +
+ {% endif %} {% else %}
{{ "LOADING" | translate | safe }}