import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
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__schema_component_index_mjs__ from "../../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__ from "../../schema-settings/index.mjs";
function CustomSchemaSettingsBlockTitleItem() {
    var _fieldSchema_xdecoratorprops;
    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_index_mjs__.useDesignable)();
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsModalItem, {
        title: t('Edit block title'),
        schema: {
            type: 'object',
            title: t('Edit block title'),
            properties: {
                title: {
                    title: t('Block title'),
                    type: 'string',
                    default: null == fieldSchema ? void 0 : null === (_fieldSchema_xdecoratorprops = fieldSchema['x-decorator-props']) || void 0 === _fieldSchema_xdecoratorprops ? void 0 : _fieldSchema_xdecoratorprops['title'],
                    'x-decorator': 'FormItem',
                    'x-component': 'Input'
                }
            }
        },
        onSubmit: (param)=>{
            let { title } = param;
            console.log('titleSchemaTest', fieldSchema, field);
            const componentProps = fieldSchema['x-decorator-props'] || {};
            componentProps.title = title;
            fieldSchema['x-decorator-props'] = componentProps;
            field.decoratorProps.title = title;
            dn.emit('patch', {
                schema: {
                    ['x-uid']: fieldSchema['x-uid'],
                    'x-decorator-props': fieldSchema['x-decorator-props']
                }
            });
            dn.refresh();
        }
    });
}
export { CustomSchemaSettingsBlockTitleItem };
