import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_client__ from "@tachybase/client";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_components__ from "@tachybase/components";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
const demo2_rslib_entry_ = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)(()=>{
    const collection = {
        name: 'tests',
        fields: [
            {
                type: 'string',
                name: 'title1',
                interface: 'input',
                uiSchema: {
                    title: 'Title1',
                    type: 'string',
                    'x-component': 'Input',
                    required: true,
                    description: 'description1'
                }
            },
            {
                type: 'string',
                name: 'title2',
                interface: 'input',
                uiSchema: {
                    title: 'Title2',
                    type: 'string',
                    'x-component': 'Input',
                    description: 'description',
                    default: 'ttt'
                }
            },
            {
                type: 'string',
                name: 'title3'
            }
        ]
    };
    const schema = {
        type: 'object',
        properties: {
            form1: {
                type: 'void',
                'x-component': 'Form',
                properties: {
                    title1: {
                        'x-component': 'CollectionField',
                        'x-decorator': 'FormItem',
                        default: '111'
                    },
                    title2: {
                        'x-component': 'CollectionField',
                        'x-decorator': 'FormItem',
                        title: 'Title4',
                        required: true,
                        description: 'description4'
                    },
                    title3: {
                        'x-component': 'Input',
                        'x-decorator': 'FormItem',
                        title: 'Title3',
                        required: true
                    },
                    action1: {
                        'x-component': 'Action',
                        title: 'Submit',
                        'x-component-props': {
                            type: 'primary',
                            useAction: '{{ useSubmit }}'
                        }
                    }
                }
            }
        }
    };
    const useSubmit = ()=>{
        const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
        return {
            async run () {
                form.submit(()=>{
                    console.log(form.values);
                });
            }
        };
    };
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
        scope: {
            useSubmit
        },
        components: {
            Action: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Action,
            Form: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Form,
            CollectionField: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.CollectionField,
            Input: __WEBPACK_EXTERNAL_MODULE__tachybase_components__.Input,
            FormItem: __WEBPACK_EXTERNAL_MODULE__tachybase_components__.FormItem
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.CollectionProvider_deprecated, {
            collection: collection,
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
                schema: schema
            })
        })
    });
});
export { demo2_rslib_entry_ as default };
