import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "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 useValues = (options)=>{
    const { visible } = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useActionContext)();
    const result = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useRequest)(()=>Promise.resolve({
            data: {
                id: 1,
                name: 'hello tachybase'
            }
        }), {
        ...options,
        manual: true
    });
    (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
        if (visible) result.run();
    }, [
        visible
    ]);
    return result;
};
const schema = {
    type: 'void',
    name: 'drawer1',
    'x-component': 'Action.Drawer',
    'x-decorator': 'Form',
    'x-decorator-props': {
        useValues
    },
    title: 'Drawer Title',
    properties: {
        name: {
            title: 'T1',
            'x-component': 'Input',
            'x-decorator': 'FormItem'
        },
        f1: {
            type: 'void',
            'x-component': 'Action.Drawer.Footer',
            properties: {
                a1: {
                    'x-component': 'Action',
                    title: 'Close',
                    'x-component-props': {
                        useAction: '{{ useCloseAction }}'
                    }
                }
            }
        }
    }
};
const demo8_rslib_entry_ = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)(()=>{
    const [visible, setVisible] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
        components: {
            Action: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Action,
            Input: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Input,
            FormItem: __WEBPACK_EXTERNAL_MODULE__tachybase_components__.FormItem,
            Form: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Form
        },
        scope: {
            useCloseAction: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.useCloseAction
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.ActionContextProvider, {
            value: {
                visible,
                setVisible
            },
            children: [
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                    onClick: ()=>{
                        setVisible(true);
                    },
                    children: "Edit"
                }),
                /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
                    schema: schema
                })
            ]
        })
    });
});
export { demo8_rslib_entry_ as default };
