@gisce/ooui 0.1.0

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.
Files changed (191) hide show
  1. package/README.md +10 -0
  2. package/dist/Binary.d.ts +14 -0
  3. package/dist/Binary.js +46 -0
  4. package/dist/Binary.js.map +1 -0
  5. package/dist/Boolean.d.ts +8 -0
  6. package/dist/Boolean.js +26 -0
  7. package/dist/Boolean.js.map +1 -0
  8. package/dist/Button.d.ts +29 -0
  9. package/dist/Button.js +108 -0
  10. package/dist/Button.js.map +1 -0
  11. package/dist/Char.d.ts +26 -0
  12. package/dist/Char.js +89 -0
  13. package/dist/Char.js.map +1 -0
  14. package/dist/Container.d.ts +44 -0
  15. package/dist/Container.js +148 -0
  16. package/dist/Container.js.map +1 -0
  17. package/dist/ContainerWidget.d.ts +42 -0
  18. package/dist/ContainerWidget.js +125 -0
  19. package/dist/ContainerWidget.js.map +1 -0
  20. package/dist/Date.d.ts +8 -0
  21. package/dist/Date.js +26 -0
  22. package/dist/Date.js.map +1 -0
  23. package/dist/DateTime.d.ts +8 -0
  24. package/dist/DateTime.js +26 -0
  25. package/dist/DateTime.js.map +1 -0
  26. package/dist/FiberGrid.d.ts +5 -0
  27. package/dist/FiberGrid.js +23 -0
  28. package/dist/FiberGrid.js.map +1 -0
  29. package/dist/Field.d.ts +59 -0
  30. package/dist/Field.js +162 -0
  31. package/dist/Field.js.map +1 -0
  32. package/dist/Float.d.ts +24 -0
  33. package/dist/Float.js +64 -0
  34. package/dist/Float.js.map +1 -0
  35. package/dist/FloatTime.d.ts +7 -0
  36. package/dist/FloatTime.js +26 -0
  37. package/dist/FloatTime.js.map +1 -0
  38. package/dist/Form.d.ts +53 -0
  39. package/dist/Form.js +199 -0
  40. package/dist/Form.js.map +1 -0
  41. package/dist/Group.d.ts +5 -0
  42. package/dist/Group.js +23 -0
  43. package/dist/Group.js.map +1 -0
  44. package/dist/Image.d.ts +7 -0
  45. package/dist/Image.js +26 -0
  46. package/dist/Image.js.map +1 -0
  47. package/dist/Integer.d.ts +8 -0
  48. package/dist/Integer.js +26 -0
  49. package/dist/Integer.js.map +1 -0
  50. package/dist/Label.d.ts +23 -0
  51. package/dist/Label.js +80 -0
  52. package/dist/Label.js.map +1 -0
  53. package/dist/Many2many.d.ts +26 -0
  54. package/dist/Many2many.js +80 -0
  55. package/dist/Many2many.js.map +1 -0
  56. package/dist/Many2one.d.ts +20 -0
  57. package/dist/Many2one.js +63 -0
  58. package/dist/Many2one.js.map +1 -0
  59. package/dist/NewLine.d.ts +5 -0
  60. package/dist/NewLine.js +26 -0
  61. package/dist/NewLine.js.map +1 -0
  62. package/dist/Notebook.d.ts +8 -0
  63. package/dist/Notebook.js +41 -0
  64. package/dist/Notebook.js.map +1 -0
  65. package/dist/One2many.d.ts +44 -0
  66. package/dist/One2many.js +130 -0
  67. package/dist/One2many.js.map +1 -0
  68. package/dist/Page.d.ts +5 -0
  69. package/dist/Page.js +23 -0
  70. package/dist/Page.js.map +1 -0
  71. package/dist/ProgressBar.d.ts +7 -0
  72. package/dist/ProgressBar.js +26 -0
  73. package/dist/ProgressBar.js.map +1 -0
  74. package/dist/Reference.d.ts +7 -0
  75. package/dist/Reference.js +26 -0
  76. package/dist/Reference.js.map +1 -0
  77. package/dist/SearchFilter.d.ts +28 -0
  78. package/dist/SearchFilter.js +81 -0
  79. package/dist/SearchFilter.js.map +1 -0
  80. package/dist/Selection.d.ts +20 -0
  81. package/dist/Selection.js +63 -0
  82. package/dist/Selection.js.map +1 -0
  83. package/dist/Separator.d.ts +12 -0
  84. package/dist/Separator.js +46 -0
  85. package/dist/Separator.js.map +1 -0
  86. package/dist/Text.d.ts +29 -0
  87. package/dist/Text.js +96 -0
  88. package/dist/Text.js.map +1 -0
  89. package/dist/Timeline.d.ts +17 -0
  90. package/dist/Timeline.js +56 -0
  91. package/dist/Timeline.js.map +1 -0
  92. package/dist/Tree.d.ts +31 -0
  93. package/dist/Tree.js +96 -0
  94. package/dist/Tree.js.map +1 -0
  95. package/dist/Widget.d.ts +47 -0
  96. package/dist/Widget.js +116 -0
  97. package/dist/Widget.js.map +1 -0
  98. package/dist/WidgetFactory.d.ts +9 -0
  99. package/dist/WidgetFactory.js +157 -0
  100. package/dist/WidgetFactory.js.map +1 -0
  101. package/dist/helpers/attributeParser.d.ts +6 -0
  102. package/dist/helpers/attributeParser.js +83 -0
  103. package/dist/helpers/attributeParser.js.map +1 -0
  104. package/dist/helpers/contextParser.d.ts +5 -0
  105. package/dist/helpers/contextParser.js +52 -0
  106. package/dist/helpers/contextParser.js.map +1 -0
  107. package/dist/helpers/domainParser.d.ts +5 -0
  108. package/dist/helpers/domainParser.js +26 -0
  109. package/dist/helpers/domainParser.js.map +1 -0
  110. package/dist/helpers/fieldParser.d.ts +5 -0
  111. package/dist/helpers/fieldParser.js +20 -0
  112. package/dist/helpers/fieldParser.js.map +1 -0
  113. package/dist/helpers/nodeParser.d.ts +7 -0
  114. package/dist/helpers/nodeParser.js +50 -0
  115. package/dist/helpers/nodeParser.js.map +1 -0
  116. package/dist/helpers/onChangeParser.d.ts +5 -0
  117. package/dist/helpers/onChangeParser.js +16 -0
  118. package/dist/helpers/onChangeParser.js.map +1 -0
  119. package/dist/helpers/stateParser.d.ts +14 -0
  120. package/dist/helpers/stateParser.js +46 -0
  121. package/dist/helpers/stateParser.js.map +1 -0
  122. package/dist/index.d.ts +33 -0
  123. package/dist/index.js +34 -0
  124. package/dist/index.js.map +1 -0
  125. package/package.json +49 -0
  126. package/src/Binary.ts +29 -0
  127. package/src/Boolean.ts +12 -0
  128. package/src/Button.ts +78 -0
  129. package/src/Char.ts +65 -0
  130. package/src/Container.ts +171 -0
  131. package/src/ContainerWidget.ts +105 -0
  132. package/src/Date.ts +12 -0
  133. package/src/DateTime.ts +12 -0
  134. package/src/FiberGrid.ts +9 -0
  135. package/src/Field.ts +147 -0
  136. package/src/Float.ts +45 -0
  137. package/src/FloatTime.ts +8 -0
  138. package/src/Form.ts +212 -0
  139. package/src/Group.ts +9 -0
  140. package/src/Image.ts +8 -0
  141. package/src/Integer.ts +13 -0
  142. package/src/Label.ts +46 -0
  143. package/src/Many2many.ts +59 -0
  144. package/src/Many2one.ts +44 -0
  145. package/src/NewLine.ts +9 -0
  146. package/src/Notebook.ts +24 -0
  147. package/src/One2many.ts +106 -0
  148. package/src/Page.ts +9 -0
  149. package/src/ProgressBar.ts +8 -0
  150. package/src/Reference.ts +10 -0
  151. package/src/SearchFilter.ts +81 -0
  152. package/src/Selection.ts +44 -0
  153. package/src/Separator.ts +30 -0
  154. package/src/Text.ts +76 -0
  155. package/src/Timeline.ts +44 -0
  156. package/src/Tree.ts +93 -0
  157. package/src/Widget.ts +121 -0
  158. package/src/WidgetFactory.ts +158 -0
  159. package/src/helpers/attributeParser.ts +108 -0
  160. package/src/helpers/contextParser.ts +66 -0
  161. package/src/helpers/domainParser.ts +39 -0
  162. package/src/helpers/fieldParser.ts +27 -0
  163. package/src/helpers/nodeParser.ts +57 -0
  164. package/src/helpers/onChangeParser.ts +18 -0
  165. package/src/helpers/stateParser.ts +62 -0
  166. package/src/index.ts +67 -0
  167. package/src/spec/Boolean.spec.ts +36 -0
  168. package/src/spec/Button.spec.ts +58 -0
  169. package/src/spec/Char.spec.ts +80 -0
  170. package/src/spec/Container.spec.ts +47 -0
  171. package/src/spec/ContainerWidget.spec.ts +35 -0
  172. package/src/spec/Date.spec.ts +36 -0
  173. package/src/spec/DateTime.spec.ts +36 -0
  174. package/src/spec/Float.spec.ts +29 -0
  175. package/src/spec/Form.spec.ts +976 -0
  176. package/src/spec/Group.spec.ts +32 -0
  177. package/src/spec/Label.spec.ts +46 -0
  178. package/src/spec/Many2many.spec.ts +36 -0
  179. package/src/spec/Many2one.spec.ts +36 -0
  180. package/src/spec/One2many.spec.ts +354 -0
  181. package/src/spec/SearchFilter.spec.ts +955 -0
  182. package/src/spec/Selection.spec.ts +52 -0
  183. package/src/spec/Separator.spec.ts +14 -0
  184. package/src/spec/Tree.spec.ts +214 -0
  185. package/src/spec/Widget.spec.ts +45 -0
  186. package/src/spec/WidgetFactory.spec.ts +40 -0
  187. package/src/spec/attributeParser.spec.ts +173 -0
  188. package/src/spec/contextParser.spec.ts +57 -0
  189. package/src/spec/domainParser.spec.ts +40 -0
  190. package/src/spec/fixtures/WidgetImpl.ts +10 -0
  191. package/src/spec/stateParser.spec.ts +161 -0
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # OpenObject User Interface
2
+
3
+ ## Test
4
+
5
+ ```sh
6
+ $ npm install
7
+ $ npm test
8
+ ```
9
+
10
+
@@ -0,0 +1,14 @@
1
+ import Field from "./Field";
2
+ /**
3
+ * Binary base64 field
4
+ */
5
+ declare class Binary extends Field {
6
+ /**
7
+ * Filename field name
8
+ */
9
+ _filenameField: string;
10
+ get filenameField(): string;
11
+ set filenameField(value: string);
12
+ constructor(props: any);
13
+ }
14
+ export default Binary;
package/dist/Binary.js ADDED
@@ -0,0 +1,46 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import Field from "./Field";
15
+ /**
16
+ * Binary base64 field
17
+ */
18
+ var Binary = /** @class */ (function (_super) {
19
+ __extends(Binary, _super);
20
+ function Binary(props) {
21
+ var _this = _super.call(this, props) || this;
22
+ /**
23
+ * Filename field name
24
+ */
25
+ _this._filenameField = "";
26
+ if (props) {
27
+ if (props.filename) {
28
+ _this._filenameField = props.filename;
29
+ }
30
+ }
31
+ return _this;
32
+ }
33
+ Object.defineProperty(Binary.prototype, "filenameField", {
34
+ get: function () {
35
+ return this._filenameField;
36
+ },
37
+ set: function (value) {
38
+ this._filenameField = value;
39
+ },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ return Binary;
44
+ }(Field));
45
+ export default Binary;
46
+ //# sourceMappingURL=Binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Binary.js","sourceRoot":"","sources":["../src/Binary.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;;GAEG;AACH;IAAqB,0BAAK;IAYxB,gBAAY,KAAU;QAAtB,YACE,kBAAM,KAAK,CAAC,SAOb;QAnBD;;WAEG;QACH,oBAAc,GAAW,EAAE,CAAC;QAW1B,IAAI,KAAK,EAAE;YACT,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,KAAI,CAAC,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC;aACtC;SACF;;IACH,CAAC;IAfD,sBAAI,iCAAa;aAAjB;YACE,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;aACD,UAAkB,KAAa;YAC7B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC9B,CAAC;;;OAHA;IAcH,aAAC;AAAD,CAAC,AArBD,CAAqB,KAAK,GAqBzB;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ import Field from "./Field";
2
+ /**
3
+ * Boolean input
4
+ */
5
+ declare class Boolean extends Field {
6
+ constructor(props?: any);
7
+ }
8
+ export default Boolean;
@@ -0,0 +1,26 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import Field from "./Field";
15
+ /**
16
+ * Boolean input
17
+ */
18
+ var Boolean = /** @class */ (function (_super) {
19
+ __extends(Boolean, _super);
20
+ function Boolean(props) {
21
+ return _super.call(this, props) || this;
22
+ }
23
+ return Boolean;
24
+ }(Field));
25
+ export default Boolean;
26
+ //# sourceMappingURL=Boolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Boolean.js","sourceRoot":"","sources":["../src/Boolean.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;;GAEG;AACH;IAAsB,2BAAK;IACzB,iBAAY,KAAW;eACrB,kBAAM,KAAK,CAAC;IACd,CAAC;IACH,cAAC;AAAD,CAAC,AAJD,CAAsB,KAAK,GAI1B;AAED,eAAe,OAAO,CAAC"}
@@ -0,0 +1,29 @@
1
+ import Field from "./Field";
2
+ declare class Button extends Field {
3
+ /**
4
+ * Type
5
+ */
6
+ _buttonType: "workflow" | "action" | "object" | "cancel";
7
+ get buttonType(): "object" | "workflow" | "action" | "cancel";
8
+ set buttonType(value: "object" | "workflow" | "action" | "cancel");
9
+ /**
10
+ * Button caption
11
+ */
12
+ _caption: string;
13
+ get caption(): string;
14
+ set caption(value: string);
15
+ /**
16
+ * Button icon
17
+ */
18
+ _icon: string | undefined;
19
+ get icon(): string | undefined;
20
+ set icon(value: string | undefined);
21
+ /**
22
+ * Confirm string for modal in button types workflow
23
+ */
24
+ _confirmMessage: string;
25
+ get confirmMessage(): string;
26
+ set confirm(value: string);
27
+ constructor(props: any);
28
+ }
29
+ export default Button;
package/dist/Button.js ADDED
@@ -0,0 +1,108 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ var __assign = (this && this.__assign) || function () {
15
+ __assign = Object.assign || function(t) {
16
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
17
+ s = arguments[i];
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
+ t[p] = s[p];
20
+ }
21
+ return t;
22
+ };
23
+ return __assign.apply(this, arguments);
24
+ };
25
+ import Field from "./Field";
26
+ var Button = /** @class */ (function (_super) {
27
+ __extends(Button, _super);
28
+ function Button(props) {
29
+ var _this = _super.call(this, __assign(__assign({}, props), { nolabel: (props === null || props === void 0 ? void 0 : props.nolabel) !== undefined ? props.nolabel : true })) || this;
30
+ /**
31
+ * Type
32
+ */
33
+ _this._buttonType = "workflow";
34
+ /**
35
+ * Button caption
36
+ */
37
+ _this._caption = "";
38
+ /**
39
+ * Confirm string for modal in button types workflow
40
+ */
41
+ _this._confirmMessage = "";
42
+ if (props) {
43
+ if (props.string) {
44
+ _this._caption = props.string;
45
+ }
46
+ if (props.buttonType) {
47
+ _this._buttonType = props.buttonType;
48
+ }
49
+ if (props.confirm) {
50
+ _this._confirmMessage = props.confirm;
51
+ }
52
+ if (props.special && props.special === "cancel") {
53
+ _this._buttonType = "cancel";
54
+ }
55
+ if (props.icon) {
56
+ _this._icon = props.icon;
57
+ }
58
+ }
59
+ return _this;
60
+ }
61
+ Object.defineProperty(Button.prototype, "buttonType", {
62
+ get: function () {
63
+ return this._buttonType;
64
+ },
65
+ set: function (value) {
66
+ this._buttonType = value;
67
+ },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ Object.defineProperty(Button.prototype, "caption", {
72
+ get: function () {
73
+ return this._caption;
74
+ },
75
+ set: function (value) {
76
+ this._caption = value;
77
+ },
78
+ enumerable: false,
79
+ configurable: true
80
+ });
81
+ Object.defineProperty(Button.prototype, "icon", {
82
+ get: function () {
83
+ return this._icon;
84
+ },
85
+ set: function (value) {
86
+ this._icon = value;
87
+ },
88
+ enumerable: false,
89
+ configurable: true
90
+ });
91
+ Object.defineProperty(Button.prototype, "confirmMessage", {
92
+ get: function () {
93
+ return this._confirmMessage;
94
+ },
95
+ enumerable: false,
96
+ configurable: true
97
+ });
98
+ Object.defineProperty(Button.prototype, "confirm", {
99
+ set: function (value) {
100
+ this._confirmMessage = value;
101
+ },
102
+ enumerable: false,
103
+ configurable: true
104
+ });
105
+ return Button;
106
+ }(Field));
107
+ export default Button;
108
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;IAAqB,0BAAK;IA6CxB,gBAAY,KAAU;QAAtB,YACE,wCACK,KAAK,KACR,OAAO,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,MAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAC5D,SAuBH;QAvED;;WAEG;QACH,iBAAW,GAAgD,UAAU,CAAC;QAQtE;;WAEG;QACH,cAAQ,GAAW,EAAE,CAAC;QAmBtB;;WAEG;QACH,qBAAe,GAAW,EAAE,CAAC;QAc3B,IAAI,KAAK,EAAE;YACT,IAAI,KAAK,CAAC,MAAM,EAAE;gBAChB,KAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;aAC9B;YAED,IAAI,KAAK,CAAC,UAAU,EAAE;gBACpB,KAAI,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC;aACrC;YAED,IAAI,KAAK,CAAC,OAAO,EAAE;gBACjB,KAAI,CAAC,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC;aACtC;YAED,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;gBAC/C,KAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;aAC7B;YAED,IAAI,KAAK,CAAC,IAAI,EAAE;gBACd,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;aACzB;SACF;;IACH,CAAC;IAnED,sBAAI,8BAAU;aAAd;YACE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;aACD,UAAe,KAAK;YAClB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC;;;OAHA;IASD,sBAAI,2BAAO;aAAX;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;aACD,UAAY,KAAa;YACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;;;OAHA;IASD,sBAAI,wBAAI;aAAR;YACE,OAAO,IAAI,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;IA8BH,aAAC;AAAD,CAAC,AAzED,CAAqB,KAAK,GAyEzB;AAED,eAAe,MAAM,CAAC"}
package/dist/Char.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import Field from "./Field";
2
+ /**
3
+ * One-line input with a length limit.
4
+ */
5
+ declare class Char extends Field {
6
+ /**
7
+ * Field place holder
8
+ */
9
+ _placeholder: string;
10
+ get placeholder(): string;
11
+ set placeholder(value: string);
12
+ /**
13
+ * Field size
14
+ */
15
+ _size: number;
16
+ get size(): number;
17
+ set size(value: number);
18
+ _isPassword: boolean;
19
+ get isPassword(): boolean;
20
+ set isPassword(value: boolean);
21
+ _translatable: boolean;
22
+ get translatable(): boolean;
23
+ set translatable(value: boolean);
24
+ constructor(props: any);
25
+ }
26
+ export default Char;
package/dist/Char.js ADDED
@@ -0,0 +1,89 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import Field from "./Field";
15
+ /**
16
+ * One-line input with a length limit.
17
+ */
18
+ var Char = /** @class */ (function (_super) {
19
+ __extends(Char, _super);
20
+ function Char(props) {
21
+ var _this = _super.call(this, props) || this;
22
+ /**
23
+ * Field place holder
24
+ */
25
+ _this._placeholder = "";
26
+ /**
27
+ * Field size
28
+ */
29
+ _this._size = 150;
30
+ _this._isPassword = false;
31
+ _this._translatable = false;
32
+ if (props) {
33
+ if (props.size) {
34
+ _this._size = props.size;
35
+ }
36
+ if (props.password) {
37
+ _this.isPassword = props.password === "True" ? true : false;
38
+ }
39
+ if (props.translate) {
40
+ _this.translatable =
41
+ props.translate === "True" || props.translate === true ? true : false;
42
+ }
43
+ }
44
+ return _this;
45
+ }
46
+ Object.defineProperty(Char.prototype, "placeholder", {
47
+ get: function () {
48
+ return this._placeholder;
49
+ },
50
+ set: function (value) {
51
+ this._placeholder = value;
52
+ },
53
+ enumerable: false,
54
+ configurable: true
55
+ });
56
+ Object.defineProperty(Char.prototype, "size", {
57
+ get: function () {
58
+ return this._size;
59
+ },
60
+ set: function (value) {
61
+ this._size = value;
62
+ },
63
+ enumerable: false,
64
+ configurable: true
65
+ });
66
+ Object.defineProperty(Char.prototype, "isPassword", {
67
+ get: function () {
68
+ return this._isPassword;
69
+ },
70
+ set: function (value) {
71
+ this._isPassword = value;
72
+ },
73
+ enumerable: false,
74
+ configurable: true
75
+ });
76
+ Object.defineProperty(Char.prototype, "translatable", {
77
+ get: function () {
78
+ return this._translatable;
79
+ },
80
+ set: function (value) {
81
+ this._translatable = value;
82
+ },
83
+ enumerable: false,
84
+ configurable: true
85
+ });
86
+ return Char;
87
+ }(Field));
88
+ export default Char;
89
+ //# sourceMappingURL=Char.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Char.js","sourceRoot":"","sources":["../src/Char.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B;;GAEG;AACH;IAAmB,wBAAK;IAuCtB,cAAY,KAAU;QAAtB,YACE,kBAAM,KAAK,CAAC,SAgBb;QAvDD;;WAEG;QACH,kBAAY,GAAW,EAAE,CAAC;QAQ1B;;WAEG;QACH,WAAK,GAAW,GAAG,CAAC;QAQpB,iBAAW,GAAY,KAAK,CAAC;QAQ7B,mBAAa,GAAY,KAAK,CAAC;QAW7B,IAAI,KAAK,EAAE;YACT,IAAI,KAAK,CAAC,IAAI,EAAE;gBACd,KAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;aACzB;YAED,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,KAAI,CAAC,UAAU,GAAG,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;aAC5D;YAED,IAAI,KAAK,CAAC,SAAS,EAAE;gBACnB,KAAI,CAAC,YAAY;oBACf,KAAK,CAAC,SAAS,KAAK,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;aACzE;SACF;;IACH,CAAC;IAnDD,sBAAI,6BAAW;aAAf;YACE,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;aACD,UAAgB,KAAa;YAC3B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC5B,CAAC;;;OAHA;IASD,sBAAI,sBAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;aACD,UAAS,KAAa;YACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;;;OAHA;IAMD,sBAAI,4BAAU;aAAd;YACE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC1B,CAAC;aACD,UAAe,KAAc;YAC3B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC;;;OAHA;IAMD,sBAAI,8BAAY;aAAhB;YACE,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;aACD,UAAiB,KAAc;YAC7B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC7B,CAAC;;;OAHA;IAuBH,WAAC;AAAD,CAAC,AAzDD,CAAmB,KAAK,GAyDvB;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,44 @@
1
+ import Widget from "./Widget";
2
+ declare type AddWidgetOptions = {
3
+ addLabel: boolean;
4
+ };
5
+ declare class Container {
6
+ /**
7
+ * Number of columns the container is divided
8
+ */
9
+ _columns: number;
10
+ get columns(): number;
11
+ set columns(value: number);
12
+ /**
13
+ * Number of columns to use
14
+ */
15
+ _colspan: number;
16
+ get colspan(): number;
17
+ set colspan(value: number);
18
+ /**
19
+ * Number of rows
20
+ */
21
+ _rows: Widget[][];
22
+ get rows(): Widget[][];
23
+ set rows(value: Widget[][]);
24
+ _index: number;
25
+ get index(): number;
26
+ /**
27
+ * Determines if widget is read only (default is false)
28
+ */
29
+ _readOnly: boolean;
30
+ get readOnly(): boolean;
31
+ set readOnly(value: boolean);
32
+ constructor(columns?: number, colspan?: number, readOnly?: boolean);
33
+ /**
34
+ * Returns the next free position
35
+ */
36
+ freePosition(): number;
37
+ addWidget(widget: Widget, options?: AddWidgetOptions): void;
38
+ /**
39
+ * Traverses children to find a matching container or widget with the exact same id.
40
+ * @param {string} id id (name) of the field or container to find
41
+ */
42
+ findById(id: string): Widget | null;
43
+ }
44
+ export default Container;
@@ -0,0 +1,148 @@
1
+ import Field from "./Field";
2
+ import NewLine from "./NewLine";
3
+ import Label from "./Label";
4
+ var Container = /** @class */ (function () {
5
+ function Container(columns, colspan, readOnly) {
6
+ if (columns === void 0) { columns = 4; }
7
+ if (colspan === void 0) { colspan = 6; }
8
+ if (readOnly === void 0) { readOnly = false; }
9
+ this._columns = columns;
10
+ this._colspan = colspan;
11
+ this._rows = [[]];
12
+ this._index = 0;
13
+ this._readOnly = readOnly;
14
+ }
15
+ Object.defineProperty(Container.prototype, "columns", {
16
+ get: function () {
17
+ return this._columns;
18
+ },
19
+ set: function (value) {
20
+ this._columns = value;
21
+ },
22
+ enumerable: false,
23
+ configurable: true
24
+ });
25
+ Object.defineProperty(Container.prototype, "colspan", {
26
+ get: function () {
27
+ return this._colspan;
28
+ },
29
+ set: function (value) {
30
+ this._colspan = value;
31
+ },
32
+ enumerable: false,
33
+ configurable: true
34
+ });
35
+ Object.defineProperty(Container.prototype, "rows", {
36
+ get: function () {
37
+ return this._rows;
38
+ },
39
+ set: function (value) {
40
+ this._rows = value;
41
+ },
42
+ enumerable: false,
43
+ configurable: true
44
+ });
45
+ Object.defineProperty(Container.prototype, "index", {
46
+ get: function () {
47
+ return this._index;
48
+ },
49
+ enumerable: false,
50
+ configurable: true
51
+ });
52
+ Object.defineProperty(Container.prototype, "readOnly", {
53
+ get: function () {
54
+ return this._readOnly;
55
+ },
56
+ set: function (value) {
57
+ this._readOnly = value;
58
+ },
59
+ enumerable: false,
60
+ configurable: true
61
+ });
62
+ /**
63
+ * Returns the next free position
64
+ */
65
+ Container.prototype.freePosition = function () {
66
+ var span = this._rows[this._index]
67
+ .filter(function (el) {
68
+ return !el.invisible;
69
+ })
70
+ .reduce(function (prev, current) {
71
+ return prev + current.colspan;
72
+ }, 0);
73
+ return this._columns - span;
74
+ };
75
+ Container.prototype.addWidget = function (widget, options) {
76
+ var widgetsToAdd = [];
77
+ var addLabel = options ? options.addLabel : true;
78
+ if (widget instanceof NewLine) {
79
+ this._rows.push([]);
80
+ this._index++;
81
+ return;
82
+ }
83
+ if (widget.colspan > this._columns) {
84
+ // Widget colspan is greater than container columns, so we change widget
85
+ // colspan to fit container columns.
86
+ widget.colspan = this._columns;
87
+ }
88
+ // If the container is set to readonly, reflect it to its children
89
+ widget.readOnly = widget.readOnly || this.readOnly;
90
+ // For fields without nolabel we add a preceding label widget
91
+ if (addLabel && widget instanceof Field && !widget.nolabel) {
92
+ if (widget.colspan > 1) {
93
+ widget.colspan -= 1; // We substract one colspan for the corresponding label
94
+ }
95
+ var label = new Label({
96
+ name: widget.id + "_label",
97
+ string: widget.label,
98
+ invisible: widget.invisible,
99
+ help: widget.tooltip,
100
+ fieldForLabel: widget.id,
101
+ });
102
+ label.type = "label";
103
+ widgetsToAdd.push(label);
104
+ widgetsToAdd.push(widget);
105
+ }
106
+ else {
107
+ widgetsToAdd.push(widget);
108
+ }
109
+ var widgetsColspan = widgetsToAdd.reduce(function (accumulator, currentWidget) {
110
+ return accumulator + currentWidget.colspan;
111
+ }, 0);
112
+ if (widgetsColspan > this.freePosition()) {
113
+ this._rows.push([]);
114
+ this._index++;
115
+ }
116
+ this._rows[this._index] = this._rows[this._index].concat(widgetsToAdd);
117
+ };
118
+ /**
119
+ * Traverses children to find a matching container or widget with the exact same id.
120
+ * @param {string} id id (name) of the field or container to find
121
+ */
122
+ Container.prototype.findById = function (id) {
123
+ var r = null;
124
+ if (this._rows && this._rows.length) {
125
+ this._rows.forEach(function (row) {
126
+ if (r) {
127
+ // Item has been found.
128
+ return;
129
+ }
130
+ if (row && row.length) {
131
+ row.forEach(function (item) {
132
+ if (r) {
133
+ // Item has been found.
134
+ return;
135
+ }
136
+ if (item) {
137
+ r = item.findById(id);
138
+ }
139
+ });
140
+ }
141
+ });
142
+ }
143
+ return r;
144
+ };
145
+ return Container;
146
+ }());
147
+ export default Container;
148
+ //# sourceMappingURL=Container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Container.js","sourceRoot":"","sources":["../src/Container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,OAAO,MAAM,WAAW,CAAC;AAEhC,OAAO,KAAK,MAAM,SAAS,CAAC;AAM5B;IAkDE,mBACE,OAAmB,EACnB,OAAmB,EACnB,QAAyB;QAFzB,wBAAA,EAAA,WAAmB;QACnB,wBAAA,EAAA,WAAmB;QACnB,yBAAA,EAAA,gBAAyB;QAEzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAvDD,sBAAI,8BAAO;aAAX;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;aACD,UAAY,KAAa;YACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;;;OAHA;IASD,sBAAI,8BAAO;aAAX;YACE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;aACD,UAAY,KAAa;YACvB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;;;OAHA;IASD,sBAAI,2BAAI;aAAR;YACE,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;aACD,UAAS,KAAiB;YACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;;;OAHA;IAMD,sBAAI,4BAAK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EAAE;YACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAC,GAAG;gBACrB,IAAI,CAAC,EAAE;oBACL,uBAAuB;oBACvB,OAAO;iBACR;gBAED,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE;oBACrB,GAAG,CAAC,OAAO,CAAC,UAAC,IAAI;wBACf,IAAI,CAAC,EAAE;4BACL,uBAAuB;4BACvB,OAAO;yBACR;wBACD,IAAI,IAAI,EAAE;4BACR,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;yBACvB;oBACH,CAAC,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IACH,gBAAC;AAAD,CAAC,AA/JD,IA+JC;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,42 @@
1
+ import Widget from "./Widget";
2
+ import Container from "./Container";
3
+ declare class ContainerWidget extends Widget {
4
+ /**
5
+ * Field identifier
6
+ *
7
+ * Corresponds to the field's name attribute from xml
8
+ */
9
+ _id: string;
10
+ get id(): string;
11
+ set id(value: string);
12
+ static _defaultColspan: number;
13
+ static get defaultColspan(): number;
14
+ static set defaultColspan(value: number);
15
+ /**
16
+ * Container
17
+ */
18
+ _container: Container;
19
+ get container(): Container;
20
+ set container(value: Container);
21
+ get colspan(): number;
22
+ set colspan(value: number);
23
+ /**
24
+ * Must expand widget
25
+ */
26
+ _mustExpand: boolean;
27
+ get mustExpand(): boolean;
28
+ set mustExpand(value: boolean);
29
+ /**
30
+ * Container label
31
+ */
32
+ _label: string;
33
+ get label(): string;
34
+ set label(value: string);
35
+ constructor(props?: any);
36
+ /**
37
+ * Calls container's findById method to find the widgets matching with param id
38
+ * @param {string} id id to find
39
+ */
40
+ findById(id: string): Widget | null;
41
+ }
42
+ export default ContainerWidget;