"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __webpack_require__.d = function(exports1, definition) {
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
})();
(()=>{
    __webpack_require__.r = function(exports1) {
        if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    default: ()=>demo3_rslib_entry_
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const external_react_namespaceObject = require("react");
const client_namespaceObject = require("@tachybase/client");
const schema_namespaceObject = require("@tachybase/schema");
const external_antd_namespaceObject = require("antd");
const external_lodash_namespaceObject = require("lodash");
var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
const useCloseAction = ()=>{
    const { setVisible } = (0, client_namespaceObject.useActionContext)();
    return {
        async run () {
            setVisible(false);
        }
    };
};
const Editable = (0, schema_namespaceObject.observer)((props)=>{
    const field = (0, schema_namespaceObject.useField)();
    const schema = (0, schema_namespaceObject.useFieldSchema)();
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
                style: {
                    marginBottom: 24
                },
                children: [
                    "打开方式：",
                    /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Radio.Group, {
                        value: field.componentProps.openMode,
                        onChange: (e)=>{
                            field.componentProps.openMode = e.target.value;
                            external_lodash_default().set(schema, 'x-component-props.openMode', e.target.value);
                        },
                        children: [
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
                                value: "drawer",
                                children: "Drawer"
                            }),
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
                                value: "modal",
                                children: "Modal"
                            }),
                            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Button, {
                                value: "page",
                                children: "Page"
                            })
                        ]
                    })
                ]
            }),
            props.children
        ]
    });
}, {
    displayName: 'Editable'
});
const demo3_rslib_entry_schema = {
    type: 'object',
    properties: {
        action1: {
            type: 'void',
            title: 'Open',
            'x-decorator': 'Editable',
            'x-component': 'Action',
            'x-component-props': {
                type: 'primary',
                openMode: 'modal',
                containerRefKey: 'containerRef'
            },
            properties: {
                drawer1: {
                    type: 'void',
                    title: 'Modal Title',
                    'x-component': 'Action.Container',
                    'x-component-props': {},
                    properties: {
                        hello1: {
                            title: 'T1',
                            'x-content': 'Hello'
                        },
                        footer1: {
                            type: 'void',
                            'x-component': 'Action.Container.Footer',
                            properties: {
                                close1: {
                                    title: 'Close',
                                    'x-component': 'Action',
                                    'x-component-props': {
                                        useAction: '{{ useCloseAction }}'
                                    }
                                },
                                submit: {
                                    title: 'Submit',
                                    'x-component': 'Action',
                                    'x-component-props': {
                                        type: 'primary',
                                        useAction: '{{ useCloseAction }}'
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};
const demo3_rslib_entry_ = (0, schema_namespaceObject.observer)(()=>{
    const containerRef = (0, external_react_namespaceObject.useRef)(null);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(client_namespaceObject.SchemaComponentProvider, {
        scope: {
            useCloseAction,
            containerRef
        },
        components: {
            Editable,
            Action: client_namespaceObject.Action
        },
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponent, {
                schema: demo3_rslib_entry_schema
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
                ref: containerRef
            })
        ]
    });
});
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
