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__testUtils_index_mjs__ from "../../../../testUtils/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__mockData_mjs__ from "./mockData.mjs";
const { apiClient, mockRequest } = (0, __WEBPACK_EXTERNAL_MODULE__testUtils_index_mjs__.mockAPIClient)();
mockRequest.onGet('/auth:check').reply(()=>[
        200,
        {
            data: {}
        }
    ]);
mockRequest.onGet('/tt_bd_range:list').reply((param)=>{
    let { params } = param;
    var _JSON_parse_$and_, _JSON_parse_$and;
    const ids = (null === (_JSON_parse_$and = JSON.parse(params.filter).$and) || void 0 === _JSON_parse_$and ? void 0 : null === (_JSON_parse_$and_ = _JSON_parse_$and[0]) || void 0 === _JSON_parse_$and_ ? void 0 : _JSON_parse_$and_['id.$ne']) || [];
    return [
        200,
        {
            ...__WEBPACK_EXTERNAL_MODULE__mockData_mjs__["default"],
            data: __WEBPACK_EXTERNAL_MODULE__mockData_mjs__["default"].data.filter((item)=>!ids.includes(item.id))
        }
    ];
});
const schema = {
    type: 'object',
    properties: {
        input: {
            type: 'array',
            title: "编辑模式",
            'x-decorator': 'FormItem',
            'x-component': 'RecordPicker',
            'x-component-props': {
                fieldNames: {
                    label: 'name',
                    value: 'id'
                },
                multiple: true,
                association: {
                    target: 'tt_bd_range'
                }
            },
            'x-reactions': {
                target: 'read',
                fulfill: {
                    state: {
                        value: '{{$self.value}}'
                    }
                }
            },
            properties: {
                selector: {
                    type: 'void',
                    title: '{{ t("Select record") }}',
                    'x-component': 'RecordPicker.Selector',
                    'x-component-props': {
                        className: 'tb-record-picker-selector'
                    },
                    properties: {
                        tableBlock: {
                            type: 'void',
                            'x-decorator': 'TableSelectorProvider',
                            'x-decorator-props': {
                                collection: 'tt_bd_range',
                                resource: 'tt_bd_range',
                                action: 'list',
                                params: {
                                    pageSize: 20
                                },
                                rowKey: 'id'
                            },
                            'x-component': 'BlockItem',
                            properties: {
                                value: {
                                    type: 'array',
                                    'x-component': 'TableV2.Selector',
                                    'x-use-component-props': 'useTableSelectorProps',
                                    'x-component-props': {
                                        rowKey: 'id',
                                        rowSelection: {
                                            type: 'checkbox'
                                        }
                                    },
                                    properties: {
                                        column1: {
                                            type: 'void',
                                            'x-decorator': 'TableV2.Column.Decorator',
                                            'x-component': 'TableV2.Column',
                                            properties: {
                                                name: {
                                                    type: 'string',
                                                    'x-component': 'CollectionField',
                                                    'x-read-pretty': true
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        },
                        footer: {
                            'x-component': 'Action.Container.Footer',
                            'x-component-props': {},
                            properties: {
                                actions: {
                                    type: 'void',
                                    'x-component': 'ActionBar',
                                    'x-component-props': {},
                                    properties: {
                                        submit: {
                                            title: '{{ t("Submit") }}',
                                            'x-action': 'submit',
                                            'x-component': 'Action',
                                            'x-use-component-props': 'usePickActionProps',
                                            'x-component-props': {
                                                type: 'primary',
                                                htmlType: 'submit'
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        read: {
            type: 'array',
            title: "阅读模式",
            'x-read-pretty': true,
            'x-decorator': 'FormItem',
            'x-component': 'RecordPicker',
            'x-component-props': {
                mode: 'tags',
                fieldNames: {
                    label: 'name',
                    value: 'id'
                }
            },
            'x-collection-field': 'tt_mnt_org.range'
        }
    }
};
const Root = ()=>{
    const components = {
        TableSelectorProvider: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.TableSelectorProvider,
        TableV2: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.TableV2,
        CollectionField: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.CollectionField,
        BlockItem: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.BlockItem,
        Input: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Input,
        RecordPicker: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.RecordPicker,
        FormItem: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.FormItem,
        Action: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Action,
        ActionBar: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.ActionBar
    };
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.APIClientProvider, {
        apiClient: apiClient,
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.CurrentUserProvider, {
            children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
                components: components,
                children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
                    schema: schema
                })
            })
        })
    });
};
const app = new __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Application({
    providers: [
        Root
    ]
});
const demo1_rslib_entry_ = app.getRootComponent();
export { demo1_rslib_entry_ as default };
