@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/dist/Label.d.ts +1 -1
- package/dist/Label.d.ts.map +1 -1
- package/dist/Markdown.d.ts +5 -0
- package/dist/Markdown.d.ts.map +1 -0
- package/dist/WidgetFactory.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/ooui.es.js +442 -436
- package/dist/ooui.es.js.map +1 -1
- package/dist/ooui.umd.js +5 -5
- package/dist/ooui.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/Label.ts +2 -2
- package/src/Markdown.ts +6 -0
- package/src/WidgetFactory.ts +4 -0
- package/src/index.ts +2 -0
- package/src/spec/Label.spec.ts +3 -3
- package/src/spec/Markdown.spec.ts +13 -0
package/package.json
CHANGED
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 =
|
|
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 =
|
|
44
|
+
_labelSize: LabelSize = undefined;
|
|
45
45
|
get labelSize(): LabelSize {
|
|
46
46
|
return this._labelSize;
|
|
47
47
|
}
|
package/src/Markdown.ts
ADDED
package/src/WidgetFactory.ts
CHANGED
|
@@ -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,
|
package/src/spec/Label.spec.ts
CHANGED
|
@@ -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(
|
|
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
|
-
[
|
|
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':
|
|
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
|
+
});
|