@gisce/ooui 0.2.6 → 0.2.9

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/dist/Graph.d.ts CHANGED
@@ -4,6 +4,14 @@ declare class Graph {
4
4
  get string(): string | null;
5
5
  _type?: GraphType;
6
6
  get type(): GraphType | undefined;
7
+ _color: string | null;
8
+ get color(): string | null;
9
+ _icon: string | null;
10
+ get icon(): string | null;
11
+ _totalDomain: string | null;
12
+ get totalDomain(): string | null;
13
+ _showPercent: boolean;
14
+ get showPercent(): boolean;
7
15
  constructor(xml: string);
8
16
  }
9
17
  export default Graph;
package/dist/Graph.js CHANGED
@@ -1,10 +1,23 @@
1
1
  var Graph = /** @class */ (function () {
2
2
  function Graph(xml) {
3
3
  this._string = null;
4
+ this._color = null;
5
+ this._icon = null;
6
+ this._totalDomain = null;
7
+ this._showPercent = false;
4
8
  var parser = new DOMParser();
5
9
  var view = parser.parseFromString(xml, "text/xml");
6
10
  this._string = view.documentElement.getAttribute("string");
7
11
  var type = view.documentElement.getAttribute("type");
12
+ this._color = view.documentElement.getAttribute("color");
13
+ this._icon = view.documentElement.getAttribute("icon");
14
+ this._totalDomain = view.documentElement.getAttribute("totalDomain");
15
+ var showPercent = view.documentElement.getAttribute("showPercent");
16
+ if (showPercent &&
17
+ (showPercent === "1" ||
18
+ (typeof showPercent === "boolean" && showPercent === true))) {
19
+ this._showPercent = true;
20
+ }
8
21
  if (type === "indicator") {
9
22
  this._type = "indicator";
10
23
  }
@@ -23,6 +36,34 @@ var Graph = /** @class */ (function () {
23
36
  enumerable: false,
24
37
  configurable: true
25
38
  });
39
+ Object.defineProperty(Graph.prototype, "color", {
40
+ get: function () {
41
+ return this._color;
42
+ },
43
+ enumerable: false,
44
+ configurable: true
45
+ });
46
+ Object.defineProperty(Graph.prototype, "icon", {
47
+ get: function () {
48
+ return this._icon;
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ Object.defineProperty(Graph.prototype, "totalDomain", {
54
+ get: function () {
55
+ return this._totalDomain;
56
+ },
57
+ enumerable: false,
58
+ configurable: true
59
+ });
60
+ Object.defineProperty(Graph.prototype, "showPercent", {
61
+ get: function () {
62
+ return this._showPercent;
63
+ },
64
+ enumerable: false,
65
+ configurable: true
66
+ });
26
67
  return Graph;
27
68
  }());
28
69
  export default Graph;
package/dist/Graph.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Graph.js","sourceRoot":"","sources":["../src/Graph.ts"],"names":[],"mappings":"AAEA;IAWE,eAAY,GAAW;QAVvB,YAAO,GAAkB,IAAI,CAAC;QAW5B,IAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC/B,IAAM,IAAI,GAAa,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAC/D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAM,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAEvD,IAAI,IAAI,KAAK,WAAW,EAAE;YACxB,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;SAC1B;IACH,CAAC;IAlBD,sBAAI,yBAAM;aAAV;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IAGD,sBAAI,uBAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAYH,YAAC;AAAD,CAAC,AArBD,IAqBC;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Graph.js","sourceRoot":"","sources":["../src/Graph.ts"],"names":[],"mappings":"AAEA;IA+BE,eAAY,GAAW;QA9BvB,YAAO,GAAkB,IAAI,CAAC;QAU9B,WAAM,GAAkB,IAAI,CAAC;QAK7B,UAAK,GAAkB,IAAI,CAAC;QAK5B,iBAAY,GAAkB,IAAI,CAAC;Q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AC;QACpB,CAAC;;;OAAA;IAGD,sBAAI,8BAAW;aAAf;YACE,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;;;OAAA;IAGD,sBAAI,8BAAW;aAAf;YACE,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;;;OAAA;IAyBH,YAAC;AAAD,CAAC,AAtDD,IAsDC;AAED,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/ooui",
3
- "version": "0.2.6",
3
+ "version": "0.2.9",
4
4
  "dependencies": {},
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/Graph.ts CHANGED
@@ -11,12 +11,45 @@ class Graph {
11
11
  return this._type;
12
12
  }
13
13
 
14
+ _color: string | null = null;
15
+ get color(): string | null {
16
+ return this._color;
17
+ }
18
+
19
+ _icon: string | null = null;
20
+ get icon(): string | null {
21
+ return this._icon;
22
+ }
23
+
24
+ _totalDomain: string | null = null;
25
+ get totalDomain(): string | null {
26
+ return this._totalDomain;
27
+ }
28
+
29
+ _showPercent: boolean = false;
30
+ get showPercent(): boolean {
31
+ return this._showPercent;
32
+ }
33
+
14
34
  constructor(xml: string) {
15
35
  const parser = new DOMParser();
16
36
  const view: Document = parser.parseFromString(xml, "text/xml");
17
37
  this._string = view.documentElement.getAttribute("string");
18
38
  const type = view.documentElement.getAttribute("type");
19
39
 
40
+ this._color = view.documentElement.getAttribute("color");
41
+ this._icon = view.documentElement.getAttribute("icon");
42
+ this._totalDomain = view.documentElement.getAttribute("totalDomain");
43
+
44
+ const showPercent = view.documentElement.getAttribute("showPercent");
45
+ if (
46
+ showPercent &&
47
+ (showPercent === "1" ||
48
+ (typeof showPercent === "boolean" && showPercent === true))
49
+ ) {
50
+ this._showPercent = true;
51
+ }
52
+
20
53
  if (type === "indicator") {
21
54
  this._type = "indicator";
22
55
  }
@@ -3,12 +3,14 @@ import Graph from "../Graph";
3
3
  describe("A Graph", () => {
4
4
  it("should parse a basic XML title and type indicator", () => {
5
5
  const xml = `<?xml version="1.0"?>
6
- <graph string="My indicator" type="indicator" />
6
+ <graph string="My indicator" type="indicator" color="red:debt>0;green:debt==0" icon="slack" />
7
7
  `;
8
8
 
9
9
  const graph = new Graph(xml);
10
10
 
11
11
  expect(graph.string).toBe("My indicator");
12
12
  expect(graph.type).toBe("indicator");
13
+ expect(graph.color).toBe("red:debt>0;green:debt==0");
14
+ expect(graph.icon).toBe("slack");
13
15
  });
14
16
  });