"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (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 = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (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__, {
    IntegerFieldInterface: ()=>IntegerFieldInterface
});
const schema_namespaceObject = require("@tachybase/schema");
const CollectionFieldInterface_js_namespaceObject = require("../../data-source/collection-field-interface/CollectionFieldInterface.js");
const index_js_namespaceObject = require("../../i18n/index.js");
const external_properties_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;
}
(0, schema_namespaceObject.registerValidateFormats)({
    odd: /^-?\d*[13579]$/,
    even: /^-?\d*[02468]$/
});
class IntegerFieldInterface extends CollectionFieldInterface_js_namespaceObject.CollectionFieldInterface {
    constructor(...args){
        super(...args), _define_property(this, "name", 'integer'), _define_property(this, "type", 'object'), _define_property(this, "group", 'basic'), _define_property(this, "order", 6), _define_property(this, "title", '{{t("Integer")}}'), _define_property(this, "sortable", true), _define_property(this, "default", {
            type: 'bigInt',
            uiSchema: {
                type: 'number',
                'x-component': 'InputNumber',
                'x-component-props': {
                    stringMode: true,
                    step: '1'
                },
                'x-validator': 'integer'
            }
        }), _define_property(this, "availableTypes", [
            'bigInt',
            'integer',
            'sort'
        ]), _define_property(this, "hasDefaultValue", true), _define_property(this, "properties", {
            ...external_properties_index_js_namespaceObject.defaultProps,
            layout: {
                type: 'void',
                title: '{{t("Index")}}',
                'x-component': 'Space',
                'x-decorator': 'FormItem',
                'x-decorator-props': {
                    style: {
                        marginBottom: '0px'
                    }
                },
                properties: {
                    primaryKey: external_properties_index_js_namespaceObject.primaryKey,
                    unique: external_properties_index_js_namespaceObject.unique
                }
            },
            autoIncrement: external_properties_index_js_namespaceObject.autoIncrement,
            'uiSchema.x-component-props.addonBefore': {
                type: 'string',
                title: '{{t("Prefix")}}',
                'x-decorator': 'FormItem',
                'x-component': 'Input'
            },
            'uiSchema.x-component-props.addonAfter': {
                type: 'string',
                title: '{{t("Suffix")}}',
                'x-decorator': 'FormItem',
                'x-component': 'Input'
            }
        }), _define_property(this, "filterable", {
            operators: external_properties_index_js_namespaceObject.operators.number
        }), _define_property(this, "titleUsable", true), _define_property(this, "validateSchema", (fieldSchema)=>({
                maximum: {
                    type: 'number',
                    title: '{{ t("Maximum") }}',
                    'x-decorator': 'FormItem',
                    'x-component': 'InputNumber',
                    'x-component-props': {
                        precision: 0
                    },
                    'x-reactions': "{{(field) => {\n          const targetValue = field.query('.minimum').value();\n          field.selfErrors =\n            !!targetValue && !!field.value && targetValue > field.value ? '".concat(index_js_namespaceObject.i18n.t('Maximum must greater than minimum'), "' : ''\n        }}}")
                },
                minimum: {
                    type: 'number',
                    title: '{{ t("Minimum") }}',
                    'x-decorator': 'FormItem',
                    'x-component': 'InputNumber',
                    'x-component-props': {
                        precision: 0
                    },
                    'x-reactions': {
                        dependencies: [
                            '.maximum'
                        ],
                        fulfill: {
                            state: {
                                selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(index_js_namespaceObject.i18n.t('Minimum must less than maximum'), "' : ''}}")
                            }
                        }
                    }
                },
                format: {
                    type: 'string',
                    title: '{{ t("Format") }}',
                    'x-decorator': 'FormItem',
                    'x-component': 'Select',
                    'x-component-props': {
                        allowClear: true
                    },
                    enum: [
                        {
                            label: '{{ t("Odd") }}',
                            value: 'odd'
                        },
                        {
                            label: '{{ t("Even") }}',
                            value: 'even'
                        }
                    ]
                },
                pattern: {
                    type: 'string',
                    title: '{{ t("Regular expression") }}',
                    'x-decorator': 'FormItem',
                    'x-component': 'Input',
                    'x-component-props': {
                        prefix: '/',
                        suffix: '/'
                    }
                }
            }));
    }
}
exports.IntegerFieldInterface = __webpack_exports__.IntegerFieldInterface;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
    "IntegerFieldInterface"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
    value: true
});
