"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: ()=>demo1_rslib_entry_
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const client_namespaceObject = require("@tachybase/client");
const index_js_namespaceObject = require("../../../../testUtils/index.js");
const external_mockData_js_namespaceObject = require("./mockData.js");
var external_mockData_js_default = /*#__PURE__*/ __webpack_require__.n(external_mockData_js_namespaceObject);
const { apiClient, mockRequest } = (0, index_js_namespaceObject.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,
        {
            ...external_mockData_js_default(),
            data: external_mockData_js_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: client_namespaceObject.TableSelectorProvider,
        TableV2: client_namespaceObject.TableV2,
        CollectionField: client_namespaceObject.CollectionField,
        BlockItem: client_namespaceObject.BlockItem,
        Input: client_namespaceObject.Input,
        RecordPicker: client_namespaceObject.RecordPicker,
        FormItem: client_namespaceObject.FormItem,
        Action: client_namespaceObject.Action,
        ActionBar: client_namespaceObject.ActionBar
    };
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.APIClientProvider, {
        apiClient: apiClient,
        children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.CurrentUserProvider, {
            children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponentProvider, {
                components: components,
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.SchemaComponent, {
                    schema: schema
                })
            })
        })
    });
};
const app = new client_namespaceObject.Application({
    providers: [
        Root
    ]
});
const demo1_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
});
