--- a/svghmi/detachable_pages.ysl2 Mon Jan 04 13:57:11 2021 +0100
+++ b/svghmi/detachable_pages.ysl2 Tue Jan 05 01:23:45 2021 +0100
@@ -150,9 +150,6 @@
foreach "$parsed_widgets/widget[@id = $all_page_widgets/@id and @type='Jump']" {
- const "opts" call "jump_widget_activity" with "hmi_element", "$hmi_elements[@id=$_id]";
- if "string-length($opts)>0"
| hmi_widgets["«@id»"]`if "position()!=last()" > ,`
--- a/svghmi/widget_dropdown.ysl2 Mon Jan 04 13:57:11 2021 +0100
+++ b/svghmi/widget_dropdown.ysl2 Tue Jan 05 01:23:45 2021 +0100
@@ -335,9 +335,10 @@
template "widget[@type='DropDown']", mode="widget_defs" {
labels("text box button highlight");
+ // It is assumed that list content conforms to Array interface. - // It is assumed that list content conforms to Array interface.
+ /* TODO : Support HMI:List */ ``foreach "arg" | "«@value»",
--- a/svghmi/widget_jump.ysl2 Mon Jan 04 13:57:11 2021 +0100
+++ b/svghmi/widget_jump.ysl2 Tue Jan 05 01:23:45 2021 +0100
@@ -1,88 +1,83 @@
-function "jump_widget_activity" {
- optional_labels("active inactive");
+template "widget[@type='Jump']", mode="widget_class"{ + class JumpWidget extends Widget{ + this.active_elt.setAttribute("style", this.active_elt_style); + this.inactive_elt.setAttribute("style", "display:none"); + this.inactive_elt.setAttribute("style", this.inactive_elt_style); + this.active_elt.setAttribute("style", "display:none"); -function "jump_widget_disability" {
- optional_labels("disabled");
+ const name = this.args[0]; + /* TODO: suport path pointing to local variable whom value + would be an HMI_TREE index to jump to a relative page */ + const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; + switch_page(name, index); + notify_page_change(page_name, index) { + const ref_index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined; + const ref_name = this.args[0]; + this.active = ((ref_name == undefined || ref_name == page_name) && index == ref_index); + this.update_activity(); + this.disabled = !Number(value); + this.disabled_elt.setAttribute("style", this.disabled_elt_style); + this.inactive_elt.setAttribute("style", "display:none"); + this.active_elt.setAttribute("style", "display:none"); + this.disabled_elt.setAttribute("style", "display:none"); + this.update_activity(); template "widget[@type='Jump']", mode="widget_defs" {
- const "activity" call "jump_widget_activity" with "hmi_element", "$hmi_element";
+ const "activity" optional_labels("active inactive"); const "have_activity","string-length($activity)>0";
- const "disability" call "jump_widget_disability" with "hmi_element", "$hmi_element";
+ const "disability" optional_labels("disabled"); const "have_disability","$have_activity and string-length($disability)>0";
- if "$have_disability" {
- | dispatch: function(value) {
- | this.disabled = !Number(value);
- if "$have_disability" {
- | this.disabled_elt.setAttribute("style", this.active_elt_style);
- | this.inactive_elt.setAttribute("style", "display:none");
- | this.active_elt.setAttribute("style", "display:none");
- | this.disabled_elt.setAttribute("style", "display:none");
- | this.active_elt.setAttribute("style", this.active_elt_style);
- | this.inactive_elt.setAttribute("style", "display:none");
- | this.inactive_elt.setAttribute("style", this.inactive_elt_style);
- | this.active_elt.setAttribute("style", "display:none");
- if "$have_disability" {
- | notify_page_change: function(page_name, index){
- | const ref_index = this.indexes.length > 0 ? this.indexes[0] + this.offset : undefined;
- | const ref_name = this.args[0];
- | this.active =((ref_name == undefined || ref_name == page_name) && index == ref_index);
- | const name = this.args[0];
- | return function(evt){
- | const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined;
- | switch_page(name, index);
- /* registering event this way does not "click" through svg:use
- | this.element.onclick = evt => switch_page(this.args[0]);
- event must be registered by adding attribute to element instead
- TODO : generalize mouse event handling by global event capture + getElementsAtPoint()
| this.element.onclick = this.make_on_click();
| this.active_elt_style = this.active_elt.getAttribute("style");
| this.inactive_elt_style = this.inactive_elt.getAttribute("style");
+ | this.activable = true; when "$have_disability" {
@@ -99,6 +94,7 @@
/* check that given path is compatible with page's reference path */
+ /* TODO: suport local variable containing an HMI_TREE index to jump to a relative page */ /* when no page name provided, check for same page */
const "target_page_name" choose {
when "arg" value "arg[1]/@value";