Skip to content

Commit

Permalink
fix(antd/next): fix props.prefix is not work for FormGrid/FormLayout (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Sep 14, 2021
1 parent e684bb7 commit bcdac58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/antd/src/form-grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface ILayoutProps {
export interface IFormGridProps {
className?: string
style?: React.CSSProperties
prefixCls?: string
minWidth?: number | number[]
maxWidth?: number | number[]
minColumns?: number | number[]
Expand Down Expand Up @@ -123,7 +124,7 @@ const normalizeProps = (props: IFormGridProps): ILayoutProps => {
const useGridLayout = (outerProps: IFormGridProps): ILayout => {
const ref = useRef<HTMLDivElement>(null)
const props = useRef<ILayoutProps>()
const formGridPrefixCls = usePrefixCls('formily-grid')
const formGridPrefixCls = usePrefixCls('formily-grid', outerProps)
const [layoutParams, setLayout] = useState({})
const [styles, setStyles] = useState({})
const normalizedProps = normalizeProps(outerProps)
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/form-layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const FormLayout: React.FC<IFormLayoutProps> & {
useFormShallowLayout: () => IFormLayoutProps
} = ({ shallow, children, prefixCls, className, style, ...props }) => {
const deepLayout = useFormDeepLayout()
const formPrefixCls = usePrefixCls('form')
const formPrefixCls = usePrefixCls('form', { prefixCls })
const layoutPrefixCls = usePrefixCls('formily-layout', { prefixCls })
const layoutClassName = cls(
layoutPrefixCls,
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/form-grid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface ILayoutProps {
}

export interface IFormGridProps {
prefix?: string
style?: React.CSSProperties
className?: string
minWidth?: number | number[]
Expand Down Expand Up @@ -123,7 +124,7 @@ const normalizeProps = (props: IFormGridProps): ILayoutProps => {
const useGridLayout = (outerProps: IFormGridProps): ILayout => {
const ref = useRef<HTMLDivElement>(null)
const props = useRef<ILayoutProps>()
const formGridPrefixCls = usePrefixCls('formily-grid')
const formGridPrefixCls = usePrefixCls('formily-grid', outerProps)
const [layoutParams, setLayout] = useState({})
const [styles, setStyles] = useState({})
const normalizedProps = normalizeProps(outerProps)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/form-layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const FormLayout: React.FC<IFormLayoutProps> & {
useFormShallowLayout: () => IFormLayoutProps
} = ({ shallow, children, prefix, className, style, ...props }) => {
const deepLayout = useFormDeepLayout()
const formPrefixCls = usePrefixCls('form')
const formPrefixCls = usePrefixCls('form', { prefix })
const layoutPrefixCls = usePrefixCls('formily-layout', { prefix })
const layoutClassName = cls(
layoutPrefixCls,
Expand Down

0 comments on commit bcdac58

Please sign in to comment.