mdt-charts 1.13.1 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ export class CardChange {
9
9
  }
10
10
  update(options, dataRow) {
11
11
  this.setColor(this.wrapper, options);
12
- this.setValueContent(CardService.getValueContentFromRow(options.value, dataRow));
12
+ this.setValueContent(CardService.getValueContentFromRow(options.value, dataRow), options.valuePrefix);
13
13
  if (options.icon) {
14
14
  if (this.iconBlock) {
15
15
  this.iconBlock.html("");
@@ -34,7 +34,7 @@ export class CardChange {
34
34
  renderContentItems(contentBlock, options, dataRow) {
35
35
  if (options.icon)
36
36
  this.renderIcon(this.renderContentItem(contentBlock), options.icon);
37
- this.renderValue(this.renderContentItem(contentBlock), CardService.getValueContentFromRow(options.value, dataRow));
37
+ this.renderValue(this.renderContentItem(contentBlock), CardService.getValueContentFromRow(options.value, dataRow), options.valuePrefix);
38
38
  if (options.description)
39
39
  this.renderDescription(this.renderContentItem(contentBlock, NamesHelper.getClassName("card-change-description-item")), options.description);
40
40
  }
@@ -56,11 +56,11 @@ export class CardChange {
56
56
  .node()
57
57
  .appendChild(iconEl);
58
58
  }
59
- renderValue(parentBlock, value) {
59
+ renderValue(parentBlock, value, prefix) {
60
60
  this.valueContentBlock = parentBlock.append("div")
61
61
  .classed(NamesHelper.getClassName("card-change-value"), true)
62
62
  .append("span");
63
- this.setValueContent(value);
63
+ this.setValueContent(value, prefix);
64
64
  }
65
65
  renderDescription(parentBlock, textContent) {
66
66
  return parentBlock.append("div")
@@ -70,7 +70,7 @@ export class CardChange {
70
70
  .text(textContent)
71
71
  .attr("title", textContent);
72
72
  }
73
- setValueContent(textContent) {
74
- this.valueContentBlock.text(textContent);
73
+ setValueContent(textContent, prefix) {
74
+ this.valueContentBlock.text(prefix + textContent);
75
75
  }
76
76
  }
@@ -173,6 +173,7 @@ export interface DonutThicknessOptions {
173
173
  }
174
174
  export interface CardsChangeModel {
175
175
  value: MdtChartsCardValue;
176
+ valuePrefix: string;
176
177
  description?: string;
177
178
  color: MdtChartsColorName;
178
179
  icon?: MdtChartsIconElement;
@@ -2,6 +2,7 @@ import { MdtChartsCardsChange, MdtChartsDataRow } from "../../../config/config";
2
2
  import { CardsChangeModel } from "../../model";
3
3
  export declare class CardsChangeService {
4
4
  getChangeModel(dataRow: MdtChartsDataRow, changeOptions: MdtChartsCardsChange): CardsChangeModel;
5
+ private getValuePrefix;
5
6
  private getColor;
6
7
  private getIcon;
7
8
  private getOptionsByValue;
@@ -9,10 +9,19 @@ export class CardsChangeService {
9
9
  return {
10
10
  description: changeOptions.description,
11
11
  value: Object.assign({}, changeOptions.value),
12
+ valuePrefix: this.getValuePrefix(value),
12
13
  color: this.getColor(value, changeOptions.color),
13
14
  icon: this.getIcon(value, changeOptions.icon)
14
15
  };
15
16
  }
17
+ getValuePrefix(value) {
18
+ const prefixes = {
19
+ aboveZero: "+",
20
+ belowZero: "",
21
+ equalZero: ""
22
+ };
23
+ return this.getOptionsByValue(value, prefixes);
24
+ }
16
25
  getColor(changeValue, colorOptions) {
17
26
  const range = (colorOptions === null || colorOptions === void 0 ? void 0 : colorOptions.length) ? colorOptions : DEFAULT_CARD_CHANGE_RANGE;
18
27
  const rangeManager = new ColorRangeManager(range);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdt-charts",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {