"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__, {
    uploadAttachmentComponentFieldSettings: ()=>uploadAttachmentComponentFieldSettings
});
const schema_namespaceObject = require("@tachybase/schema");
const external_react_i18next_namespaceObject = require("react-i18next");
const SchemaSettings_js_namespaceObject = require("../../../../application/schema-settings/SchemaSettings.js");
const index_js_namespaceObject = require("../../../../schema-component/index.js");
const FormItem_Settings_js_namespaceObject = require("../../../../schema-component/antd/form-item/FormItem.Settings.js");
const Table_Column_Decorator_js_namespaceObject = require("../../../../schema-component/antd/table-v2/Table.Column.Decorator.js");
const uploadAttachmentComponentFieldSettings = new SchemaSettings_js_namespaceObject.SchemaSettings({
    name: 'fieldSettings:component:Upload.Attachment',
    items: [
        {
            name: 'size',
            type: 'select',
            useVisible () {
                const readPretty = (0, FormItem_Settings_js_namespaceObject.useIsFieldReadPretty)();
                return readPretty;
            },
            useComponentProps () {
                var _field_componentProps;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn } = (0, index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Size'),
                    options: [
                        {
                            label: t('Large'),
                            value: 'large'
                        },
                        {
                            label: t('Default'),
                            value: 'default'
                        },
                        {
                            label: t('Small'),
                            value: 'small'
                        }
                    ],
                    value: (null == field ? void 0 : null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : _field_componentProps.size) || 'default',
                    onChange (size) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['size'] = size;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps = field.componentProps || {};
                        field.componentProps.size = size;
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'showCount',
            type: 'modal',
            useComponentProps () {
                var _showCountSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const { fieldSchema: tableColumnSchema } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
                const schema = (0, schema_namespaceObject.useFieldSchema)();
                const showCountSchema = tableColumnSchema || schema;
                const { dn } = (0, index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Show Count'),
                    schema: {
                        type: 'object',
                        title: t('Show Count'),
                        properties: {
                            showCount: {
                                default: (null == showCountSchema ? void 0 : null === (_showCountSchema_xcomponentprops = showCountSchema['x-component-props']) || void 0 === _showCountSchema_xcomponentprops ? void 0 : _showCountSchema_xcomponentprops['showCount']) || 1,
                                'x-decorator': 'FormItem',
                                'x-component': 'InputNumber',
                                'x-component-props': {
                                    min: 0,
                                    max: 5
                                }
                            }
                        }
                    },
                    onSubmit: (param)=>{
                        let { showCount } = param;
                        const props = showCountSchema['x-component-props'] || {};
                        props.showCount = showCount;
                        const schema = {
                            ['x-uid']: showCountSchema['x-uid'],
                            ['x-component-props']: props
                        };
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            }
        }
    ]
});
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
});
