import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_SchemaInitializer_mjs__ from "../../../application/schema-initializer/SchemaInitializer.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__data_source_collection_CollectionProvider_mjs__ from "../../../data-source/collection/CollectionProvider.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__ from "../../../schema-initializer/utils.mjs";
const createFormBlockInitializers = new __WEBPACK_EXTERNAL_MODULE__application_schema_initializer_SchemaInitializer_mjs__.SchemaInitializer({
    name: 'popup:addNew:addBlock',
    wrap: __WEBPACK_EXTERNAL_MODULE__schema_initializer_utils_mjs__.gridRowColWrap,
    title: '{{t("Add block")}}',
    icon: 'PlusOutlined',
    items: [
        {
            type: 'itemGroup',
            title: '{{t("Data blocks")}}',
            name: 'dataBlocks',
            useChildren () {
                const currentCollection = (0, __WEBPACK_EXTERNAL_MODULE__data_source_collection_CollectionProvider_mjs__.useCollection)();
                const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
                return [
                    {
                        name: 'form',
                        title: '{{t("Form")}}',
                        Component: 'FormBlockInitializer',
                        collectionName: currentCollection.name,
                        dataSource: currentCollection.dataSource,
                        componentProps: {
                            filterCollections (param) {
                                let { collection, associationField } = param;
                                if (associationField) return false;
                                if (collection.name === currentCollection.name) return true;
                            },
                            showAssociationFields: true,
                            onlyCurrentDataSource: true,
                            hideSearch: true,
                            componentType: 'FormItem',
                            currentText: t('Current collection'),
                            otherText: t('Other collections')
                        }
                    }
                ];
            }
        },
        {
            type: 'itemGroup',
            title: '{{t("Other blocks")}}',
            name: 'otherBlocks',
            children: [
                {
                    name: 'markdown',
                    title: '{{t("Demonstration text")}}',
                    Component: 'MarkdownBlockInitializer'
                }
            ]
        }
    ]
});
export { createFormBlockInitializers };
