{% set container_style = schema.get('style') %}
{% if schema.title %}{{ schema.title | get_translated_text }} {% if 'tooltip' in schema %} {% endif %}{% endif %}
{% set minItems = schema.get('minItems', 0) %} {% set maxItems = schema.get('maxItems', -1) %} {% set defaultItems = schema.get('defaultItems', minItems) %} {% if is_template and data is none %} {% set data = get_default_data(root_schema, property_path) %} {% endif %} {% if data is none %} {% set data = [] %} {% endif %} {% if diff is none %} {% set diff = [] %} {% endif %}
{% set template_order_index = template_order_index + 1 if template_order_index else 1 %} {% set col_order_index = col_order_index + 1 if col_order_index else 1 %} {% set parent_prefix = id_prefix %}
{% if schema['items']['type'] == 'object' %} {% set item_property_names = get_property_names_in_order(schema["items"], previous_schema["items"]) %} {% set is_required = True %} {% for property_name in item_property_names %} {% endfor %} {% for item, item_diff in (zip_longest(data, diff) | list) + [(None, None)] %} {% set schema = schema['items'] %} {% if previous_schema %} {% set previous_schema = previous_schema.get('items') %} {% endif %} {% if loop.last %} {% set is_template = true %} {% set property_path = property_path + ('!index' ~ template_order_index ~ '!',) %} {% set item = get_default_data(root_schema, property_path) %} {% else %} {% set property_path = property_path + (loop.index0,) %} {% endif %} {% set id_prefix = id_prefix_for_property_path(property_path, id_prefix_root) %} {% set data = item %} {% set diff = item_diff %} {% for property_name in item_property_names %} {% endfor %} {% endfor %} {% for property_name in item_property_names %} {% endfor %}
{% if schema["items"].properties.get(property_name, {}).title %}{{ schema["items"].properties[property_name].title | get_translated_text }} {% if 'tooltip' in schema["items"].properties[property_name] %}{% endif %}{% elif previous_schema and previous_schema['items'].properties.get(property_name, {}).title %}{{ previous_schema['items'].properties[property_name].title | get_translated_text }}{% else %}{{ property_name }}{% endif %}
{% set is_required = property_name in schema.get('required', ()) %} {% set schema = schema.properties[property_name] %} {% set property_path = property_path + (property_name,) %} {% set id_prefix = id_prefix_for_property_path(property_path, id_prefix_root) %} {% if data is not none %} {% set data = data.get(property_name) %} {% endif %} {% if diff is not none %} {% set diff = diff.get(property_name) %} {% endif %} {% if previous_schema is not none %} {% set previous_schema = previous_schema.get('properties', {}).get(property_name) %} {% endif %} {% if schema and 'conditions' in schema %}
{% include "objects/forms/form_any.html" %}
{% else %} {% include "objects/forms/form_any.html" %} {% endif %}
{% if 'recipes' in schema %} {% include "objects/forms/form_table_recipe.html" %} {% endif %}
 
{% elif schema['items']['type'] == 'array' %} {% set max_used_fields = [0] %} {% for item in data %} {% if (item | length) > max_used_fields[-1] %} {% do max_used_fields.append(item | length) %} {% endif %} {% endfor %} {% for item in diff %} {% if (item | length) > max_used_fields[-1] %} {% do max_used_fields.append(item | length) %} {% endif %} {% endfor %} {% set max_used_fields = max_used_fields [-1] %} {% set is_required = True %} {% for i in range(max_used_fields) %} {% endfor %} {% set parent_prefix = id_prefix %} {% if previous_schema is not none %} {% set previous_schema = previous_schema.get('items', {}).get('items') %} {% endif %} {% for item, item_diff in (zip_longest(data, diff) | list) + [(None, None)] %} {% if loop.last %} {% set is_template = True %} {% set property_path = property_path + ('!index' ~ template_order_index ~ '!',) %} {% set item = get_default_data(root_schema, property_path) %} {% else %} {% set property_path = property_path + (loop.index0,) %} {% endif %} {% set id_prefix = id_prefix_for_property_path(property_path, id_prefix_root) %} {% if item_diff is none %} {% set item_diff = [] %} {% endif %} {% for field_index, field, field_diff in zip_longest(range(max_used_fields), item, item_diff) %} {% endfor %} {% endfor %} {% for i in range(max_used_fields) %} {% endfor %}
{{ _('Field %(index)s', index=i + 1) }}
{% set schema = schema["items"]["items"] %} {% set data = field %} {% set diff = field_diff %} {% set property_path = property_path + (loop.index0,) %} {% set id_prefix = id_prefix_for_property_path(property_path, id_prefix_root) %} {% include "objects/forms/form_any.html" %}
{% with is_template = true %} {% set schema = schema["items"]["items"] %} {% set property_path = property_path + ('!index' ~ template_order_index ~ '!', '!cindex' ~ col_order_index ~ '!',) %} {% set data = get_default_data(root_schema, property_path) %} {% set diff = none %} {% set id_prefix = id_prefix_for_property_path(property_path, id_prefix_root) %} {% include "objects/forms/form_any.html" %} {% endwith %}
{{ _('Field %(index)s', index=i + 1) }}
{% endif %}