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_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
const ArrayTable = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>{
    const { rowKey } = props;
    const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    const schema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const columnSchemas = schema.reduceProperties((buf, s)=>{
        if ('ArrayTable.Column' === s['x-component']) buf.push(s);
        return buf;
    }, []);
    const columns = columnSchemas.map((s)=>({
            render: (value, record)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.RecursionField, {
                    name: record.__path,
                    schema: s,
                    onlyRenderProperties: true
                })
        }));
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Table, {
        ...props,
        rowKey: rowKey,
        columns: columns,
        dataSource: field.value
    });
});
const Value = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("li", {
        children: [
            "value: ",
            props.value
        ]
    }));
const demo2_rslib_entry_schema = {
    type: 'object',
    properties: {
        objArr: {
            type: 'array',
            default: [
                {
                    __path: '0',
                    id: 1,
                    value: 't1'
                },
                {
                    __path: '1',
                    id: 2,
                    value: 't2',
                    children: [
                        {
                            __path: '1.children.0',
                            id: 5,
                            value: 't5',
                            parentId: 2
                        }
                    ]
                },
                {
                    __path: '2',
                    id: 3,
                    value: 't3',
                    children: [
                        {
                            __path: '2.children.0',
                            id: 4,
                            value: 't4',
                            parentId: 3,
                            children: [
                                {
                                    __path: '2.children.0.children.0',
                                    id: 6,
                                    value: 't6',
                                    parentId: 4
                                },
                                {
                                    __path: '2.children.0.children.1',
                                    id: 7,
                                    value: 't7',
                                    parentId: 4
                                }
                            ]
                        }
                    ]
                }
            ],
            'x-component': 'ArrayTable',
            'x-component-props': {
                rowKey: 'id',
                rowSelection: {
                    type: 'checkbox'
                }
            },
            properties: {
                c1: {
                    type: 'void',
                    'x-component': 'ArrayTable.Column',
                    properties: {
                        value: {
                            type: 'string',
                            'x-component': 'Value'
                        }
                    }
                }
            }
        }
    }
};
const demo2_rslib_entry_ = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
        components: {
            ArrayTable,
            Value
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
            schema: demo2_rslib_entry_schema
        })
    });
export { demo2_rslib_entry_ as default };
