@gisce/ooui 0.2.1 → 0.2.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.
package/dist/Button.d.ts CHANGED
@@ -24,6 +24,12 @@ declare class Button extends Field {
24
24
  _confirmMessage: string;
25
25
  get confirmMessage(): string;
26
26
  set confirm(value: string);
27
+ _primary: boolean;
28
+ get primary(): boolean;
29
+ set primary(value: boolean);
30
+ _danger: boolean;
31
+ get danger(): boolean;
32
+ set danger(value: boolean);
27
33
  constructor(props: any);
28
34
  }
29
35
  export default Button;
package/dist/Button.js CHANGED
@@ -39,6 +39,8 @@ var Button = /** @class */ (function (_super) {
39
39
  * Confirm string for modal in button types workflow
40
40
  */
41
41
  _this._confirmMessage = "";
42
+ _this._primary = false;
43
+ _this._danger = false;
42
44
  if (props) {
43
45
  if (props.string) {
44
46
  _this._caption = props.string;
@@ -55,6 +57,18 @@ var Button = /** @class */ (function (_super) {
55
57
  if (props.icon) {
56
58
  _this._icon = props.icon;
57
59
  }
60
+ if (props.primary) {
61
+ var primary = props.primary;
62
+ if (primary === "1" || primary === 1 || primary === true) {
63
+ _this._primary = true;
64
+ }
65
+ }
66
+ if (props.danger) {
67
+ var danger = props.danger;
68
+ if (danger === "1" || danger === 1 || danger === true) {
69
+ _this._danger = true;
70
+ }
71
+ }
58
72
  }
59
73
  return _this;
60
74
  }
@@ -102,6 +116,26 @@ var Button = /** @class */ (function (_super) {
102
116
  enumerable: false,
103
117
  configurable: true
104
118
  });
119
+ Object.defineProperty(Button.prototype, "primary", {
120
+ get: function () {
121
+ return this._primary;
122
+ },
123
+ set: function (value) {
124
+ this._primary = value;
125
+ },
126
+ enumerable: false,
127
+ configurable: true
128
+ });
129
+ Object.defineProperty(Button.prototype, "danger", {
130
+ get: function () {
131
+ return this._danger;
132
+ },
133
+ set: function (value) {
134
+ this._danger = value;
135
+ },
136
+ enumerable: false,
137
+ configurable: true
138
+ });
105
139
  return Button;
106
140
  }(Field));
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CAAC,KAAK,CAAC;QACpB,CAAC;aACD,UAAS,KAAyB;YAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;;;OAHA;IASD,sBAAI,kCAAc;aAAlB;YACE,OAAO,IAAI,CAAC,eAAe,CAAC;QAC9B,CAAC;;;OAAA;IACD,sBAAI,2BAAO;aAAX,UAAY,KAAa;YACvB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC/B,CAAC;;;OAAA;IAGD,sBAAI,2BAAO;aAAX;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;aACD,UAAY,KAAc;YACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;;;OAHA;IAMD,sBAAI,0BAAM;aAAV;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;aACD,UAAW,KAAc;YACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,CAAC;;;OAHA;IA6CH,aAAC;AAAD,CAAC,AArGD,CAAqB,KAAK,GAqGzB;AAED,eAAe,MAAM,CAAC"}
@@ -4,5 +4,4 @@ declare type ParsedNode = {
4
4
  child: Element;
5
5
  };
6
6
  declare const parseNodes: (nodes: NodeListOf<ChildNode>, fields: any) => ParsedNode[];
7
- declare const parseGenericNodes: (nodes: NodeListOf<ChildNode>) => ParsedNode[];
8
- export { parseNodes, parseGenericNodes };
7
+ export { parseNodes };
@@ -46,19 +46,5 @@ var parseNodes = function (nodes, fields) {
46
46
  });
47
47
  return parsedNodes;
48
48
  };
