"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__, {
    ExpandActionDesign: ()=>ExpandActionDesign
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const schema_namespaceObject = require("@tachybase/schema");
const external_react_i18next_namespaceObject = require("react-i18next");
const external_index_js_namespaceObject = require("../../index.js");
const index_js_namespaceObject = require("../../../schema-settings/index.js");
const ExpandActionDesign = (props)=>{
    var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
    const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
    const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
    const field = (0, schema_namespaceObject.useField)();
    const { dn } = (0, external_index_js_namespaceObject.useDesignable)();
    const { titleExpand, titleCollapse, iconExpand, iconCollapse } = fieldSchema['x-component-props'] || {};
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_js_namespaceObject.GeneralSchemaDesigner, {
        ...props,
        disableInitializer: true,
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaSettingsModalItem, {
                title: t('Edit button'),
                schema: {
                    type: 'object',
                    title: t('Edit button'),
                    properties: {
                        titleExpand: {
                            'x-decorator': 'FormItem',
                            'x-component': 'Input',
                            title: "".concat(t('Button title'), " - ").concat(t('Expand all')),
                            default: titleExpand
                        },
                        titleCollapse: {
                            'x-decorator': 'FormItem',
                            'x-component': 'Input',
                            title: "".concat(t('Button title'), " - ").concat(t('Collapse all')),
                            default: titleCollapse
                        },
                        iconExpand: {
                            'x-decorator': 'FormItem',
                            'x-component': 'IconPicker',
                            title: "".concat(t('Button icon'), " - ").concat(t('Expand all')),
                            default: iconExpand
                        },
                        iconCollapse: {
                            'x-decorator': 'FormItem',
                            'x-component': 'IconPicker',
                            title: "".concat(t('Button icon'), " - ").concat(t('Collapse all')),
                            default: iconCollapse
                        },
                        type: {
                            'x-decorator': 'FormItem',
                            'x-component': 'Radio.Group',
                            title: t('Button background color'),
                            default: (null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.danger) ? 'danger' : (null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.type) === 'primary' ? 'primary' : 'default',
                            enum: [
                                {
                                    value: 'default',
                                    label: '{{t("Default")}}'
                                },
                                {
                                    value: 'primary',
                                    label: '{{t("Highlight")}}'
                                },
                                {
                                    value: 'danger',
                                    label: '{{t("Danger red")}}'
                                }
                            ]
                        }
                    }
                },
                onSubmit: (param)=>{
                    let { titleExpand, titleCollapse, iconExpand, iconCollapse, type } = param;
                    fieldSchema.title = t('Expand/Collapse');
                    field.title = t('Expand/Collapse');
                    field.componentProps.icon = iconExpand;
                    field.componentProps.danger = 'danger' === type;
                    field.componentProps.type = type;
                    fieldSchema['x-component-props'] = {
                        ...fieldSchema['x-component-props'] || {},
                        titleExpand,
                        titleCollapse,
                        iconExpand,
                        iconCollapse,
                        type,
                        danger: 'danger' === type
                    };
                    dn.emit('patch', {
                        schema: {
                            'x-uid': fieldSchema['x-uid'],
                            'x-component-props': fieldSchema['x-component-props'],
                            title: fieldSchema.title
                        }
                    });
                    dn.refresh();
                }
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaSettingsDivider, {}),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaSettingsRemove, {
                removeParentsIfNoChildren: true,
                breakRemoveOn: (s)=>'Space' === s['x-component'] || s['x-component'].endsWith('ActionBar'),
                confirm: {
                    title: t('Delete action')
                }
            })
        ]
    });
};
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
});
