{% import '_includes/forms' as forms %}

{{ columnsField|raw }}
{{ defaultsField|raw }}

{{ forms.textField({
    label: "Min Rows"|t('app'),
    instructions: "The minimum number of rows the field is allowed to have."|t('app'),
    id: 'minRows',
    name: 'minRows',
    value: field.minRows,
    size: 3,
    errors: field.getErrors('minRows')
}) }}

{{ forms.textField({
    label: "Max Rows"|t('app'),
    instructions: "The maximum number of rows the field is allowed to have."|t('app'),
    id: 'maxRows',
    name: 'maxRows',
    value: field.maxRows,
    size: 3,
    errors: field.getErrors('maxRows')
}) }}

{{ forms.textField({
    label: "Add Row Label"|t('app'),
    instructions: "Insert the button label for adding a new row to the table."|t('app'),
    id: 'addRowLabel',
    name: 'addRowLabel',
    value: field.addRowLabel,
    size: 20,
    errors: field.getErrors('addRowLabel')
}) }}

{% if craft.app.db.isMysql %}
    <hr>
    <a class="fieldtoggle" data-target="advanced">{{ "Advanced"|t('app') }}</a>
    <div id="advanced" class="hidden">
        {{ forms.selectField({
            label: "Column Type"|t('app'),
            id: 'column-type',
            name: 'columnType',
            instructions: "The type of column this field should get in the database."|t('app'),
            options: [
                { value: 'text', label: 'text (~64KB)' },
                { value: 'mediumtext', label: 'mediumtext (~16MB)' },
            ],
            value: field.columnType,
            warning: (field.id ? "Changing this may result in data loss."|t('app')),
        }) }}
    </div>
{% endif %}
