{% macro build_widget_checkbox(param_group, widget) %} {{ widget.label }} {% endmacro %} {# https://ru.stackoverflow.com/questions/1241064 #} {% macro build_widget_number(param_group, widget) %}{{ widget.label }}{% endmacro %} {% macro js_build_number_number_validator(widget) %}{{ '{' }}{% if widget['min'] %}min:{{ widget['min'] }},{% endif %}{% if widget['max'] %}max:{{ widget['max'] }},{% endif %}{% if widget['step'] %}step:{{ widget['step'] }}{% endif %}{{ '}' }}{% endmacro %} {% macro build_widget_number_int(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget_select(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget_watch(param_group, widget) %}{{ widget.label }}{% endmacro %} {% macro build_widget_watch_expr(param_group, widget) %} {{ widget.label }}{{ '{{ ' ~ widget.expr ~ ' }}' }} {% endmacro %} {% macro build_widget_modulation_modcod(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget_modulation_speed(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget_flex_container(param_group, widget) %}
{% for w in widget.childs %}{{ build_widget(param_group, w) | indent(4, true) }}{% endfor %}
{% endmacro %} {% macro build_widget_settings_container(param_group, widget) %}
{% for w in widget.childs %}{{ build_widget(param_group, w) | indent(4, true) }}{% endfor %}
{% endmacro %} {% macro build_widget_ip_address(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget_text(param_group, widget) %} {{ widget.label }} {% endmacro %} {% macro build_widget(param_group, widget) %}{% if widget.widget == 'flex-container' %}{{ build_widget_flex_container(param_group, widget) }} {% elif widget.widget == 'settings-container' %}{{ build_widget_settings_container(param_group, widget) }} {% elif widget.widget == 'h2' %}{{ widget.label }} {% elif widget.widget == 'h3' %}{{ widget.label }} {% elif widget.widget == 'submit' %} {% elif widget.widget == 'checkbox' %}{{ build_widget_checkbox(param_group, widget) }} {% elif widget.widget == 'number' %}{{ build_widget_number(param_group, widget) }} {% elif widget.widget == 'number-int' %}{{ build_widget_number_int(param_group, widget) }} {% elif widget.widget == 'watch' %}{{ build_widget_watch(param_group, widget) }} {% elif widget.widget == 'watch-expr' %}{{ build_widget_watch_expr(param_group, widget) }} {% elif widget.widget == 'select' %}{{ build_widget_select(param_group, widget) }} {% elif widget.widget == 'modulation-modcod' %}{{ build_widget_modulation_modcod(param_group, widget) }} {% elif widget.widget == 'modulation-speed' %}{{ build_widget_modulation_speed(param_group, widget) }} {% elif widget.widget == 'ip-address' %}{{ build_widget_ip_address(param_group, widget) }} {% elif widget.widget == 'text' %}{{ build_widget_text(param_group, widget) }} {% else %}

Widget '{{ widget.widget }}' not defined!

{{ widget }}

{% endif %} {% endmacro %} {% macro build_getter_js(param_group, widget) %}{% if widget.widget in ['flex-container', 'settings-container', 'h2', 'h3', 'submit', 'watch', 'watch-expr'] %}null{% elif widget.widget in ['checkbox', 'number', 'select', 'ip-address', 'modulation-modcod', 'modulation-speed', 'text'] %}this.param{{ param_group | title }}.{{ widget.name }}{% elif widget.widget == 'number-int' %}parseFloat(this.param{{ param_group | title }}.{{ widget.name }}.replace(/[^0-9,.]/g, '').replace(',', '.')){% else %}

Widget '{{ widget.widget }}' not defined!

{{ widget }}

{% endif %}{% endmacro %} {% macro build_setter_js(param_group, widget, expr) %}{% if widget.widget in ['flex-container', 'settings-container', 'h2', 'h3', 'submit', 'watch', 'watch-expr'] %}null{% elif widget.widget in ['checkbox', 'number', 'select', 'ip-address', 'modulation-modcod', 'modulation-speed', 'text'] %}this.param{{ param_group | title }}.{{ widget.name }} = {{ expr }}{% elif widget.widget == 'number-int' %}this.param{{ param_group | title }}.{{ widget.name }} = this.inputFormatNumber({{ expr }}, {{ js_build_number_number_validator(widget) }}){% else %}

Widget '{{ widget.widget }}' not defined!

{{ widget }}

{% endif %}{% endmacro %} {% macro build_setter(param_group, widget, expr) %}{% if widget.widget in ['flex-container', 'settings-container', 'h2', 'h3', 'submit', 'watch', 'watch-expr'] %}null{% elif widget.widget in ['checkbox', 'number', 'select', 'ip-address', 'modulation-modcod', 'modulation-speed', 'text'] %}param{{ param_group | title }}.{{ widget.name }} = {{ expr }}{% elif widget.widget == 'number-int' %}param{{ param_group | title }}.{{ widget.name }} = inputFormatNumber({{ expr }}, {{ js_build_number_number_validator(widget) }}){% else %}

Widget '{{ widget.widget }}' not defined!

{{ widget }}

{% endif %}{% endmacro %}