49
- var parseGenericNodes = function (nodes) {
50
- var parsedNodes = [];
51
- Array.prototype.forEach.call(nodes, function (child) {
52
- if (child.nodeType === child.ELEMENT_NODE) {
53
- var tag = child.nodeName;
54
- var tagAttributes_2 = {};
55
- Array.prototype.forEach.call(child.attributes, function (attr) {
56
- tagAttributes_2[attr.name] = attr.value;
57
- });
58
- parsedNodes.push({ tag: tag, tagAttributes: tagAttributes_2, child: child });
59
- }
60
- });
61
- return parsedNodes;
62
- };
63
- export { parseNodes, parseGenericNodes };
49
+ export { parseNodes };
64
50
  //# sourceMappingURL=nodeParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeParser.js","sourceRoot":"","sources":["../../src/helpers/nodeParser.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,IAAM,UAAU,GAAG,UACjB,KAA4B,EAC5B,MAAW;IAEX,IAAM,WAAW,GAAiB,EAAE,CAAC;IACrC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,KAAc;;QACjD,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,YAAY,EAAE;YACzC,IAAI,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC;YAEzB,IAAI,eAAa,GAAQ,EAAE,CAAC;YAC5B,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,UAAC,IAAU;gBACxD,eAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;YACxC,CAAC,CAAC,CAAC;YAEH,IAAI,GAAG,KAAK,OAAO,EAAE;gBACnB,IAAM,MAAI,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBACxC,IAAM,UAAU,GAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAChD,IAAI,UAAU,EAAE;oBACd,GAAG,GAAG,UAAU,CAAC;iBAClB;qBAAM,IAAI,MAAI,EAAE;oBACf,IAAI,CAAC,MAAM,CAAC,MAAI,CAAC,EAAE;wBACjB,MAAM,IAAI,KAAK,CAAC,WAAS,MAAI,uCAAoC,CAAC,CAAC;qBACpE;oBACD,GAAG,GAAG,MAAM,CAAC,MAAI,CAAC,CAAC,IAAI,CAAC;iBACzB;gBAED,4GAA4G;gBAC5G,IACE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAK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,CAAC,MAAM,CAAC;oBACnC,MAAM,CAAC,MAAK,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;oBAClC,MAAM,CAAC,MAAK,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC;oBACjC,eAAa,CAAC,QAAQ,CAAC;oBACvB,eAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAClC;oBACA,OAAO,MAAM,CAAC,MAAK,CAAC,CAAC,MAAM,CAAC;iBAC7B;gBAED,eAAa,kCACR,MAAM,CAAC,MAAK,CAAC,GACb,eAAa,KAChB,gBAAgB,QAAE,MAAM,CAAC,MAAK,CAAC,0CAAE,IAAI,GACtC,CAAC;aACH;YAED,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,KAAA,EAAE,aAAa,iBAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;SACjD;IACH,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -31,5 +31,4 @@ import { parseContext } from "./helpers/contextParser";
31
31
  import { transformDomainForChildWidget } from "./helpers/domainParser";
32
32
  import Timeline from "./Timeline";
33
33
  import Indicator from "./Indicator";
34
- import Dashboard from "./Dashboard";
35
- export { Char, Selection, Many2one, Field, Widget, Form, Tree, Boolean, One2many, Integer, Float, FloatTime, Date, DateTime, Many2many, SearchFilter, Container, ContainerWidget, Text, ProgressBar, Notebook, Group, Page, Label, Separator, Button, Reference, Binary, Image, parseContext, transformDomainForChildWidget, Timeline, Indicator, Dashboard, };
34
+ export { Char, Selection, Many2one, Field, Widget, Form, Tree, Boolean, One2many, Integer, Float, FloatTime, Date, DateTime, Many2many, SearchFilter, Container, ContainerWidget, Text, ProgressBar, Notebook, Group, Page, Label, Separator, Button, Reference, Binary, Image, parseContext, transformDomainForChildWidget, Timeline, Indicator, };
package/dist/index.js CHANGED
@@ -31,6 +31,5 @@ import { parseContext } from "./helpers/contextParser";
31
31
  import { transformDomainForChildWidget } from "./helpers/domainParser";
32
32
  import Timeline from "./Timeline";
33
33
  import Indicator from "./Indicator";
34
- import Dashboard from "./Dashboard";
35
- export { Char, Selection, Many2one, Field, Widget, Form, Tree, Boolean, One2many, Integer, Float, FloatTime, Date, DateTime, Many2many, SearchFilter, Container, ContainerWidget, Text, ProgressBar, Notebook, Group, Page, Label, Separator, Button, Reference, Binary, Image, parseContext, transformDomainForChildWidget, Timeline, Indicator, Dashboard, };
34
+ export { Char, Selection, Many2one, Field, Widget, Form, Tree, Boolean, One2many, Integer, Float, FloatTime, Date, DateTime, Many2many, SearchFilter, Container, ContainerWidget, Text, ProgressBar, Notebook, Group, Page, Label, Separator, Button, Reference, Binary, Image, parseContext, transformDomainForChildWidget, Timeline, Indicator, };
36
35
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,QAAQ,MAAM,YAAY,CAA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,SAAS,EACT,QAAQ,EACR,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,OAAO,EACP,KAAK,EACL,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,SAAS,EACT,eAAe,EACf,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,KAAK,EACL,SAAS,EACT,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,YAAY,EACZ,6BAA6B,EAC7B,QAAQ,EACR,SAAS,GACV,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/ooui",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "dependencies": {},
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,8 @@
16
16
  "prebuild": "rimraf dist",
