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";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
const schema = {
    type: 'object',
    properties: {
        form1: {
            type: 'void',
            'x-decorator': 'Form',
            'x-decorator-props': {
                useValues: '{{ useValues }}'
            },
            'x-component': 'Card',
            properties: {
                field1: {
                    'x-component': 'Input',
                    'x-decorator': 'FormItem',
                    title: 'T1'
                },
                out: {
                    'x-component': 'Output'
                },
                action1: {
                    'x-component': 'Action',
                    title: 'Submit',
                    'x-component-props': {
                        useAction: '{{ useSubmit }}'
                    }
                }
            }
        }
    }
};
const Output = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)(()=>{
    const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("pre", {
        children: JSON.stringify(form.values, null, 2)
    });
}, {
    displayName: 'Output'
});
const useSubmit = ()=>{
    const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
    return {
        async run () {
            console.log(form.values);
        }
    };
};
const useValues = (opts)=>(0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useRequest)(()=>Promise.resolve({
            data: {
                field1: 'aabb'
            }
        }), opts);
const demo7_rslib_entry_ = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)(()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
        scope: {
            useSubmit,
            useValues
        },
        components: {
            Card: __WEBPACK_EXTERNAL_MODULE_antd__.Card,
            Output,
            Action: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Action,
            Form: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Form,
            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__.SchemaComponent, {
            schema: schema
        })
    }));
export { demo7_rslib_entry_ as default };
