mdt-charts 1.13.0 → 1.13.3
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.
- package/lib/engine/cardsNotation/card/cardChange.js +6 -6
- package/lib/engine/elementHighlighter/elementHighlighter.js +2 -1
- package/lib/model/model.d.ts +1 -0
- package/lib/model/notations/cards/cardsChangeService.d.ts +1 -0
- package/lib/model/notations/cards/cardsChangeService.js +9 -0
- package/lib/style/charts-main.css +6 -0
- package/lib/style/charts-main.less +6 -0
- package/package.json +1 -1
|
@@ -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
|
}
|
|
@@ -7,6 +7,7 @@ import { Donut } from '../polarNotation/donut/donut';
|
|
|
7
7
|
import { MarkDot } from '../features/markDots/markDot';
|
|
8
8
|
import { Helper } from '../helpers/helper';
|
|
9
9
|
import * as chroma from 'chroma-js';
|
|
10
|
+
import { NamesHelper } from '../helpers/namesHelper';
|
|
10
11
|
export class ElementHighlighter {
|
|
11
12
|
static toggleActivityStyle(elementSelection, isActive) {
|
|
12
13
|
elementSelection.classed(this.inactiveElemClass, !isActive);
|
|
@@ -195,4 +196,4 @@ export class ElementHighlighter {
|
|
|
195
196
|
});
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
|
-
ElementHighlighter.inactiveElemClass =
|
|
199
|
+
ElementHighlighter.inactiveElemClass = NamesHelper.getClassName("opacity-inactive");
|
package/lib/model/model.d.ts
CHANGED
|
@@ -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);
|