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__schema_component_index_mjs__ from "../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_index_mjs__ from "../schema-initializer/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__SchemaSettings_mjs__ from "./SchemaSettings.mjs";
function SchemaSettingComponent() {
    const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    const checkedItems = [
        'Radio.Group',
        'Checkbox.Group'
    ];
    const component = fieldSchema['x-component'];
    const options = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_index_mjs__.useFieldComponents)().options.map((item)=>{
        if (checkedItems.includes(component)) return checkedItems.includes(item.value) ? item : null;
        return checkedItems.includes(item.value) || 'DatePicker' === item.value || 'AssociationCascader' === item.value ? null : item;
    }).filter(Boolean);
    const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__SchemaSettings_mjs__.SchemaSettingsSelectItem, {
        title: "Field Component",
        options: options,
        value: fieldSchema['x-component'],
        onChange: (mode)=>{
            field.component = mode;
            fieldSchema['x-component'] = mode;
            field.componentProps = fieldSchema['x-component-props'];
            dn.emit('patch', {
                schema: {
                    ['x-uid']: fieldSchema['x-uid'],
                    ['x-component']: fieldSchema['x-component']
                }
            });
            dn.refresh();
        }
    }, "component-field");
}
export { SchemaSettingComponent };
