Skip to content

Commit c94e592

Browse files
committed
Update the documentation.
1 parent ac048f3 commit c94e592

File tree

1 file changed

+47
-6
lines changed

1 file changed

+47
-6
lines changed

docs/module-configuration.md

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,63 @@ JSON configuration objects for Wegue modules.
44

55
## General
66

7-
The `modules` object contains sub-objects, whereas the key is the identifier for the module and the value is the dedicated module configuration. For example:
7+
The modules object contains sub-objects, where the key is the identifier for the module instance and the value is the dedicated module configuration. For example:
88

99
```json
10-
"wgu-layerlist": {
11-
"target": "menu",
12-
"win": "floating",
13-
"draggable": false
14-
}
10+
"wgu-layerlist": {
11+
"target": "menu",
12+
"win": "floating",
13+
"draggable": false
14+
}
1515
```
1616

17+
### Module identifier and module type
18+
In general, the identifier specifies the type of module to be added.
19+
In the example above, Wegue will look for a Vue component matching the module type `wgu-layerlist` and automatically append the `-win` suffix when resolving the component name. Internally, this results in the component `wgu-layerlist-win`, which must be registered in the application, for example:
20+
21+
```js
22+
import LayerListWin from '@/components/layerlist/LayerListWin.vue';
23+
24+
components: {
25+
'wgu-layerlist-win': LayerListWin
26+
}
27+
```
28+
This approach allows simple module definitions where the identifier directly maps to a single module instance.
29+
30+
### Multiple instances of the same module type
31+
To allow multiple instances of the same module type, the module identifier can be chosen arbitrarily. In this case, the actual module type must be specified explicitly using the `moduleType` property.
32+
Example:
33+
```json
34+
"wgu-layerlist1": {
35+
"moduleType": "wgu-layerlist",
36+
"target": "menu",
37+
"win": "floating",
38+
"draggable": false
39+
},
40+
"wgu-layerlist2": {
41+
"moduleType": "wgu-layerlist",
42+
"target": "menu",
43+
"win": "floating",
44+
"draggable": false
45+
}
46+
```
47+
In this configuration:
48+
* `wgu-layerlist1` and `wgu-layerlist2` are instance identifiers.
49+
* Both instances reference the same module type via `"moduleType": "wgu-layerlist"`
50+
* Wegue will create two independent instances of the `wgu-layerlist` module.
51+
* Each instance has its own configuration, state, and window (if applicable)
52+
If `moduleType` is omitted, Wegue assumes that the module identifier itself represents the module type.
53+
54+
55+
### Common module properties
56+
1757
The following properties can be applied to all module types:
1858

1959
| Property | Meaning | Example |
2060
|--------------------|:---------:|---------|
2161
| **target** | Where should the button to enable/disable the module be rendered. Valid options are `menu` or `toolbar` | `"target": "menu"` |
2262
| **win** | Value to mark if the module has a window as sub component and where to show the module UI elements. Valid options are `floating` and `sidebar`. If the value is omitted, then the module is not associated with a window. | `"win": "floating"` |
63+
| moduleType | Optional module type. Required only if different from the module identifier (e.g. for multi-instantiation). | `"moduleType": "wgu-layerlist"`
2364
| icon | Provide a customized icon for the module. | `"icon": "md:info"` |
2465
| minimizable | Indicates whether the module window can be minimized. Only applies if a module window is present as indicated by the `win` parameter. | `"minimizable": true` |
2566
| closable | Indicates whether the module window can be closed by a "X" icon in the window's header bar. Only applies if a module window is present as indicated by the `win` parameter. | `"closable": false` |

0 commit comments

Comments
 (0)