49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
---
|
|
id:
|
|
type: 'string'
|
|
name:
|
|
type: 'string'
|
|
default: ''
|
|
required:
|
|
type: 'bool'
|
|
default: false
|
|
attributes:
|
|
type: 'string'
|
|
default: ''
|
|
class:
|
|
type: 'string'
|
|
default: 'form-select'
|
|
items:
|
|
type: 'array'
|
|
---
|
|
<select
|
|
class="{{ class | escape_once }}"
|
|
name="{{- name | default: id | escape_once -}}"
|
|
id="{{- id | escape_once -}}"
|
|
{{ required | value_if: 'required' }}
|
|
{{ attributes }}
|
|
>
|
|
{% render 'forms/option.html', value: '', item: '' %}
|
|
|
|
{% for option in items %}
|
|
{% assign value = option | try: 'value' | default: option %}
|
|
{% assign item = option | try: 'item' | default: value %}
|
|
{% assign depends_on = option | try: 'depends_on' %}
|
|
{% assign attributes = '' %}
|
|
|
|
{% if depends_on %}
|
|
{% capture attributes %}
|
|
data-form-dependencies-target="dependent"
|
|
data-form-dependencies-dependent-id="{{ depends_on.id | escape_once }}"
|
|
data-form-dependencies-id="{{ id | escape_once }}"
|
|
data-form-dependencies-condition="{{ depends_on | try: 'condition' | default: 'any' | escape_once }}"
|
|
data-form-dependencies-value="{{ depends_on | try: 'value' | escape_once }}"
|
|
hidden
|
|
disabled
|
|
{% endcapture %}
|
|
{% endif %}
|
|
|
|
{% render 'forms/option.html', value:, item:, attributes: %}
|
|
{% endfor %}
|
|
</select>
|