import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../application/schema-settings/SchemaSettings.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__ from "../../../application/schema-toolbar/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
const pageTabSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
    name: 'PageTabSettings',
    items: [
        {
            name: 'edit',
            type: 'modal',
            useComponentProps () {
                const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
                const { schema } = (0, __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__.useSchemaToolbar)();
                const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
                return {
                    title: t('Edit'),
                    schema: {
                        type: 'object',
                        title: t('Edit tab'),
                        properties: {
                            title: {
                                title: t('Tab name'),
                                required: true,
                                'x-decorator': 'FormItem',
                                'x-component': 'Input',
                                'x-component-props': {}
                            },
                            icon: {
                                title: t('Icon'),
                                'x-decorator': 'FormItem',
                                'x-component': 'IconPicker',
                                'x-component-props': {}
                            }
                        }
                    },
                    initialValues: {
                        title: schema.title,
                        icon: schema['x-icon']
                    },
                    onSubmit: (param)=>{
                        let { title, icon } = param;
                        schema.title = title;
                        schema['x-icon'] = icon;
                        dn.emit('patch', {
                            schema: {
                                ['x-uid']: schema['x-uid'],
                                title,
                                'x-icon': icon
                            }
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'divider',
            type: 'divider'
        },
        {
            name: 'delete',
            type: 'item',
            useComponentProps () {
                const { modal } = __WEBPACK_EXTERNAL_MODULE_antd__.App.useApp();
                const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
                const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
                const { schema } = (0, __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__.useSchemaToolbar)();
                return {
                    title: t('Delete'),
                    eventKey: 'remove',
                    onClick () {
                        modal.confirm({
                            title: t('Delete block'),
                            content: t('Are you sure you want to delete it?'),
                            ...confirm,
                            onOk () {
                                dn.remove(schema);
                            }
                        });
                    },
                    children: t('Delete')
                };
            }
        }
    ]
});
export { pageTabSettings };
