@gisce/ooui 0.2.6 → 0.2.7

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,10 @@ 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;
7
11
  constructor(xml: string);
8
12
  }
9
13
  export default Graph;
package/dist/Graph.js CHANGED
@@ -1,10 +1,14 @@
1
1
  var Graph = /** @class */ (function () {
2
2
  function Graph(xml) {
3
3
  this._string = null;
4
+ this._color = null;
5
+ this._icon = null;
4
6
  var parser = new DOMParser();
5
7
  var view = parser.parseFromString(xml, "text/xml");
6
8
  this._string = view.documentElement.getAttribute("string");
7
9
  var type = view.documentElement.getAttribute("type");
10
+ this._color = view.documentElement.getAttribute("color");
11
+ this._icon = view.documentElement.getAttribute("icon");
8
12
  if (type === "indicator") {
9
13
  this._type = "indicator";
10
14
  }
@@ -23,6 +27,20 @@ var Graph = /** @class */ (function () {
23
27
  enumerable: false,
24
28
  configurable: true
25
29
  });
30
+ Object.defineProperty(Graph.prototype, "color", {
31
+ get: function () {
32
+ return this._color;
33
+ },
34
+ enumerable: false,
35
+ configurable: true
36
+ });
37
+ Object.defineProperty(Graph.prototype, "icon", {
38
+ get: function () {
39
+ return this._icon;
40
+ },
41
+ enumerable: false,
42
+ configurable: true
43
+ });
26
44
  return Graph;
27
45
  }());
28
46
  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,GA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,GAAG,WAAW,CAAC;SAC1B;IACH,CAAC;IA/BD,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;IAGD,sBAAI,wBAAK;aAAT;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAGD,sBAAI,uBAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAeH,YAAC;AAAD,CAAC,AAlCD,IAkCC;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.7",
4
4
  "dependencies": {},
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/Graph.ts CHANGED
@@ -11,12 +11,25 @@ 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
+
14
24
  constructor(xml: string) {
15
25
  const parser = new DOMParser();
16
26
  const view: Document = parser.parseFromString(xml, "text/xml");
17
27
  this._string = view.documentElement.getAttribute("string");
18
28
  const type = view.documentElement.getAttribute("type");
19
29
 
30
+ this._color = view.documentElement.getAttribute("color");
31
+ this._icon = view.documentElement.getAttribute("icon");
32
+
20
33
  if (type === "indicator") {
21
34
  this._type = "indicator";
22
35
  }
@@ -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
  });