"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module['default'];
        } : function() {
            return module;
        };
        __webpack_require__.d(getter, {
            a: getter
        });
        return getter;
    };
})();
(()=>{
    __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__, {
    useIsAddNewForm: ()=>useIsAddNewForm,
    useIsFileField: ()=>useIsFileField,
    useIsFieldReadPretty: ()=>useIsFieldReadPretty,
    useIsSelectFieldMode: ()=>useIsSelectFieldMode,
    useTitleFieldOptions: ()=>useTitleFieldOptions,
    useValidateSchema: ()=>useValidateSchema,
    formItemSettings: ()=>formItemSettings,
    useIsAssociationField: ()=>useIsAssociationField,
    useIsFormReadPretty: ()=>useIsFormReadPretty,
    useFieldMode: ()=>useFieldMode
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const components_namespaceObject = require("@tachybase/components");
const schema_namespaceObject = require("@tachybase/schema");
const external_lodash_namespaceObject = require("lodash");
var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
const external_react_i18next_namespaceObject = require("react-i18next");
const index_js_namespaceObject = require("../../../application/schema-settings/index.js");
const FormBlockProvider_js_namespaceObject = require("../../../block-provider/FormBlockProvider.js");
const external_collection_manager_index_js_namespaceObject = require("../../../collection-manager/index.js");
const external_data_source_index_js_namespaceObject = require("../../../data-source/index.js");
const external_record_provider_index_js_namespaceObject = require("../../../record-provider/index.js");
const Table_Column_Decorator_js_namespaceObject = require("../table-v2/Table.Column.Decorator.js");
const GeneralSettings_js_namespaceObject = require("../../../schema-items/GeneralSettings.js");
const useIsAllowToSetDefaultValue_js_namespaceObject = require("../../../schema-settings/hooks/useIsAllowToSetDefaultValue.js");
const useIsShowMultipleSwitch_js_namespaceObject = require("../../../schema-settings/hooks/useIsShowMultipleSwitch.js");
const isPatternDisabled_js_namespaceObject = require("../../../schema-settings/isPatternDisabled.js");
const type_js_namespaceObject = require("../../../schema-settings/LinkageRules/type.js");
const SchemaSettingsDataScope_js_namespaceObject = require("../../../schema-settings/SchemaSettingsDataScope.js");
const SchemaSettingsDateFormat_js_namespaceObject = require("../../../schema-settings/SchemaSettingsDateFormat.js");
const SchemaSettingsDefaultValue_js_namespaceObject = require("../../../schema-settings/SchemaSettingsDefaultValue.js");
const SchemaSettingsSortingRule_js_namespaceObject = require("../../../schema-settings/SchemaSettingsSortingRule.js");
const VariableInput_js_namespaceObject = require("../../../schema-settings/VariableInput/VariableInput.js");
const external_variables_index_js_namespaceObject = require("../../../variables/index.js");
const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
const util_js_namespaceObject = require("../association-field/util.js");
const external_filter_index_js_namespaceObject = require("../filter/index.js");
const utils_js_namespaceObject = require("../form-v2/utils.js");
const Table_Column_Designer_js_namespaceObject = require("../table-v2/Table.Column.Designer.js");
const formItemSettings = new index_js_namespaceObject.SchemaSettings({
    name: 'FormItemSettings',
    items: [
        ...GeneralSettings_js_namespaceObject.generalSettingsItems,
        {
            name: 'allowAddNewData',
            type: 'switch',
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return !readPretty && isAssociationField && [
                    'SubTable'
                ].includes(fieldMode);
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Allow add new'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.allowAddnew) !== false,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        field.componentProps.allowAddnew = value;
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props'].allowAddnew = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'allowSelectExistingRecord',
            type: 'switch',
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return !readPretty && isAssociationField && [
                    'SubTable'
                ].includes(fieldMode);
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Allow selection of existing records'),
                    checked: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.allowSelectExistingRecord,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        field.componentProps.allowSelectExistingRecord = value;
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props'].allowSelectExistingRecord = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'quickUpload',
            type: 'switch',
            useVisible () {
                const isFileField = useIsFileField();
                const isFormReadPretty = useIsFormReadPretty();
                return !isFormReadPretty && isFileField;
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Quick upload'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.quickUpload) !== false,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        field.componentProps.quickUpload = value;
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props'].quickUpload = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'selectFile',
            type: 'switch',
            useVisible () {
                const isFileField = useIsFileField();
                const isFormReadPretty = useIsFormReadPretty();
                return !isFormReadPretty && isFileField;
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Select file'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.selectFile) !== false,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        field.componentProps.selectFile = value;
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props'].selectFile = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'validationRules',
            type: 'modal',
            useComponentProps () {
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                const validateSchema = useValidateSchema();
                const { getCollectionJoinField } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
                const { getField } = (0, external_collection_manager_index_js_namespaceObject.useCollection_deprecated)();
                const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
                return {
                    title: t('Set validation rules'),
                    components: {
                        ArrayCollapse: components_namespaceObject.ArrayCollapse,
                        FormLayout: components_namespaceObject.FormLayout
                    },
                    schema: {
                        type: 'object',
                        title: t('Set validation rules'),
                        properties: {
                            rules: {
                                type: 'array',
                                default: null == fieldSchema ? void 0 : fieldSchema['x-validator'],
                                'x-component': 'ArrayCollapse',
                                'x-decorator': 'FormItem',
                                'x-component-props': {
                                    accordion: true
                                },
                                maxItems: 3,
                                items: {
                                    type: 'object',
                                    'x-component': 'ArrayCollapse.CollapsePanel',
                                    'x-component-props': {
                                        header: '{{ t("Validation rule") }}'
                                    },
                                    properties: {
                                        index: {
                                            type: 'void',
                                            'x-component': 'ArrayCollapse.Index'
                                        },
                                        layout: {
                                            type: 'void',
                                            'x-component': 'FormLayout',
                                            'x-component-props': {
                                                labelStyle: {
                                                    marginTop: '6px'
                                                },
                                                labelCol: 8,
                                                wrapperCol: 16
                                            },
                                            properties: {
                                                ...validateSchema,
                                                message: {
                                                    type: 'string',
                                                    title: '{{ t("Error message") }}',
                                                    'x-decorator': 'FormItem',
                                                    'x-component': 'Input.TextArea',
                                                    'x-component-props': {
                                                        autoSize: {
                                                            minRows: 2,
                                                            maxRows: 2
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        remove: {
                                            type: 'void',
                                            'x-component': 'ArrayCollapse.Remove'
                                        },
                                        moveUp: {
                                            type: 'void',
                                            'x-component': 'ArrayCollapse.MoveUp'
                                        },
                                        moveDown: {
                                            type: 'void',
                                            'x-component': 'ArrayCollapse.MoveDown'
                                        }
                                    }
                                },
                                properties: {
                                    add: {
                                        type: 'void',
                                        title: '{{ t("Add validation rule") }}',
                                        'x-component': 'ArrayCollapse.Addition',
                                        'x-reactions': {
                                            dependencies: [
                                                'rules'
                                            ],
                                            fulfill: {
                                                state: {
                                                    disabled: '{{$deps[0].length >= 3}}'
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    onSubmit (v) {
                        var _collectionField_uiSchema;
                        const rules = [];
                        for (const rule of v.rules)rules.push(external_lodash_default().pickBy(rule, external_lodash_default().identity));
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        if ([
                            'percent'
                        ].includes(null == collectionField ? void 0 : collectionField.interface)) for (const rule of rules){
                            if (!!rule.maxValue || !!rule.minValue) rule['percentMode'] = true;
                            if (rule.percentFormat) rule['percentFormats'] = true;
                        }
                        const concatValidator = external_lodash_default().concat([], (null == collectionField ? void 0 : null === (_collectionField_uiSchema = collectionField.uiSchema) || void 0 === _collectionField_uiSchema ? void 0 : _collectionField_uiSchema['x-validator']) || [], rules);
                        field.validator = concatValidator;
                        fieldSchema['x-validator'] = rules;
                        schema['x-validator'] = rules;
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            },
            useVisible () {
                const { form } = (0, FormBlockProvider_js_namespaceObject.useFormBlockContext)();
                const isFormReadPretty = useIsFormReadPretty();
                const validateSchema = useValidateSchema();
                return form && !isFormReadPretty && validateSchema;
            }
        },
        {
            name: 'isquickaddtabs',
            type: 'switch',
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return !readPretty && isAssociationField && [
                    'SubTable'
                ].includes(fieldMode);
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Is Quick Add Tabs'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.isQuickAdd) || false,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        field.componentProps['isQuickAdd'] = value;
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['isQuickAdd'] = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'setquickaddtabs',
            type: 'select',
            useComponentProps () {
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const cm = (0, external_data_source_index_js_namespaceObject.useCollectionManager)();
                const options = cm.getCollection(fieldSchema['x-collection-field']);
                const defVal = fieldSchema['x-component-props']['quickAddField'] || 'none';
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                const isAddNewForm = useIsAddNewForm();
                const fieldTabsOptions = options.fields.map((item)=>{
                    if ('m2o' === item.interface || 'select' === item.interface) {
                        var _item_uiSchema;
                        return {
                            ...item,
                            label: compile(null === (_item_uiSchema = item.uiSchema) || void 0 === _item_uiSchema ? void 0 : _item_uiSchema.title),
                            value: item.name
                        };
                    }
                }).filter(Boolean);
                fieldTabsOptions.unshift({
                    label: 'none',
                    value: 'none'
                });
                return {
                    title: t('Set Quick Add Tabs'),
                    options: fieldTabsOptions,
                    value: defVal,
                    onChange (mode) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['quickAddField'] = {
                            fieldInterface: fieldTabsOptions.find((item)=>item.value === mode)['interface'] || 'none',
                            value: mode
                        };
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps = field.componentProps || {};
                        field.componentProps['quickAddField'] = fieldSchema['x-component-props']['quickAddField'];
                        if ((0, util_js_namespaceObject.isSubMode)(fieldSchema) && isAddNewForm) {
                            schema.default = null;
                            fieldSchema.default = null;
                            field.setInitialValue(null);
                            field.setValue(null);
                        }
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            },
            useVisible () {
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                return fieldSchema['x-component-props']['isQuickAdd'];
            }
        },
        {
            name: 'setquickaddparenttabs',
            type: 'select',
            useComponentProps () {
                var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops_quickAddParentCollection, _fieldSchema_xcomponentprops1;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const cm = (0, external_data_source_index_js_namespaceObject.useCollectionManager)();
                const { value: quickField } = (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops['quickAddField']) || {};
                const options = cm.getCollectionFields("".concat(fieldSchema['x-collection-field'], ".").concat(quickField));
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                const isAddNewForm = useIsAddNewForm();
                const fieldTabsOptions = options.map((item)=>{
                    if ('m2o' === item.interface) return {
                        ...item,
                        label: compile(item.uiSchema.title),
                        value: item.name
                    };
                }).filter(Boolean);
                fieldTabsOptions.unshift({
                    label: t('none'),
                    value: 'none'
                });
                const defValue = (null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : null === (_fieldSchema_xcomponentprops_quickAddParentCollection = _fieldSchema_xcomponentprops1['quickAddParentCollection']) || void 0 === _fieldSchema_xcomponentprops_quickAddParentCollection ? void 0 : _fieldSchema_xcomponentprops_quickAddParentCollection.value) || 'none';
                return {
                    title: t('Set Quick Add Parent Tabs'),
                    options: fieldTabsOptions,
                    value: defValue,
                    onChange (mode) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['quickAddParentCollection'] = {
                            collectionField: "".concat(fieldSchema['x-collection-field'], ".").concat(quickField, ".").concat(mode),
                            value: mode
                        };
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps = field.componentProps || {};
                        field.componentProps['quickAddParentCollection'] = {
                            collectionField: "".concat(fieldSchema['x-collection-field'], ".").concat(quickField, ".").concat(mode),
                            value: mode
                        };
                        if ((0, util_js_namespaceObject.isSubMode)(fieldSchema) && isAddNewForm) {
                            schema.default = null;
                            fieldSchema.default = null;
                            field.setInitialValue(null);
                            field.setValue(null);
                        }
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            },
            useVisible () {
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                return fieldSchema['x-component-props']['isQuickAdd'] && fieldSchema['x-component-props']['quickAddField'] && 'none' !== fieldSchema['x-component-props']['quickAddField'];
            }
        },
        {
            name: 'defaultValue',
            Component: SchemaSettingsDefaultValue_js_namespaceObject.SchemaSettingsDefaultValue,
            useVisible () {
                const { isAllowToSetDefaultValue } = (0, useIsAllowToSetDefaultValue_js_namespaceObject.useIsAllowToSetDefaultValue)();
                return isAllowToSetDefaultValue();
            }
        },
        {
            name: 'dataScope',
            Component: SchemaSettingsDataScope_js_namespaceObject.SchemaSettingsDataScope,
            useVisible () {
                const isSelectFieldMode = useIsSelectFieldMode();
                const isFormReadPretty = useIsFormReadPretty();
                return isSelectFieldMode && !isFormReadPretty;
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops_service_params, _fieldSchema_xcomponentprops_service, _fieldSchema_xcomponentprops;
                const { getCollectionJoinField, getAllCollectionsInheritChain } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
                const { getField } = (0, external_collection_manager_index_js_namespaceObject.useCollection_deprecated)();
                const { form } = (0, FormBlockProvider_js_namespaceObject.useFormBlockContext)();
                const record = (0, external_record_provider_index_js_namespaceObject.useRecord)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
                const variables = (0, external_variables_index_js_namespaceObject.useVariables)();
                const localVariables = (0, external_variables_index_js_namespaceObject.useLocalVariables)();
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    collectionName: null == collectionField ? void 0 : collectionField.target,
                    defaultFilter: (null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : null === (_fieldSchema_xcomponentprops_service = _fieldSchema_xcomponentprops.service) || void 0 === _fieldSchema_xcomponentprops_service ? void 0 : null === (_fieldSchema_xcomponentprops_service_params = _fieldSchema_xcomponentprops_service.params) || void 0 === _fieldSchema_xcomponentprops_service_params ? void 0 : _fieldSchema_xcomponentprops_service_params.filter) || {},
                    form,
                    dynamicComponent: (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VariableInput_js_namespaceObject.VariableInput, {
                            ...props,
                            form: form,
                            collectionField: props.collectionField,
                            record: record,
                            shouldChange: (0, VariableInput_js_namespaceObject.getShouldChange)({
                                collectionField: props.collectionField,
                                variables,
                                localVariables,
                                getAllCollectionsInheritChain
                            })
                        }),
                    onSubmit: (param)=>{
                        let { filter } = param;
                        filter = (0, external_filter_index_js_namespaceObject.removeNullCondition)(filter);
                        external_lodash_default().set(field.componentProps, 'service.params.filter', filter);
                        fieldSchema['x-component-props'] = field.componentProps;
                        dn.emit('patch', {
                            schema: {
                                ['x-uid']: fieldSchema['x-uid'],
                                'x-component-props': field.componentProps
                            }
                        });
                    }
                };
            }
        },
        {
            name: 'sortingRule',
            Component: SchemaSettingsSortingRule_js_namespaceObject.SchemaSettingsSortingRule,
            useVisible () {
                const isSelectFieldMode = useIsSelectFieldMode();
                const isFormReadPretty = useIsFormReadPretty();
                return isSelectFieldMode && !isFormReadPretty;
            }
        },
        {
            name: 'fieldMode',
            type: 'select',
            useComponentProps () {
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                const fieldModeOptions = (0, external_hooks_index_js_namespaceObject.useFieldModeOptions)();
                const isAddNewForm = useIsAddNewForm();
                const fieldMode = useFieldMode();
                return {
                    title: t('Field component'),
                    options: fieldModeOptions,
                    value: fieldMode,
                    onChange (mode) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['mode'] = mode;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps = field.componentProps || {};
                        field.componentProps.mode = mode;
                        if ((0, util_js_namespaceObject.isSubMode)(fieldSchema) && isAddNewForm) {
                            schema.default = null;
                            fieldSchema.default = null;
                            field.setInitialValue(null);
                            field.setValue(null);
                        }
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            },
            useVisible: useShowFieldMode
        },
        {
            name: 'popupSize',
            type: 'select',
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                var _fieldSchema_xcomponentprops_openSize;
                return {
                    title: t('Popup size'),
                    options: [
                        {
                            label: t('Small'),
                            value: 'small'
                        },
                        {
                            label: t('Middle'),
                            value: 'middle'
                        },
                        {
                            label: t('Large'),
                            value: 'large'
                        }
                    ],
                    value: null !== (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops['openSize']) && void 0 !== _fieldSchema_xcomponentprops_openSize ? _fieldSchema_xcomponentprops_openSize : 'middle',
                    onChange: (value)=>{
                        field.componentProps.openSize = value;
                        fieldSchema['x-component-props'] = field.componentProps;
                        dn.emit('patch', {
                            schema: {
                                'x-uid': fieldSchema['x-uid'],
                                'x-component-props': fieldSchema['x-component-props']
                            }
                        });
                        dn.refresh();
                    }
                };
            },
            useVisible () {
                var _fieldSchema_xcomponentprops;
                const showFieldMode = useShowFieldMode();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const isPickerMode = (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.mode) === 'Picker';
                const showModeSelect = showFieldMode && isPickerMode;
                return showModeSelect;
            }
        },
        {
            name: 'allowAddNew',
            type: 'switch',
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return !readPretty && isAssociationField && [
                    'Picker'
                ].includes(fieldMode);
            },
            useComponentProps () {
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh, insertAdjacent } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Allow add new data'),
                    checked: fieldSchema['x-add-new'],
                    onChange (allowAddNew) {
                        const hasAddNew = fieldSchema.reduceProperties((buf, schema)=>{
                            if ('Action' === schema['x-component']) return schema;
                            return buf;
                        }, null);
                        if (!hasAddNew) {
                            const addNewActionschema = {
                                'x-action': 'create',
                                'x-acl-action': 'create',
                                title: "{{t('Add new')}}",
                                'x-toolbar': 'ActionSchemaToolbar',
                                'x-settings': 'actonSettings:addNew',
                                'x-component': 'Action',
                                'x-decorator': 'ACLActionProvider',
                                'x-component-props': {
                                    openMode: 'drawer',
                                    type: 'default',
                                    component: 'CreateRecordAction'
                                }
                            };
                            insertAdjacent('afterBegin', addNewActionschema);
                        }
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        field['x-add-new'] = allowAddNew;
                        fieldSchema['x-add-new'] = allowAddNew;
                        schema['x-add-new'] = allowAddNew;
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'addMode',
            type: 'select',
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return !readPretty && isAssociationField && [
                    'Select'
                ].includes(fieldMode);
            },
            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, insertAdjacent } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Quick create'),
                    options: [
                        {
                            label: t('None'),
                            value: 'none'
                        },
                        {
                            label: t('Dropdown'),
                            value: 'quickAdd'
                        },
                        {
                            label: t('Pop-up'),
                            value: 'modalAdd'
                        }
                    ],
                    value: (null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : _field_componentProps.addMode) || 'none',
                    onChange (mode) {
                        if ('modalAdd' === mode) {
                            const hasAddNew = fieldSchema.reduceProperties((buf, schema)=>{
                                if ('Action' === schema['x-component']) return schema;
                                return buf;
                            }, null);
                            if (!hasAddNew) {
                                const addNewActionschema = {
                                    'x-action': 'create',
                                    'x-acl-action': 'create',
                                    title: "{{t('Add new')}}",
                                    'x-toolbar': 'ActionSchemaToolbar',
                                    'x-settings': 'actonSettings:addNew',
                                    'x-component': 'Action',
                                    'x-decorator': 'ACLActionProvider',
                                    'x-component-props': {
                                        openMode: 'drawer',
                                        type: 'default',
                                        component: 'CreateRecordAction'
                                    }
                                };
                                insertAdjacent('afterBegin', addNewActionschema);
                            }
                        }
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['addMode'] = mode;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps = field.componentProps || {};
                        field.componentProps.addMode = mode;
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'multiple',
            type: 'switch',
            useVisible () {
                const isAssociationField = useIsAssociationField();
                const IsShowMultipleSwitch = (0, useIsShowMultipleSwitch_js_namespaceObject.useIsShowMultipleSwitch)();
                return isAssociationField && IsShowMultipleSwitch();
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Allow multiple'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.multiple) === void 0 || fieldSchema['x-component-props'].multiple,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        field.componentProps = field.componentProps || {};
                        fieldSchema['x-component-props'].multiple = value;
                        field.componentProps.multiple = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'allowDissociate',
            type: 'switch',
            useVisible () {
                var _fieldSchema_xcomponentprops;
                const IsShowMultipleSwitch = (0, useIsShowMultipleSwitch_js_namespaceObject.useIsShowMultipleSwitch)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const isSubFormMode = (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.mode) === 'Nester';
                return isSubFormMode && IsShowMultipleSwitch();
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn, refresh } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Allow dissociate'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.allowDissociate) !== false,
                    onChange (value) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        field.componentProps = field.componentProps || {};
                        fieldSchema['x-component-props'].allowDissociate = value;
                        field.componentProps.allowDissociate = value;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        dn.emit('patch', {
                            schema
                        });
                        refresh();
                    }
                };
            }
        },
        {
            name: 'enableLink',
            type: 'switch',
            useVisible () {
                const options = useTitleFieldOptions();
                const readPretty = useIsFieldReadPretty();
                const isFileField = useIsFileField();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                return readPretty && options.length > 0 && !isFileField && 'CollectionField' === fieldSchema['x-component'];
            },
            useComponentProps () {
                var _fieldSchema_xcomponentprops;
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                return {
                    title: t('Enable link'),
                    checked: (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.enableLink) !== false,
                    onChange (flag) {
                        fieldSchema['x-component-props'] = {
                            ...null == fieldSchema ? void 0 : fieldSchema['x-component-props'],
                            enableLink: flag
                        };
                        field.componentProps['enableLink'] = flag;
                        dn.emit('patch', {
                            schema: {
                                'x-uid': fieldSchema['x-uid'],
                                'x-component-props': {
                                    ...null == fieldSchema ? void 0 : fieldSchema['x-component-props']
                                }
                            }
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'pattern',
            type: 'select',
            useVisible () {
                const { form } = (0, FormBlockProvider_js_namespaceObject.useFormBlockContext)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                return form && !(null == form ? void 0 : form.readPretty) && !(0, isPatternDisabled_js_namespaceObject.isPatternDisabled)(fieldSchema);
            },
            useComponentProps () {
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                const field = (0, schema_namespaceObject.useField)();
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
                let readOnlyMode = 'editable';
                if (true === fieldSchema['x-disabled']) readOnlyMode = 'readonly';
                if (true === fieldSchema['x-read-pretty']) readOnlyMode = 'read-pretty';
                return {
                    title: t('Pattern'),
                    options: [
                        {
                            label: t('Editable'),
                            value: 'editable'
                        },
                        {
                            label: t('Readonly'),
                            value: 'readonly'
                        },
                        {
                            label: t('Easy-reading'),
                            value: 'read-pretty'
                        }
                    ],
                    value: readOnlyMode,
                    onChange (v) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        switch(v){
                            case 'readonly':
                                fieldSchema['x-read-pretty'] = false;
                                fieldSchema['x-disabled'] = true;
                                schema['x-read-pretty'] = false;
                                schema['x-disabled'] = true;
                                field.readPretty = false;
                                field.disabled = true;
                                external_lodash_default().set(field, 'initStateOfLinkageRules.pattern', (0, utils_js_namespaceObject.getTempFieldState)(true, type_js_namespaceObject.ActionType.ReadOnly));
                                break;
                            case 'read-pretty':
                                fieldSchema['x-read-pretty'] = true;
                                fieldSchema['x-disabled'] = false;
                                schema['x-read-pretty'] = true;
                                schema['x-disabled'] = false;
                                field.readPretty = true;
                                external_lodash_default().set(field, 'initStateOfLinkageRules.pattern', (0, utils_js_namespaceObject.getTempFieldState)(true, type_js_namespaceObject.ActionType.ReadPretty));
                                break;
                            default:
                                fieldSchema['x-read-pretty'] = false;
                                fieldSchema['x-disabled'] = false;
                                schema['x-read-pretty'] = false;
                                schema['x-disabled'] = false;
                                field.readPretty = false;
                                field.disabled = false;
                                external_lodash_default().set(field, 'initStateOfLinkageRules.pattern', (0, utils_js_namespaceObject.getTempFieldState)(true, type_js_namespaceObject.ActionType.Editable));
                                break;
                        }
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'titleField',
            type: 'select',
            useVisible () {
                const options = useTitleFieldOptions();
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return options.length > 0 && isAssociationField && 'SubTable' !== fieldMode;
            },
            useComponentProps () {
                var _field_componentProps_fieldNames, _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, external_hooks_index_js_namespaceObject.useDesignable)();
                const options = useTitleFieldOptions();
                const collectionField = (0, external_collection_manager_index_js_namespaceObject.useCollectionField_deprecated)();
                return {
                    title: t('Title field'),
                    options,
                    value: null == field ? void 0 : null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : null === (_field_componentProps_fieldNames = _field_componentProps.fieldNames) || void 0 === _field_componentProps_fieldNames ? void 0 : _field_componentProps_fieldNames.label,
                    onChange (label) {
                        var _collectionField_uiSchema_xcomponentprops, _collectionField_uiSchema;
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        const fieldNames = {
                            ...null == collectionField ? void 0 : null === (_collectionField_uiSchema = collectionField.uiSchema) || void 0 === _collectionField_uiSchema ? void 0 : null === (_collectionField_uiSchema_xcomponentprops = _collectionField_uiSchema['x-component-props']) || void 0 === _collectionField_uiSchema_xcomponentprops ? void 0 : _collectionField_uiSchema_xcomponentprops['fieldNames'],
                            ...field.componentProps.fieldNames,
                            label
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['fieldNames'] = fieldNames;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps.fieldNames = fieldSchema['x-component-props'].fieldNames;
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'dateFormat',
            Component: SchemaSettingsDateFormat_js_namespaceObject.SchemaSettingsDateFormat,
            useVisible () {
                const collectionField = useFormItemCollectionField();
                const isDateField = [
                    'datetime',
                    'createdAt',
                    'updatedAt'
                ].includes(null == collectionField ? void 0 : collectionField.interface);
                return isDateField;
            },
            useComponentProps () {
                const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
                return {
                    fieldSchema
                };
            }
        },
        {
            name: 'size',
            type: 'select',
            useVisible () {
                const readPretty = useIsFieldReadPretty();
                const collectionField = useFormItemCollectionField();
                const { getCollection } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
                const targetCollection = getCollection(null == collectionField ? void 0 : collectionField.target);
                const isAttachmentField = [
                    'attachment'
                ].includes(null == collectionField ? void 0 : collectionField.interface) || (null == targetCollection ? void 0 : targetCollection.template) === 'file';
                return readPretty && isAttachmentField;
            },
            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, external_hooks_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: 'tagColor',
            type: 'select',
            useVisible () {
                const isAssociationField = useIsAssociationField();
                const fieldMode = useFieldMode();
                return isAssociationField && [
                    'Tag'
                ].includes(fieldMode);
            },
            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, external_hooks_index_js_namespaceObject.useDesignable)();
                const collectionField = useFormItemCollectionField();
                var _collectionField_target;
                const colorFieldOptions = (0, Table_Column_Designer_js_namespaceObject.useColorFields)(null !== (_collectionField_target = null == collectionField ? void 0 : collectionField.target) && void 0 !== _collectionField_target ? _collectionField_target : null == collectionField ? void 0 : collectionField.targetCollection);
                return {
                    title: t('Tag color field'),
                    options: colorFieldOptions,
                    value: null == field ? void 0 : null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : _field_componentProps.tagColorField,
                    onChange (tagColorField) {
                        const schema = {
                            ['x-uid']: fieldSchema['x-uid']
                        };
                        fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
                        fieldSchema['x-component-props']['tagColorField'] = tagColorField;
                        schema['x-component-props'] = fieldSchema['x-component-props'];
                        field.componentProps.tagColorField = tagColorField;
                        dn.emit('patch', {
                            schema
                        });
                        dn.refresh();
                    }
                };
            }
        },
        {
            name: 'divider',
            type: 'divider',
            useVisible () {
                const collectionField = useFormItemCollectionField();
                return !!collectionField;
            }
        },
        {
            name: 'remove',
            type: 'remove',
            useComponentProps () {
                const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
                return {
                    removeParentsIfNoChildren: true,
                    confirm: {
                        title: t('Delete field')
                    },
                    breakRemoveOn: {
                        'x-component': 'Grid'
                    }
                };
            }
        }
    ]
});
function useIsAddNewForm() {
    const record = (0, external_record_provider_index_js_namespaceObject.useRecord)();
    const isAddNewForm = external_lodash_default().isEmpty(external_lodash_default().omit(record, [
        '__parent',
        '__collectionName'
    ]));
    return isAddNewForm;
}
function isFileCollection(collection) {
    return (null == collection ? void 0 : collection.template) === 'file';
}
function useIsFormReadPretty() {
    const { form } = (0, FormBlockProvider_js_namespaceObject.useFormBlockContext)();
    return !!(null == form ? void 0 : form.readPretty);
}
function useIsFieldReadPretty() {
    const { fieldSchema: tableColumnSchema } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
    const field = (0, schema_namespaceObject.useField)();
    return field.readPretty || (null == tableColumnSchema ? void 0 : tableColumnSchema['x-read-pretty']);
}
function useFormItemCollectionField() {
    const { getCollectionJoinField } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
    const { getField } = (0, external_collection_manager_index_js_namespaceObject.useCollection_deprecated)();
    const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
    const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
    const { collectionField: columnCollectionField } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
    return collectionField || columnCollectionField;
}
function useIsAssociationField() {
    const collectionField = useFormItemCollectionField();
    const isAssociationField = [
        'obo',
        'oho',
        'o2o',
        'o2m',
        'm2m',
        'm2o',
        'updatedBy',
        'createdBy'
    ].includes(null == collectionField ? void 0 : collectionField.interface);
    return isAssociationField;
}
function useIsFileField() {
    const { getCollection } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
    const collectionField = useFormItemCollectionField();
    const targetCollection = getCollection(null == collectionField ? void 0 : collectionField.target);
    const isFileField = isFileCollection(targetCollection);
    return isFileField;
}
function useFieldMode() {
    var _field_componentProps;
    const field = (0, schema_namespaceObject.useField)();
    const isFileField = useIsFileField();
    const fieldMode = (null == field ? void 0 : null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : _field_componentProps['mode']) || (isFileField ? 'FileManager' : 'Select');
    return fieldMode;
}
function useIsSelectFieldMode() {
    const fieldMode = useFieldMode();
    const isAssociationField = useIsAssociationField();
    const isSelectFieldMode = isAssociationField && 'Select' === fieldMode;
    return isSelectFieldMode;
}
function useValidateSchema() {
    var _interfaceConfig_validateSchema;
    const { getInterface } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
    const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
    const collectionField = useFormItemCollectionField();
    const interfaceConfig = getInterface(null == collectionField ? void 0 : collectionField.interface);
    const validateSchema = null == interfaceConfig ? void 0 : null === (_interfaceConfig_validateSchema = interfaceConfig['validateSchema']) || void 0 === _interfaceConfig_validateSchema ? void 0 : _interfaceConfig_validateSchema.call(interfaceConfig, fieldSchema);
    return validateSchema;
}
function useShowFieldMode() {
    const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
    const fieldModeOptions = (0, external_hooks_index_js_namespaceObject.useFieldModeOptions)();
    const isTableField = 'TableField' === fieldSchema['x-component'];
    const isAssociationField = useIsAssociationField();
    const showFieldMode = isAssociationField && fieldModeOptions && !isTableField;
    return showFieldMode;
}
function useTitleFieldOptions() {
    const { getCollectionFields, isTitleField } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
    const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
    const collectionField = useFormItemCollectionField();
    var _getCollectionFields;
    const targetFields = (null == collectionField ? void 0 : collectionField.target) ? getCollectionFields(null == collectionField ? void 0 : collectionField.target) : null !== (_getCollectionFields = getCollectionFields(null == collectionField ? void 0 : collectionField.targetCollection)) && void 0 !== _getCollectionFields ? _getCollectionFields : [];
    const options = targetFields.map((field)=>{
        var _field_uiSchema;
        return {
            value: null == field ? void 0 : field.name,
            label: compile(null == field ? void 0 : null === (_field_uiSchema = field.uiSchema) || void 0 === _field_uiSchema ? void 0 : _field_uiSchema.title) || (null == field ? void 0 : field.name)
        };
    });
    return options;
}
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
});
