import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../application/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__ from "../../schema-settings/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__SchemaSettingsBlockTitleItem_mjs__ from "./SchemaSettingsBlockTitleItem.mjs";
const QuickAccessLayout = {
    Grid: 'grid',
    List: 'list'
};
const ActionPanelLayout = ()=>{
    var _fieldSchema_xcomponentprops;
    const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
    const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
    const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsSelectItem, {
        title: t('Layout'),
        options: [
            {
                label: t('Grid'),
                value: QuickAccessLayout.Grid
            },
            {
                label: t('List'),
                value: QuickAccessLayout.List
            }
        ],
        value: (null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.layout) || QuickAccessLayout.Grid,
        onChange: (value)=>{
            field.componentProps.layout = value;
            const schema = {
                'x-uid': fieldSchema['x-uid']
            };
            fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
            schema['x-component-props'] = fieldSchema['x-component-props'] || {};
            schema['x-component-props'].layout = value;
            fieldSchema['x-component-props'].layout = value;
            dn.emit('patch', {
                schema: schema
            });
            dn.refresh();
        }
    });
};
const quickAccessBlockSettings = new __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.SchemaSettings({
    name: 'blockSettings:quickAccess',
    items: [
        {
            name: 'title',
            Component: __WEBPACK_EXTERNAL_MODULE__SchemaSettingsBlockTitleItem_mjs__.CustomSchemaSettingsBlockTitleItem
        },
        {
            name: 'layout',
            Component: ActionPanelLayout
        },
        {
            type: 'remove',
            name: 'remove'
        }
    ]
});
export { QuickAccessLayout, quickAccessBlockSettings };
