@gisce/ooui 2.18.0-alpha.3 → 2.18.0-alpha.5
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/Indicator.d.ts.map +1 -1
- package/dist/Spinner.d.ts +9 -0
- package/dist/Spinner.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 +130 -108
- package/dist/ooui.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Indicator.ts +5 -1
- package/src/Spinner.ts +23 -0
- package/src/WidgetFactory.ts +4 -0
- package/src/index.ts +2 -0
- package/src/spec/Spinner.spec.ts +35 -0
package/package.json
CHANGED
package/src/Indicator.ts
CHANGED
|
@@ -66,7 +66,11 @@ class Indicator extends Selection {
|
|
|
66
66
|
this._actionId = parseInt(props.action_id);
|
|
67
67
|
}
|
|
68
68
|
if (props.height) {
|
|
69
|
-
|
|
69
|
+
try {
|
|
70
|
+
this._height = parseInt(props.height);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.error(e);
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
}
|
package/src/Spinner.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import ContainerWidget from "./ContainerWidget";
|
|
2
|
+
|
|
3
|
+
class Spinner extends ContainerWidget {
|
|
4
|
+
_loading = false;
|
|
5
|
+
get loading(): boolean {
|
|
6
|
+
return this._loading;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
set loading(value: boolean) {
|
|
10
|
+
this._loading = value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
constructor(props?: any) {
|
|
14
|
+
super(props);
|
|
15
|
+
if (props) {
|
|
16
|
+
if (props.loading) {
|
|
17
|
+
this._loading = props.loading;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default Spinner;
|
package/src/WidgetFactory.ts
CHANGED
|
@@ -40,6 +40,7 @@ import Alert from "./Alert";
|
|
|
40
40
|
import Comments from "./Comments";
|
|
41
41
|
import JSONField from "./JSONField";
|
|
42
42
|
import Email from "./Email";
|
|
43
|
+
import Spinner from "./Spinner";
|
|
43
44
|
|
|
44
45
|
class WidgetFactory {
|
|
45
46
|
/**
|
|
@@ -180,6 +181,9 @@ class WidgetFactory {
|
|
|
180
181
|
case "arrow_steps":
|
|
181
182
|
this._widgetClass = JSONField;
|
|
182
183
|
break;
|
|
184
|
+
case "spinner":
|
|
185
|
+
this._widgetClass = Spinner;
|
|
186
|
+
break;
|
|
183
187
|
default:
|
|
184
188
|
break;
|
|
185
189
|
}
|
package/src/index.ts
CHANGED
|
@@ -52,6 +52,7 @@ import Alert from "./Alert";
|
|
|
52
52
|
import JSONField from "./JSONField";
|
|
53
53
|
import Comments from "./Comments";
|
|
54
54
|
import Email from "./Email";
|
|
55
|
+
import Spinner from "./Spinner";
|
|
55
56
|
|
|
56
57
|
import {
|
|
57
58
|
Graph,
|
|
@@ -140,4 +141,5 @@ export {
|
|
|
140
141
|
Comments,
|
|
141
142
|
JSONField,
|
|
142
143
|
Email,
|
|
144
|
+
Spinner,
|
|
143
145
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import WidgetFactory from "../WidgetFactory";
|
|
2
|
+
import Spinner from "../Spinner";
|
|
3
|
+
import { it, expect, describe } from "vitest";
|
|
4
|
+
|
|
5
|
+
describe("A Spinner", () => {
|
|
6
|
+
it("should have an id corresponding to field name", () => {
|
|
7
|
+
const widgetFactory = new WidgetFactory();
|
|
8
|
+
const props = {
|
|
9
|
+
name: "spinner",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const widget = widgetFactory.createWidget("spinner", props);
|
|
13
|
+
expect(widget).toBeInstanceOf(Spinner);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should properly set label", () => {
|
|
17
|
+
const widgetFactory = new WidgetFactory();
|
|
18
|
+
const props = {
|
|
19
|
+
name: "spinner",
|
|
20
|
+
string: "spinner caption",
|
|
21
|
+
};
|
|
22
|
+
const widget = widgetFactory.createWidget("spinner", props);
|
|
23
|
+
|
|
24
|
+
expect(widget.label).toBe("spinner caption");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should have loading as false by default", () => {
|
|
28
|
+
const widgetFactory = new WidgetFactory();
|
|
29
|
+
const props = {
|
|
30
|
+
name: "spinner",
|
|
31
|
+
};
|
|
32
|
+
const widget = widgetFactory.createWidget("spinner", props);
|
|
33
|
+
expect(widget.loading).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
});
|