Skip to content

Commit 9de2572

Browse files
committed
fix(antd/next): fix props.prefix is not work for FormGrid/FormLayout
1 parent e684bb7 commit 9de2572

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

packages/antd/src/form-grid/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ interface ILayoutProps {
3939
export interface IFormGridProps {
4040
className?: string
4141
style?: React.CSSProperties
42+
prefixCls?: string
4243
minWidth?: number | number[]
4344
maxWidth?: number | number[]
4445
minColumns?: number | number[]
@@ -123,7 +124,7 @@ const normalizeProps = (props: IFormGridProps): ILayoutProps => {
123124
const useGridLayout = (outerProps: IFormGridProps): ILayout => {
124125
const ref = useRef<HTMLDivElement>(null)
125126
const props = useRef<ILayoutProps>()
126-
const formGridPrefixCls = usePrefixCls('formily-grid')
127+
const formGridPrefixCls = usePrefixCls('formily-grid', outerProps)
127128
const [layoutParams, setLayout] = useState({})
128129
const [styles, setStyles] = useState({})
129130
const normalizedProps = normalizeProps(outerProps)

packages/antd/src/form-layout/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const FormLayout: React.FC<IFormLayoutProps> & {
4646
useFormShallowLayout: () => IFormLayoutProps
4747
} = ({ shallow, children, prefixCls, className, style, ...props }) => {
4848
const deepLayout = useFormDeepLayout()
49-
const formPrefixCls = usePrefixCls('form')
49+
const formPrefixCls = usePrefixCls('form', { prefixCls })
5050
const layoutPrefixCls = usePrefixCls('formily-layout', { prefixCls })
5151
const layoutClassName = cls(
5252
layoutPrefixCls,

packages/next/src/form-grid/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ interface ILayoutProps {
3737
}
3838

3939
export interface IFormGridProps {
40+
prefix?: string
4041
style?: React.CSSProperties
4142
className?: string
4243
minWidth?: number | number[]
@@ -123,7 +124,7 @@ const normalizeProps = (props: IFormGridProps): ILayoutProps => {
123124
const useGridLayout = (outerProps: IFormGridProps): ILayout => {
124125
const ref = useRef<HTMLDivElement>(null)
125126
const props = useRef<ILayoutProps>()
126-
const formGridPrefixCls = usePrefixCls('formily-grid')
127+
const formGridPrefixCls = usePrefixCls('formily-grid', outerProps)
127128
const [layoutParams, setLayout] = useState({})
128129
const [styles, setStyles] = useState({})
129130
const normalizedProps = normalizeProps(outerProps)

packages/next/src/form-layout/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const FormLayout: React.FC<IFormLayoutProps> & {
4646
useFormShallowLayout: () => IFormLayoutProps
4747
} = ({ shallow, children, prefix, className, style, ...props }) => {
4848
const deepLayout = useFormDeepLayout()
49-
const formPrefixCls = usePrefixCls('form')
49+
const formPrefixCls = usePrefixCls('form', { prefix })
5050
const layoutPrefixCls = usePrefixCls('formily-layout', { prefix })
5151
const layoutClassName = cls(
5252
layoutPrefixCls,

0 commit comments

Comments
 (0)