"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__, {
    ChinaRegionFieldInterface: ()=>ChinaRegionFieldInterface
});
const schema_namespaceObject = require("@tachybase/schema");
const CollectionFieldInterface_js_namespaceObject = require("../../data-source/collection-field-interface/CollectionFieldInterface.js");
const index_js_namespaceObject = require("./properties/index.js");
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class ChinaRegionFieldInterface extends CollectionFieldInterface_js_namespaceObject.CollectionFieldInterface {
    initialize(values) {
        if (!values.through) values.through = "t_".concat((0, schema_namespaceObject.uid)());
        if (!values.foreignKey) values.foreignKey = "f_".concat((0, schema_namespaceObject.uid)());
        if (!values.otherKey) values.otherKey = "f_".concat((0, schema_namespaceObject.uid)());
        if (!values.sourceKey) values.sourceKey = 'id';
        if (!values.targetKey) values.targetKey = 'id';
    }
    constructor(...args){
        super(...args), _define_property(this, "name", 'chinaRegion'), _define_property(this, "type", 'object'), _define_property(this, "group", 'choices'), _define_property(this, "order", 7), _define_property(this, "title", '{{t("China region")}}'), _define_property(this, "isAssociation", true), _define_property(this, "default", {
            interface: 'chinaRegion',
            type: 'belongsToMany',
            target: 'chinaRegions',
            targetKey: 'code',
            sortBy: 'level',
            uiSchema: {
                type: 'array',
                'x-component': 'Cascader',
                'x-component-props': {
                    useDataSource: '{{ useChinaRegionDataSource }}',
                    useLoadData: '{{ useChinaRegionLoadData }}',
                    changeOnSelectLast: false,
                    labelInValue: true,
                    maxLevel: 3,
                    fieldNames: {
                        label: 'name',
                        value: 'code',
                        children: 'children'
                    }
                }
            }
        }), _define_property(this, "availableTypes", [
            'belongsToMany'
        ]), _define_property(this, "properties", {
            ...index_js_namespaceObject.defaultProps,
            'uiSchema.x-component-props.maxLevel': {
                type: 'number',
                'x-component': 'Radio.Group',
                'x-decorator': 'FormItem',
                title: '{{t("Select level")}}',
                default: 3,
                enum: [
                    {
                        value: 1,
                        label: '{{t("Province")}}'
                    },
                    {
                        value: 2,
                        label: '{{t("City")}}'
                    },
                    {
                        value: 3,
                        label: '{{t("Area")}}'
                    },
                    {
                        value: 4,
                        label: '{{t("Street")}}',
                        disabled: true
                    },
                    {
                        value: 5,
                        label: '{{t("Village")}}',
                        disabled: true
                    }
                ]
            },
            'uiSchema.x-component-props.changeOnSelectLast': {
                type: 'boolean',
                'x-component': 'Checkbox',
                'x-content': '{{t("Must select to the last level")}}',
                'x-decorator': 'FormItem'
            }
        }), _define_property(this, "filterable", {
            children: [
                {
                    name: 'name',
                    title: '{{t("Province/city/area name")}}',
                    operators: index_js_namespaceObject.operators.string,
                    schema: {
                        title: '{{t("Province/city/area name")}}',
                        type: 'string',
                        'x-component': 'Input'
                    }
                }
            ]
        });
    }
}
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
});
