@gisce/ooui 0.19.2 → 0.19.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/ooui",
3
- "version": "0.19.2",
3
+ "version": "0.19.4",
4
4
  "main": "./dist/ooui.umd.js",
5
5
  "module": "./dist/ooui.es.js",
6
6
  "types": "./dist/index.d.ts",
package/src/Label.ts CHANGED
@@ -2,7 +2,7 @@ import Field from "./Field";
2
2
 
3
3
 
4
4
  type LabelType = "secondary" | "success" | "warning" | "danger" | "default";
5
- type LabelSize = "h1" | "h2" | "h3" | "h4" | "h5" | "text";
5
+ type LabelSize = 1 | 2 | 3 | 4 | 5 | undefined;
6
6
 
7
7
  class Label extends Field {
8
8
  /**
@@ -41,7 +41,7 @@ class Label extends Field {
41
41
  /**
42
42
  * Label size
43
43
  */
44
- _labelSize: LabelSize = "text";
44
+ _labelSize: LabelSize = undefined;
45
45
  get labelSize(): LabelSize {
46
46
  return this._labelSize;
47
47
  }
@@ -0,0 +1,6 @@
1
+ import Text from "./Text";
2
+
3
+ class Markdown extends Text {}
4
+
5
+
6
+ export default Markdown;
@@ -8,6 +8,7 @@ import Char from "./Char";
8
8
  import Text from "./Text";
9
9
  import Selection from "./Selection";
10
10
  import Many2one from "./Many2one";
11
+ import Markdown from "./Markdown";
11
12
  import Boolean from "./Boolean";
12
13
  import Integer from "./Integer";
13
14
  import Widget from "./Widget";
@@ -96,6 +97,9 @@ class WidgetFactory {
96
97
  case "many2many":
97
98
  this._widgetClass = Many2many;
98
99
  break;
100
+ case "markdown":
101
+ this._widgetClass = Markdown;
102
+ break;
99
103
  case "one2many":
100
104
  case "one2many_list":
101
105
  this._widgetClass = One2many;
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ import ProgressBar from "./ProgressBar";
16
16
  import Date from "./Date";
17
17
  import DateTime from "./DateTime";
18
18
  import Many2many from "./Many2many";
19
+ import Markdown from "./Markdown";
19
20
  import One2many from "./One2many";
20
21
  import SearchFilter from "./SearchFilter";
21
22
  import Text from "./Text";
@@ -112,6 +113,7 @@ export {
112
113
  Tags,
113
114
  Tag,
114
115
  MultiCheckbox,
116
+ Markdown,
115
117
  Radio,
116
118
  Switch,
117
119
  Steps,
@@ -75,15 +75,15 @@ describe("A Label", () => {
75
75
  widget_props: "{}"
76
76
  };
77
77
  const widget = widgetFactory.createWidget("label", props);
78
- expect(widget.labelSize).toBe("text");
78
+ expect(widget.labelSize).toBe(undefined);
79
79
  });
80
80
  it("should have allow size to h1...h5", () => {
81
81
  const widgetFactory = new WidgetFactory();
82
- ['h1', 'h2', 'h3', 'h4', 'h5'].map((level) => {
82
+ [1, 2, 3, 4, 5].map((level) => {
83
83
  const props = {
84
84
  name: "field_label",
85
85
  string: "Default",
86
- widget_props: `{'label_size': '${level}'}`
86
+ widget_props: `{'label_size': ${level}}`
87
87
  };
88
88
  const widget = widgetFactory.createWidget("label", props);
89
89
  expect(widget.labelSize).toBe(level);
@@ -0,0 +1,13 @@
1
+ import WidgetFactory from "../WidgetFactory";
2
+
3
+ describe("A Markdown widget", () => {
4
+ it("should have an id corresponding to field name", () => {
5
+ const widgetFactory = new WidgetFactory();
6
+ const props = {
7
+ name: "status",
8
+ };
9
+
10
+ const widget = widgetFactory.createWidget("markdown", props);
11
+ expect(widget.id).toBe("status");
12
+ });
13
+ });