<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd" extends="pagebuilder_base_form">
    <argument name="data" xsi:type="array">
        <item name="js_config" xsi:type="array">
            <item name="provider" xsi:type="string">pagebuilder_filoblu_products_form.pagebuilder_filoblu_products_form_data_source</item>
        </item>
        <item name="label" xsi:type="string" translate="true">Products</item>
    </argument>
    <settings>
        <deps>
            <dep>pagebuilder_filoblu_products_form.pagebuilder_filoblu_products_form_data_source</dep>
        </deps>
        <namespace>pagebuilder_filoblu_products_form</namespace>
    </settings>
    <dataSource name="pagebuilder_filoblu_products_form_data_source">
        <argument name="data" xsi:type="array">
            <item name="js_config" xsi:type="array">
                <item name="component" xsi:type="string">Magento_PageBuilder/js/content-type/products/form/provider</item>
            </item>
        </argument>
        <dataProvider name="pagebuilder_filoblu_products_form_data_source" class="Magento\PageBuilder\Model\ContentType\DataProvider">
            <settings>
                <requestFieldName/>
                <primaryFieldName/>
            </settings>
        </dataProvider>
    </dataSource>
    <fieldset name="appearance_fieldset" sortOrder="10" component="Magento_PageBuilder/js/form/element/dependent-fieldset">
        <settings>
            <label translate="true">Appearance</label>
            <additionalClasses>
                <class name="admin__fieldset-visual-select-large">true</class>
            </additionalClasses>
            <collapsible>false</collapsible>
            <opened>true</opened>
            <imports>
                <link name="hideFieldset">${$.name}.appearance:options</link>
                <link name="hideLabel">${$.name}.appearance:options</link>
            </imports>
        </settings>
        <field name="appearance" formElement="select" sortOrder="10" component="Magento_PageBuilder/js/form/element/dependent-visual-select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">grid</item>
                </item>
            </argument>
            <settings>
                <additionalClasses>
                    <class name="admin__field-wide">true</class>
                    <class name="admin__field-visual-select-container">true</class>
                </additionalClasses>
                <dataType>text</dataType>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">true</rule>
                </validation>
                <elementTmpl>Magento_PageBuilder/form/element/visual-select</elementTmpl>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options class="AppearanceSourceFilobluProducts" />
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="data_condition_option" sortOrder="20" formElement="select" component="Magento_PageBuilder/js/form/element/condition-options">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Select Products By</label>
                <elementTmpl>Magento_PageBuilder/form/element/visual-select</elementTmpl>
                <exports>
                    <link name="category_idsVisible">${$.parentName}.category_ids:visible</link>
                    <link name="conditionVisible">${$.parentName}.conditions_form:visible</link>
                    <link name="skuVisible">${$.parentName}.sku:visible</link>
                    <link name="value">${$.parentName}.sort_order:filter</link>
                </exports>
                <dataScope>data_condition_option</dataScope>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options>
                            <option name="0" xsi:type="array">
                                <item name="size" xsi:type="string">small</item>
                                <item name="value" xsi:type="string">category_ids</item>
                                <item name="title" xsi:type="string" translate="true">Category</item>
                            </option>
                            <option name="1" xsi:type="array">
                                <item name="size" xsi:type="string">small</item>
                                <item name="value" xsi:type="string">sku</item>
                                <item name="title" xsi:type="string" translate="true">SKU</item>
                            </option>
                            <option name="2" xsi:type="array">
                                <item name="size" xsi:type="string">small</item>
                                <item name="value" xsi:type="string">condition</item>
                                <item name="title" xsi:type="string" translate="true">Condition</item>
                            </option>
                        </options>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="category_ids" component="Magento_Catalog/js/components/new-category" sortOrder="30" formElement="select">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filterOptions" xsi:type="boolean">true</item>
                    <item name="multiple" xsi:type="boolean">false</item>
                    <item name="showCheckbox" xsi:type="boolean">false</item>
                    <item name="disableLabel" xsi:type="boolean">true</item>
                    <item name="levelsVisibility" xsi:type="number">1</item>
                </item>
            </argument>
            <settings>
                <elementTmpl>ui/grid/filters/elements/ui-select</elementTmpl>
                <label translate="true">Category</label>
                <dataScope>category_ids</dataScope>
                <componentType>field</componentType>
                <visible>false</visible>
                <listens>
                    <link name="${ $.namespace }.${ $.namespace }:responseData">setParsed</link>
                </listens>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options class="Magento\Catalog\Ui\Component\Product\Form\Categories\Options"/>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="sku" sortOrder="40" formElement="input">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="condition_operator" xsi:type="string">()</item>
                </item>
            </argument>
            <settings>
                <dataType>text</dataType>
                <label translate="true">Product SKUs</label>
                <dataScope>sku</dataScope>
                <visible>false</visible>
                <exports>
                    <link name="condition_operator">${ $.provider }:data.sku-condition_operator</link>
                </exports>
                <notice translate="true">Comma separated product SKUs.</notice>
                <elementTmpl>Magento_PageBuilder/form/element/input-no-maxlength</elementTmpl>
            </settings>
        </field>
        <htmlContent name="conditions_form" sortOrder="50" template="Magento_PageBuilder/form/element/widget-conditions" component="Magento_PageBuilder/js/form/element/html">
            <settings>
                <visible>false</visible>
                <additionalClasses>
                    <class name="admin__field">true</class>
                </additionalClasses>
            </settings>
            <block name="conditions_form" class="Magento\PageBuilder\Block\Adminhtml\Form\Element\ProductConditions">
                <arguments>
                    <argument name="formNamespace" xsi:type="string">pagebuilder_filoblu_products_form</argument>
                    <argument name="attribute" xsi:type="string">condition_source</argument>
                    <argument name="label" xsi:type="string" translate="true">Condition</argument>
                </arguments>
            </block>
        </htmlContent>
        <field name="sort_order" sortOrder="60" formElement="select" component="Magento_PageBuilder/js/form/element/select-filtered-options">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="default" xsi:type="string">position</item>
                    <item name="excludeOptions" xsi:type="array">
                        <item name="condition" xsi:type="string">position,position_by_sku</item>
                        <item name="sku" xsi:type="string">position</item>
                        <item name="category_ids" xsi:type="string">position_by_sku</item>
                    </item>
                </item>
            </argument>
            <settings>
                <dataType>text</dataType>
                <label translate="true">Sort By</label>
                <dataScope>sort_order</dataScope>
            </settings>
            <formElements>
                <select>
                    <settings>
                        <options class="Magento\PageBuilder\Model\Catalog\Sorting\Options"/>
                    </settings>
                </select>
            </formElements>
        </field>
        <field name="data_products_count" sortOrder="70" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Number of Products to Display</label>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
                <dataScope>data_products_count</dataScope>
            </settings>
        </field>
        <field name="slider_template" sortOrder="80" formElement="input">
            <settings>
                <dataType>text</dataType>
                <label translate="true">Template</label>
                <additionalClasses>
                    <class name="admin__field-small">true</class>
                </additionalClasses>
                <dataScope>slider_template</dataScope>
            </settings>
        </field>
    </fieldset>
</form>
