"use strict";
var __webpack_require__ = {};
(()=>{
    __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: ()=>demo6_rslib_entry_
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const external_react_namespaceObject = require("react");
const client_namespaceObject = require("@tachybase/client");
const external_antd_namespaceObject = require("antd");
const external_useFilterActionProps_js_namespaceObject = require("../useFilterActionProps.js");
const collections = [
    {
        name: 'test1',
        template: 'general',
        fields: [
            {
                type: 'string',
                name: 'title1',
                interface: 'input',
                uiSchema: {
                    title: 'Title1',
                    type: 'string',
                    'x-component': 'Input',
                    required: true
                }
            }
        ]
    },
    {
        name: 'test2',
        template: 'general',
        fields: [
            {
                type: 'string',
                name: 'title2',
                interface: 'input',
                uiSchema: {
                    title: 'Title2',
                    type: 'string',
                    'x-component': 'Input',
                    required: true
                }
            }
        ]
    }
];
const schema = {
    type: 'void',
    properties: {
        demo: {
            name: 'filter',
            type: 'object',
            'x-component': 'Filter',
            'x-use-component-props': ()=>{
                const { name } = (0, client_namespaceObject.useCollection_deprecated)();
                const options = (0, external_useFilterActionProps_js_namespaceObject.useFilterOptions)(name);
                return {
                    options
                };
            }
        }
    }
};
const SwitchCollection = (props)=>{
    const [collection, setCollection] = (0, external_react_namespaceObject.useState)(collections[0].name);
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
                options: [
                    {
                        label: 'test1',
                        value: 'test1'
                    },
                    {
                        label: 'test2',
                        value: 'test2'
                    }
                ],
                defaultValue: 'test1',
                onChange: (value)=>{
                    setCollection(value);
                }
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("br", {}),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("br", {}),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.CollectionProvider_deprecated, {
                name: collection,
                children: props.children
            })
        ]
    });
};
const Demo = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.AntdSchemaComponentProvider, {
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SwitchCollection, {
            children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponent, {
                schema: schema
            })
        })
    });
class MyPlugin extends client_namespaceObject.Plugin {
    async load() {
        this.app.dataSourceManager.addDataSource(client_namespaceObject.LocalDataSource, {
            key: client_namespaceObject.DEFAULT_DATA_SOURCE_KEY,
            displayName: client_namespaceObject.DEFAULT_DATA_SOURCE_TITLE,
            collections: collections
        });
    }
}
const app = new client_namespaceObject.Application({
    plugins: [
        client_namespaceObject.CollectionPlugin,
        MyPlugin
    ],
    components: {
        Input: client_namespaceObject.Input,
        Filter: client_namespaceObject.Filter
    },
    providers: [
        Demo
    ]
});
const demo6_rslib_entry_ = app.getRootComponent();
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
});