17
17
  "build": "tsc",
18
18
  "test": "jest",
19
- "test:watch": "jest --watch"
19
+ "test:watch": "jest --watch",
20
+ "prepublishOnly": "npm run build"
20
21
  },
21
22
  "eslintConfig": {},
22
23
  "devDependencies": {
package/src/Button.ts CHANGED
@@ -45,6 +45,22 @@ class Button extends Field {
45
45
  this._confirmMessage = value;
46
46
  }
47
47
 
48
+ _primary: boolean = false;
49
+ get primary(): boolean {
50
+ return this._primary;
51
+ }
52
+ set primary(value: boolean) {
53
+ this._primary = value;
54
+ }
55
+
56
+ _danger: boolean = false;
57
+ get danger(): boolean {
58
+ return this._danger;
59
+ }
60
+ set danger(value: boolean) {
61
+ this._danger = value;
62
+ }
63
+
48
64
  constructor(props: any) {
49
65
  super({
50
66
  ...props,
@@ -71,6 +87,18 @@ class Button extends Field {
71
87
  if (props.icon) {
72
88
  this._icon = props.icon;
73
89
  }
90
+ if (props.primary) {
91
+ const primary = props.primary;
92
+ if (primary === "1" || primary === 1 || primary === true) {
93
+ this._primary = true
94
+ }
95
+ }
96
+ if (props.danger) {
97
+ const danger = props.danger;
98
+ if (danger === "1" || danger === 1 || danger === true) {
99
+ this._danger = true
100
+ }
101
+ }
74
102
  }
75
103
  }
76
104
  }
@@ -54,21 +54,4 @@ const parseNodes = (
54
54
  return parsedNodes;
55
55
  };
56
56
 
57
- const parseGenericNodes = (nodes: NodeListOf<ChildNode>): ParsedNode[] => {
58
- const parsedNodes: ParsedNode[] = [];
59
- Array.prototype.forEach.call(nodes, (child: Element) => {
60
- if (child.nodeType === child.ELEMENT_NODE) {
61
- let tag = child.nodeName;
62
-
63
- let tagAttributes: any = {};
64
- Array.prototype.forEach.call(child.attributes, (attr: Attr) => {
65
- tagAttributes[attr.name] = attr.value;
66
- });
67
-
68
- parsedNodes.push({ tag, tagAttributes, child });
69
- }
70
- });
71
- return parsedNodes;
72
- };
73
-
74
- export { parseNodes, parseGenericNodes };
57
+ export { parseNodes };
package/src/index.ts CHANGED
@@ -31,7 +31,6 @@ import { parseContext } from "./helpers/contextParser";
31
31
  import { transformDomainForChildWidget } from "./helpers/domainParser";
32
32
  import Timeline from "./Timeline";
33
33
  import Indicator from "./Indicator";
34
- import Dashboard from "./Dashboard";
35
34
 
36
35
  export {
37
36
  Char,
@@ -67,5 +66,4 @@ export {
67
66
  transformDomainForChildWidget,
68
67
  Timeline,
69
68
  Indicator,
70
- Dashboard,
71
69
  };
@@ -55,4 +55,78 @@ describe("A Button", () => {
55
55
 
56
56
  expect(widget.nolabel).toBe(false);
57
57
  });
58
+ describe('primary attribute', () => {
59
+ it("should have primary attribute as false for default", () => {
60
+ const widgetFactory = new WidgetFactory();
61
+ const props = {
62
+ string: "Button",
63
+ };
64
+ const widget = widgetFactory.createWidget("button", props);
65
+ expect(widget.primary).toBe(false);
66
+ });
67
+ it("should parse primary option for 1", () => {
68
+ const widgetFactory = new WidgetFactory();
69
+ const props = {
70
+ string: "Button",
71
+ primary: 1
72
+ };
73
+ const widget = widgetFactory.createWidget("button", props);
74
+ expect(widget.primary).toBe(true);
75
+ });
76
+ it("should parse primary option for '1'", () => {
77
+ const widgetFactory = new WidgetFactory();
78
+ const props = {
79
+ string: "Button",
80
+ primary: "1"
81
+ };
82
+ const widget = widgetFactory.createWidget("button", props);
83
+ expect(widget.primary).toBe(true);
84
+ });
85
+ it("should parse primary option for true", () => {
86
+ const widgetFactory = new WidgetFactory();
87
+ const props = {
88
+ string: "Button",
89
+ primary: true
90
+ };
91
+ const widget = widgetFactory.createWidget("button", props);
92
+ expect(widget.primary).toBe(true);
93
+ });
94
+ });
95
+ describe('danger attribute', () => {
96
+ it("should have danger attribute as false for default", () => {
97
+ const widgetFactory = new WidgetFactory();
98
+ const props = {
99
+ string: "Button",
100
+ };
101
+ const widget = widgetFactory.createWidget("button", props);
102
+ expect(widget.danger).toBe(false);
103
+ });
104
+ it("should parse danger option for 1", () => {
105
+ const widgetFactory = new WidgetFactory();
106
+ const props = {
107
+ string: "Button",
108
+ danger: 1
109
+ };
110
+ const widget = widgetFactory.createWidget("button", props);
111
+ expect(widget.danger).toBe(true);
112
+ });
113
+ it("should parse danger option for '1'", () => {
114
+ const widgetFactory = new WidgetFactory();
115
+ const props = {
116
+ string: "Button",
117
+ danger: "1"
118
+ };
119
+ const widget = widgetFactory.createWidget("button", props);
120
+ expect(widget.danger).toBe(true);
121
+ });
122
+ it("should parse danger option for true", () => {
123
+ const widgetFactory = new WidgetFactory();
124
+ const props = {
125
+ string: "Button",
126
+ danger: true
127
+ };
128
+ const widget = widgetFactory.createWidget("button", props);
129
+ expect(widget.danger).toBe(true);
130
+ });
131
+ });
58
132
  });
package/dist/Action.d.ts DELETED
@@ -1,8 +0,0 @@
1
- declare class Action {
2
- _name: string | null;
3
- get name(): string | null;
4
- _parms: string | null;
5
- get parms(): string | null;
6
- constructor(attributes: any);
7
- }
8
- export default Action;
package/dist/Action.js DELETED
@@ -1,29 +0,0 @@
1
- var Action = /** @class */ (function () {
2
- function Action(attributes) {
3
- this._name = null;
4
- this._parms = null;
5
- if (attributes.name) {
6
- this._name = attributes.name;
7
- }
8
- if (attributes.parms) {
9
- this._parms = attributes.parms;
10
- }
11
- }
12
- Object.defineProperty(Action.prototype, "name", {
13
- get: function () {
14
- return this._name;
15
- },
16
- enumerable: false,
17
- configurable: true
18
- });
19
- Object.defineProperty(Action.prototype, "parms", {
20
- get: function () {
21
- return this._parms;
22
- },
23
- enumerable: false,
24
- configurable: true
25
- });
26
- return Action;
27
- }());
28
- export default Action;
29
- //# sourceMappingURL=Action.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Action.js","sourceRoot":"","sources":["../src/Action.ts"],"names":[],"mappings":"AAAA;IAWE,gBAAY,UAAe;QAV3B,UAAK,GAAkB,IAAI,CAAC;QAK5B,WAAM,GAAkB,IAAI,CAAC;QAM3B,IAAI,UAAU,CAAC,IAAI,EAAE;YACnB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;SAC9B;QAED,IAAI,UAAU,CAAC,KAAK,EAAE;YACpB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;SAChC;IACH,CAAC;IAjBD,sBAAI,wBAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;;;OAAA;IAGD,sBAAI,yBAAK;aAAT;YACE,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;;;OAAA;IAWH,aAAC;AAAD,CAAC,AApBD,IAoBC;AAED,eAAe,MAAM,CAAC"}
@@ -1,9 +0,0 @@
1
- import Action from "./Action";
2
- declare class Dashboard {
3
- _string: string | null;
4
- get string(): string | null;
5
- _actions: Action[];
6
- get actions(): Action[];
7
- constructor(xml: string);
8
- }
9
- export default Dashboard;
package/dist/Dashboard.js DELETED
@@ -1,36 +0,0 @@
1
- import Action from "./Action";
2
- import { parseGenericNodes } from "./helpers/nodeParser";
3
- var Dashboard = /** @class */ (function () {
4
- function Dashboard(xml) {
5
- var _this = this;
6
- this._string = null;
7
- this._actions = [];
8
- var parser = new DOMParser();
9
- var view = parser.parseFromString(xml, "text/xml");
10
- this._string = view.documentElement.getAttribute("string");
11
- var documentElement = view.documentElement;
12
- var actionsParsed = parseGenericNodes(documentElement.childNodes);
13
- actionsParsed.forEach(function (nodeParsed) {
14
- if (nodeParsed.tag === "action") {
15
- _this._actions.push(new Action(nodeParsed.tagAttributes));
16
- }
17
- });
18
- }
19
- Object.defineProperty(Dashboard.prototype, "string", {
20
- get: function () {
21
- return this._string;
22
- },
23
- enumerable: false,
24
- configurable: true
25
- });
26
- Object.defineProperty(Dashboard.prototype, "actions", {
27
- get: function () {
28
- return this._actions;
29
- },
30
- enumerable: false,
31
- configurable: true
32
- });
33
- return Dashboard;
34
- }());
35
- export default Dashboard;
36
- //# sourceMappingURL=Dashboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Dashboard.js","sourceRoot":"","sources":["../src/Dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;IAWE,mBAAY,GAAW;QAAvB,iBAaC;QAvBD,YAAO,GAAkB,IAAI,CAAC;QAK9B,aAAQ,GAAa,EAAE,CAAC;QAMtB,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,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE7C,IAAM,aAAa,GAAG,iBAAiB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAEpE,aAAa,CAAC,OAAO,CAAC,UAAC,UAAU;YAC/B,IAAI,UAAU,CAAC,GAAG,KAAK,QAAQ,EAAE;gBAC/B,KAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;aAC1D;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAtBD,sBAAI,6BAAM;aAAV;YACE,OAAO,IAAI,CAAC,OAAO,CAAC;QACtB,CAAC;;;OAAA;IAGD,sBAAI,8BAAO;aAAX;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;;;OAAA;IAgBH,gBAAC;AAAD,CAAC,AAzBD,IAyBC;AAED,eAAe,SAAS,CAAC"}
package/src/Action.ts DELETED
@@ -1,23 +0,0 @@
1
- class Action {
2
- _name: string | null = null;
3
- get name(): string | null {
4
- return this._name;
5
- }
6
-
7
- _parms: string | null = null;
8
- get parms(): string | null {
9
- return this._parms;
10
- }
11
-
12
- constructor(attributes: any) {
13
- if (attributes.name) {
14
- this._name = attributes.name;
15
- }
16
-
17
- if (attributes.parms) {
18
- this._parms = attributes.parms;
19
- }
20
- }
21
- }
22
-
23
- export default Action;
package/src/Dashboard.ts DELETED
@@ -1,31 +0,0 @@
1
- import Action from "./Action";
2
- import { parseGenericNodes } from "./helpers/nodeParser";
3
-
4
- class Dashboard {
5
- _string: string | null = null;
6
- get string(): string | null {
7
- return this._string;
8
- }
9
-
10
- _actions: Action[] = [];
11
- get actions(): Action[] {
12
- return this._actions;
13
- }
14
-
15
- constructor(xml: string) {
16
- const parser = new DOMParser();
17
- const view: Document = parser.parseFromString(xml, "text/xml");
18
- this._string = view.documentElement.getAttribute("string");
19
- const documentElement = view.documentElement;
20
-
21
- const actionsParsed = parseGenericNodes(documentElement.childNodes);
22
-
23
- actionsParsed.forEach((nodeParsed) => {
24
- if (nodeParsed.tag === "action") {
25
- this._actions.push(new Action(nodeParsed.tagAttributes));
26
- }
27
- });
28
- }
29
- }
30
-
31
- export default Dashboard;
@@ -1,28 +0,0 @@
1
- import Dashboard from "../Dashboard";
2
-
3
- describe("A Dashboard", () => {
4
- it("should parse a basic XML with three actions", () => {
5
- const xml = `<?xml version="1.0"?>
6
- <dashboard string="My dashboard">
7
- <action name="1497" parms="{ x: 0, y: 0, w: 1, h: 2, static: true }" />
8
- <action name="1496" parms="{ x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 }" />
9
- <action name="1321" parms="{ x: 4, y: 0, w: 1, h: 2 }" />
10
- </dashboard>
11
- `;
12
-
13
- const dashboard = new Dashboard(xml);
14
-
15
- expect(dashboard.string).toBe("My dashboard");
16
- expect(dashboard.actions.length).toBe(3);
17
- expect(dashboard.actions[0].name).toBe("1497");
18
- expect(dashboard.actions[1].name).toBe("1496");
19
- expect(dashboard.actions[2].name).toBe("1321");
20
- expect(dashboard.actions[0].parms).toBe(
21
- "{ x: 0, y: 0, w: 1, h: 2, static: true }"
22
- );
23
- expect(dashboard.actions[1].parms).toBe(
24
- "{ x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 }"
25
- );
26
- expect(dashboard.actions[2].parms).toBe("{ x: 4, y: 0, w: 1, h: 2 }");
27
- });
28
- });