"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: ()=>demo2_rslib_entry_
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const client_namespaceObject = require("@tachybase/client");
const schema_namespaceObject = require("@tachybase/schema");
const external_antd_namespaceObject = require("antd");
const ArrayTable = (0, schema_namespaceObject.observer)((props)=>{
    const { rowKey } = props;
    const field = (0, schema_namespaceObject.useField)();
    const schema = (0, schema_namespaceObject.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, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.RecursionField, {
                    name: record.__path,
                    schema: s,
                    onlyRenderProperties: true
                })
        }));
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Table, {
        ...props,
        rowKey: rowKey,
        columns: columns,
        dataSource: field.value
    });
});
const Value = (0, schema_namespaceObject.connect)((props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.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, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponentProvider, {
        components: {
            ArrayTable,
            Value
        },
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponent, {
            schema: demo2_rslib_entry_schema
        })
    });
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
});
