@gisce/ooui 0.1.3 → 0.1.4

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.
@@ -1,5 +1,9 @@
1
1
  import Field from "./Field";
2
2
  declare class Indicator extends Field {
3
3
  _nolabel: boolean;
4
+ _card: boolean;
5
+ get card(): boolean;
6
+ set card(value: boolean);
7
+ constructor(props: any);
4
8
  }
5
9
  export default Indicator;
package/dist/Indicator.js CHANGED
@@ -14,11 +14,25 @@ var __extends = (this && this.__extends) || (function () {
14
14
  import Field from "./Field";
15
15
  var Indicator = /** @class */ (function (_super) {
16
16
  __extends(Indicator, _super);
17
- function Indicator() {
18
- var _this = _super !== null && _super.apply(this, arguments) || this;
17
+ function Indicator(props) {
18
+ var _this = _super.call(this, props) || this;
19
19
  _this._nolabel = true;
20
+ _this._card = false;
21
+ if (_this._parsedWidgetProps) {
22
+ _this._card = _this._parsedWidgetProps.card;
23
+ }
20
24
  return _this;
21
25
  }
26
+ Object.defineProperty(Indicator.prototype, "card", {
27
+ get: function () {
28
+ return this._card;
29
+ },
30
+ set: function (value) {
31
+ this._card = value;
32
+ },
33
+ enumerable: false,
34
+ configurable: true
35
+ });
22
36
  return Indicator;
23
37
  }(Field));
24
38
  export default Indicator;
@@ -1 +1 @@
1
- {"version":3,"file":"Indicator.js","sourceRoot":"","sources":["../src/Indicator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;IAAwB,6BAAK;IAA7B;QAAA,qEAEC;QADC,cAAQ,GAAY,IAAI,CAAC;;IAC3B,CAAC;IAAD,gBAAC;AAAD,CAAC,AAFD,CAAwB,KAAK,GAE5B;AAGD,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"Indicator.js","sourceRoot":"","sources":["../src/Indicator.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;IAAwB,6BAAK;IAW3B,mBAAY,KAAU;QAAtB,YACE,kBAAM,KAAK,CAAC,SAKb;QAhBD,cAAQ,GAAY,IAAI,CAAC;QAYvB,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,KAAI,CAAC,kBAAkB,EAAE;YAC3B,KAAI,CAAC,KAAK,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;SAC3C;;IACH,CAAC;IAbD,sBAAI,2BAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;aACD,UAAS,KAAc;YACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;;;OAHA;IAYH,gBAAC;AAAD,CAAC,AAlBD,CAAwB,KAAK,GAkB5B;AAGD,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/ooui",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "dependencies": {},
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/Indicator.ts CHANGED
@@ -2,6 +2,22 @@ import Field from "./Field";
2
2
 
3
3
  class Indicator extends Field {
4
4
  _nolabel: boolean = true;
5
+
6
+ _card: boolean;
7
+ get card(): boolean {
8
+ return this._card;
9
+ }
10
+ set card(value: boolean) {
11
+ this._card = value;
12
+ }
13
+
14
+ constructor(props: any) {
15
+ super(props);
16
+ this._card = false;
17
+ if (this._parsedWidgetProps) {
18
+ this._card = this._parsedWidgetProps.card;
19
+ }
20
+ }
5
21
  }
6
22
 
7
23
 
@@ -0,0 +1,27 @@
1
+ import WidgetFactory from "../WidgetFactory";
2
+ import Indicator from "../Indicator";
3
+
4
+ describe("An Indicator", () => {
5
+ it("should create a Indicator widget from factory", () => {
6
+ const widgetFactory = new WidgetFactory();
7
+
8
+ const widget = widgetFactory.createWidget("indicator", {});
9
+ expect(widget).toBeInstanceOf(Indicator);
10
+
11
+ });
12
+
13
+ it('should have card as false as default', () => {
14
+ const widgetFactory = new WidgetFactory();
15
+ const widget = widgetFactory.createWidget("indicator", {});
16
+ expect(widget.card).toBe(false);
17
+ });
18
+
19
+ it('should parse widget props', () => {
20
+ const widgetFactory = new WidgetFactory();
21
+ const props = {
22
+ widget_props: "{'card': true}"
23
+ };
24
+ const widget = widgetFactory.createWidget("indicator", props);
25
+ expect(widget.card).toBe(true);
26
+ });
27
+ });