import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
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__schema_component_antd_filter_Filter_Action_Designer_mjs__ from "../../../schema-component/antd/filter/Filter.Action.Designer.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_hooks_index_mjs__ from "../../../schema-component/hooks/index.mjs";
const filterActionSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
    name: 'actionSettings:filter',
    items: [
        {
            name: 'FilterableFields',
            Component: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_filter_Filter_Action_Designer_mjs__.FilterableFieldsSchemaSettingsItem
        },
        {
            name: 'divider',
            type: 'divider'
        },
        {
            name: 'EditButton',
            type: 'modal',
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
                const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
                const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_hooks_index_mjs__.useDesignable)();
                const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
                return {
                    title: t('Edit button'),
                    schema: {
                        type: 'object',
                        title: t('Edit button'),
                        properties: {
                            title: {
                                'x-decorator': 'FormItem',
                                'x-component': 'Input',
                                title: t('Button title'),
                                default: fieldSchema.title,
                                'x-component-props': {}
                            },
                            icon: {
                                'x-decorator': 'FormItem',
                                'x-component': 'IconPicker',
                                title: t('Button icon'),
                                default: null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.icon,
                                'x-component-props': {}
                            }
                        }
                    },
                    onSubmit: (param)=>{
                        let { title, icon } = param;
                        fieldSchema.title = title;
                        field.title = title;
                        field.componentProps.icon = icon;
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props'].icon = icon;
                        dn.emit('patch', {
                            schema: {
                                ['x-uid']: fieldSchema['x-uid'],
                                title,
                                'x-component-props': {
                                    ...fieldSchema['x-component-props']
                                }
                            }
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'divider2',
            type: 'divider'
        },
        {
            name: 'delete',
            type: 'remove',
            componentProps: {
                removeParentsIfNoChildren: true,
                breakRemoveOn: (s)=>'Space' === s['x-component'] || 'ActionBar' === s['x-component']
            }
        }
    ]
});
export { filterActionSettings };
