mountain-ui 1.0.116 → 1.0.118
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 +1 -1
- package/src/lib/registry/widgetGroupRegistry/components/GroupPreview.svelte +1 -1
- package/src/lib/registry/widgetGroupRegistry/createWidget.js +11 -5
- package/src/lib/registry/widgetGroupRegistry/registry.svelte.js +19 -0
- package/src/lib/registry/widgetTypeRegistry/createWidgetType.js +2 -2
- package/src/lib/registry/widgetTypeRegistry/widgetTypes/Bar/index.js +3 -0
- package/src/lib/registry/widgetTypeRegistry/widgetTypes/Evolution/index.js +3 -0
- package/src/lib/registry/widgetTypeRegistry/widgetTypes/KPI/index.js +3 -0
- package/src/lib/registry/widgetTypeRegistry/widgetTypes/List/index.js +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mountain-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.118",
|
|
5
5
|
"description": "A comprehensive UI component library for ERP systems with field types, entities, and registry management built with Svelte",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "index.js",
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { get } from "svelte/store";
|
|
2
|
+
import { widgetTypeRegistry } from "../widgetTypeRegistry/registry.svelte";
|
|
1
3
|
|
|
2
4
|
|
|
3
5
|
export function createWidget(config = {}) {
|
|
4
6
|
const widget = {
|
|
5
7
|
id: null,
|
|
6
|
-
group_id:null,
|
|
7
|
-
position:1,
|
|
8
|
-
type:null,
|
|
9
|
-
title:"",
|
|
10
|
-
props:{},
|
|
8
|
+
group_id: null,
|
|
9
|
+
position: 1,
|
|
10
|
+
type: null,
|
|
11
|
+
title: "",
|
|
12
|
+
props: {},
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
Object.assign(widget, config);
|
|
14
16
|
|
|
17
|
+
widget.getEntityIds = () => {
|
|
18
|
+
const widgetType = widgetTypeRegistry.get(widget.type)
|
|
19
|
+
return widgetType.getEntityIds(widget.props)
|
|
20
|
+
}
|
|
15
21
|
|
|
16
22
|
return widget;
|
|
17
23
|
}
|
|
@@ -41,6 +41,25 @@ function createWidgetGroupRegistry() {
|
|
|
41
41
|
getAll() {
|
|
42
42
|
return all;
|
|
43
43
|
},
|
|
44
|
+
|
|
45
|
+
getWidgetIdFromEntityId(entityId) {
|
|
46
|
+
const allWidgetGroups = get(this.getAll())
|
|
47
|
+
|
|
48
|
+
let widgetIds = []
|
|
49
|
+
|
|
50
|
+
for (const widgetGroup of allWidgetGroups) {
|
|
51
|
+
for (const widget of widgetGroup.children) {
|
|
52
|
+
const entityIds = widget.getEntityIds()
|
|
53
|
+
|
|
54
|
+
if (!entityIds.includes(entityId)) continue
|
|
55
|
+
|
|
56
|
+
widgetIds.push(widget.id)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return widgetIds;
|
|
61
|
+
|
|
62
|
+
},
|
|
44
63
|
};
|
|
45
64
|
}
|
|
46
65
|
|