diff --git a/packages/core/src/__tests__/field.spec.ts b/packages/core/src/__tests__/field.spec.ts
index b4530e98f95..b34fc5a1e84 100644
--- a/packages/core/src/__tests__/field.spec.ts
+++ b/packages/core/src/__tests__/field.spec.ts
@@ -1791,3 +1791,22 @@ test('field setValidator repeat call', async () => {
await form.validate()
expect(validator1).toBeCalledTimes(1)
})
+
+test('custom validator to get ctx.field', async () => {
+ const form = attach(createForm())
+ let ctxField = null
+ let ctxForm = null
+ attach(
+ form.createField({
+ name: 'aaa',
+ validator(value, rule, ctx) {
+ ctxField = ctx.field
+ ctxForm = ctx.form
+ return ''
+ },
+ })
+ )
+ await form.submit()
+ expect(!!ctxField).toBeTruthy()
+ expect(!!ctxForm).toBeTruthy()
+})
diff --git a/packages/next/src/__builtins__/icons.tsx b/packages/next/src/__builtins__/icons.tsx
index ca55dcdf3d8..dd62fe6fdf5 100644
--- a/packages/next/src/__builtins__/icons.tsx
+++ b/packages/next/src/__builtins__/icons.tsx
@@ -62,3 +62,47 @@ export const DeleteOutlinedIcon: IconType = React.forwardRef((props, ref) => (
))
+
+export const QuestionCircleOutlinedIcon: IconType = React.forwardRef(
+ (props, ref) => (
+
+
+
+
+ )
+)
+export const CloseCircleOutlinedIcon: IconType = React.forwardRef(
+ (props, ref) => (
+
+
+
+
+ )
+)
+export const CheckCircleOutlinedIcon: IconType = React.forwardRef(
+ (props, ref) => (
+
+
+
+
+ )
+)
+export const ExclamationCircleOutlinedIcon: IconType = React.forwardRef(
+ (props, ref) =>
+)
+
+export const EditOutlinedIcon: IconType = React.forwardRef((props, ref) => (
+
+ {' '}
+
+))
+export const CloseOutlinedIcon: IconType = React.forwardRef((props, ref) => (
+
+
+
+))
+export const MessageOutlinedIcon: IconType = React.forwardRef((props, ref) => (
+
+
+
+))
diff --git a/packages/next/src/editable/index.tsx b/packages/next/src/editable/index.tsx
index 6a6f1401338..b0db3e74a2a 100644
--- a/packages/next/src/editable/index.tsx
+++ b/packages/next/src/editable/index.tsx
@@ -2,10 +2,15 @@ import React, { useLayoutEffect, useRef, useState } from 'react'
import { isVoidField, Field } from '@formily/core'
import { useField, observer } from '@formily/react'
import { Balloon } from '@alifd/next'
-import { EditOutlined, CloseOutlined, MessageOutlined } from '@ant-design/icons'
import { BalloonProps as PopoverProps } from '@alifd/next/lib/balloon'
import { BaseItem, IFormItemProps } from '../form-item'
-import { useClickAway, usePrefixCls } from '../__builtins__'
+import {
+ useClickAway,
+ usePrefixCls,
+ EditOutlinedIcon,
+ CloseOutlinedIcon,
+ MessageOutlinedIcon,
+} from '../__builtins__'
/**
* 默认Inline展示
*/
@@ -75,10 +80,10 @@ export const Editable: ComposedEditable = observer((props) => {
return (
{pattern === 'editable' && (
-
+
)}
{pattern !== 'editable' && (
-
+
)}
)
@@ -88,7 +93,7 @@ export const Editable: ComposedEditable = observer((props) => {
if (!editable) return
return (
-
+
)
}
@@ -173,10 +178,10 @@ Editable.Popover = observer(({ ...props }) => {
{props.title || field.title}
{pattern === 'editable' && (
-
+
)}
{pattern !== 'editable' && (
-
+
)}
diff --git a/packages/next/src/form-item/index.tsx b/packages/next/src/form-item/index.tsx
index 44ee98cb326..33b7472455b 100644
--- a/packages/next/src/form-item/index.tsx
+++ b/packages/next/src/form-item/index.tsx
@@ -1,16 +1,17 @@
import React, { useState, useRef, useEffect } from 'react'
import cls from 'classnames'
-import { usePrefixCls, pickDataProps } from '../__builtins__'
+import {
+ usePrefixCls,
+ pickDataProps,
+ QuestionCircleOutlinedIcon,
+ CloseCircleOutlinedIcon,
+ CheckCircleOutlinedIcon,
+ ExclamationCircleOutlinedIcon,
+} from '../__builtins__'
import { isVoidField } from '@formily/core'
import { connect, mapProps } from '@formily/react'
import { useFormLayout, FormLayoutShallowContext } from '../form-layout'
import { Balloon } from '@alifd/next'
-import {
- QuestionCircleOutlined,
- CloseCircleOutlined,
- CheckCircleOutlined,
- ExclamationCircleOutlined,
-} from '@ant-design/icons'
export interface IFormItemProps {
className?: string
@@ -77,7 +78,7 @@ const useFormItemLayout = (props: IFormItemProps) => {
feedbackLayout: props.feedbackLayout ?? layout.feedbackLayout ?? 'loose',
tooltipLayout: props.tooltipLayout ?? layout.tooltipLayout ?? 'icon',
tooltipIcon: props.tooltipIcon ?? layout.tooltipIcon ?? (
-
+
),
}
}
@@ -110,9 +111,9 @@ function useOverflow<
}
const ICON_MAP = {
- error: ,
- success: ,
- warning: ,
+ error: ,
+ success: ,
+ warning: ,
}
export const BaseItem: React.FC = (props) => {