mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
fix(enableLink): fix error when enableLink is enabled
This commit is contained in:
parent
eb57d5325c
commit
6ef4e9608c
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
import { useField, useFieldSchema } from '@formily/react';
|
import { useField, useFieldSchema } from '@formily/react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useBlockContext, useOpenModeContext } from '../../../../';
|
||||||
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
||||||
import { SchemaSettingsItemType } from '../../../../application/schema-settings/types';
|
import { SchemaSettingsItemType } from '../../../../application/schema-settings/types';
|
||||||
import {
|
import {
|
||||||
@ -17,8 +18,6 @@ import {
|
|||||||
} from '../../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
} from '../../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
||||||
import { useDesignable } from '../../../../schema-component/hooks/useDesignable';
|
import { useDesignable } from '../../../../schema-component/hooks/useDesignable';
|
||||||
import { SchemaSettingOpenModeSchemaItems } from '../../../../schema-items';
|
import { SchemaSettingOpenModeSchemaItems } from '../../../../schema-items';
|
||||||
import { useOpenModeContext } from '../../../../';
|
|
||||||
import { useBlockContext } from '../../../../';
|
|
||||||
export const ellipsisSettingsItem: SchemaSettingsItemType = {
|
export const ellipsisSettingsItem: SchemaSettingsItemType = {
|
||||||
name: 'ellipsis',
|
name: 'ellipsis',
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
@ -100,7 +99,6 @@ export const enableLinkSettingsItem: SchemaSettingsItemType = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
dn.refresh();
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ import { SchemaSettings } from '../../../../application/schema-settings/SchemaSe
|
|||||||
import { useFormBlockContext } from '../../../../block-provider/FormBlockProvider';
|
import { useFormBlockContext } from '../../../../block-provider/FormBlockProvider';
|
||||||
import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager';
|
import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager';
|
||||||
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
||||||
import { useCollectionField } from '../../../../data-source';
|
import { useCollectionField, useDataBlockProps } from '../../../../data-source';
|
||||||
import { useRecord } from '../../../../record-provider';
|
import { useRecord } from '../../../../record-provider';
|
||||||
import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component';
|
import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component';
|
||||||
import { isSubMode } from '../../../../schema-component/antd/association-field/util';
|
import { isSubMode } from '../../../../schema-component/antd/association-field/util';
|
||||||
@ -34,7 +34,6 @@ import { SchemaSettingsSortingRule } from '../../../../schema-settings/SchemaSet
|
|||||||
import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch';
|
import { useIsShowMultipleSwitch } from '../../../../schema-settings/hooks/useIsShowMultipleSwitch';
|
||||||
import { useLocalVariables, useVariables } from '../../../../variables';
|
import { useLocalVariables, useVariables } from '../../../../variables';
|
||||||
import { useOpenModeContext } from '../../../popup/OpenModeProvider';
|
import { useOpenModeContext } from '../../../popup/OpenModeProvider';
|
||||||
import { useDataBlockProps } from '../../../../data-source';
|
|
||||||
import { enableLinkSettingsItem, openModeSettingsItem } from '../Input/inputComponentSettings';
|
import { enableLinkSettingsItem, openModeSettingsItem } from '../Input/inputComponentSettings';
|
||||||
|
|
||||||
const enableLink = {
|
const enableLink = {
|
||||||
@ -68,7 +67,6 @@ const enableLink = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
dn.refresh();
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -12,12 +12,12 @@ import { useField, useFieldSchema } from '@formily/react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
||||||
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
||||||
|
import { useCollectionField } from '../../../../data-source';
|
||||||
import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component';
|
import { useDesignable, useFieldModeOptions, useIsAddNewForm } from '../../../../schema-component';
|
||||||
import { isSubMode } from '../../../../schema-component/antd/association-field/util';
|
import { isSubMode } from '../../../../schema-component/antd/association-field/util';
|
||||||
import { useTitleFieldOptions } from '../../../../schema-component/antd/form-item/FormItem.Settings';
|
import { useTitleFieldOptions } from '../../../../schema-component/antd/form-item/FormItem.Settings';
|
||||||
import { useColorFields } from '../../../../schema-component/antd/table-v2/Table.Column.Designer';
|
|
||||||
import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
||||||
import { useCollectionField } from '../../../../data-source';
|
import { useColorFields } from '../../../../schema-component/antd/table-v2/Table.Column.Designer';
|
||||||
|
|
||||||
const enableLink = {
|
const enableLink = {
|
||||||
name: 'enableLink',
|
name: 'enableLink',
|
||||||
@ -46,7 +46,6 @@ const enableLink = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
dn.refresh();
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -7,16 +7,16 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useState, useCallback, useRef } from 'react';
|
import { useField, useFieldSchema } from '@formily/react';
|
||||||
import { RecursionField, useFieldSchema, useField } from '@formily/react';
|
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { popupSchema } from './schema';
|
import React, { useCallback, useRef, useState } from 'react';
|
||||||
import { App } from 'antd';
|
import { ActionContextProvider, SchemaComponentOptions, useActionContext, useDesignable } from '../../';
|
||||||
import { useDesignable, useActionContext, SchemaComponentOptions, ActionContextProvider } from '../../';
|
|
||||||
import { PopupVisibleProvider } from '../../antd/page/PagePopups';
|
import { PopupVisibleProvider } from '../../antd/page/PagePopups';
|
||||||
import { usePopupUtils } from '../../antd/page/pagePopupUtils';
|
import { usePopupUtils } from '../../antd/page/pagePopupUtils';
|
||||||
|
import { popupSchema } from './schema';
|
||||||
|
|
||||||
import { CollectionProvider, useCollection } from '../../../data-source';
|
import { CollectionProvider, useCollection } from '../../../data-source';
|
||||||
|
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||||
|
|
||||||
export const useInsertSchema = () => {
|
export const useInsertSchema = () => {
|
||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
@ -35,6 +35,10 @@ export const useInsertSchema = () => {
|
|||||||
return insert;
|
return insert;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const filterProperties = (s) => {
|
||||||
|
return s['x-component'] === 'Action.Container';
|
||||||
|
};
|
||||||
|
|
||||||
// 高阶组件:用来包装每个组件并添加弹窗功能
|
// 高阶组件:用来包装每个组件并添加弹窗功能
|
||||||
function withPopupWrapper<T>(WrappedComponent: React.ComponentType<T>) {
|
function withPopupWrapper<T>(WrappedComponent: React.ComponentType<T>) {
|
||||||
return (props: T) => {
|
return (props: T) => {
|
||||||
@ -59,8 +63,6 @@ function withPopupWrapper<T>(WrappedComponent: React.ComponentType<T>) {
|
|||||||
};
|
};
|
||||||
const { setSubmitted } = ctx;
|
const { setSubmitted } = ctx;
|
||||||
|
|
||||||
const { modal } = App.useApp();
|
|
||||||
|
|
||||||
const handleVisibleChange = useCallback(
|
const handleVisibleChange = useCallback(
|
||||||
(value: boolean): void => {
|
(value: boolean): void => {
|
||||||
setVisible?.(value);
|
setVisible?.(value);
|
||||||
@ -84,13 +86,11 @@ function withPopupWrapper<T>(WrappedComponent: React.ComponentType<T>) {
|
|||||||
>
|
>
|
||||||
<CollectionProvider name={collection.name}>
|
<CollectionProvider name={collection.name}>
|
||||||
<SchemaComponentOptions>
|
<SchemaComponentOptions>
|
||||||
<RecursionField
|
<NocoBaseRecursionField
|
||||||
onlyRenderProperties
|
onlyRenderProperties
|
||||||
basePath={field?.address}
|
basePath={field?.address}
|
||||||
schema={fieldSchema}
|
schema={fieldSchema}
|
||||||
filterProperties={(s) => {
|
filterProperties={filterProperties}
|
||||||
return s['x-component'] === 'Action.Container';
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</SchemaComponentOptions>
|
</SchemaComponentOptions>
|
||||||
</CollectionProvider>
|
</CollectionProvider>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user