You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/modules/ROOT/pages/ui/implementing-a-widget.adoc
+43-1
Original file line number
Diff line number
Diff line change
@@ -135,4 +135,46 @@ Shows a horizontal line, that is used to divide children of AbstractFlatWidgetLi
135
135
Passing data can be done two ways:
136
136
137
137
- @Input() channelAddress: provide channel, which will be subscribed in AbstractFlatWidgetLine.
138
-
- @Input() value: subscribe in the ts-file and pass the subscribed value.
138
+
- @Input() value: subscribe in the ts-file and pass the subscribed value.
139
+
140
+
### Creating a modal
141
+
142
+
Creating a `modal-widget` is pretty similar to creating a `flat-widget`.
143
+
The model should act as the detailed view of a `flat-widget` and can also fit the purpose of user interaction.
144
+
145
+
There are multiple implementations of `modals` at the creation time of this page, but the one thats considered best practice is the unit-testable version.
146
+
147
+
#### Creating a Line
148
+
149
+
Lets take a look at one link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/edge/live/common/consumption/modal/modal.ts[example].
Predefined fields in link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/genericComponents/shared/oe-formly-component.ts[OeFormlyField] can be used here.
173
+
174
+
For this line we use the type 'channel-line'. This represents a line, where a channel has to be subscribed. You also need to specify the link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/genericComponents/shared/converter.ts[converter], that uses the data coming from this channel and mutates it. A link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/genericComponents/shared/filter.ts[filter], which has to return a boolean, decides if the line will be shown or not.
175
+
176
+
NOTE: Lines should always present one line of data visualisation. It could be consisting of a identifier and a value or just a value. The value or channel will be shown at the end of the line, the name, if provided, at the start.
0 commit comments