Skip to content

Commit

Permalink
chore(antd/next): fix getObjectParent issue in arrayTable component (#…
Browse files Browse the repository at this point in the history
…3741)

* chore(antd/next): fix lint issue

* fix(core): fix getObjectField issue in arrayType component
  • Loading branch information
ZirkleTsing committed Feb 27, 2023
1 parent cfca08d commit 21cff36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
14 changes: 2 additions & 12 deletions packages/antd/src/form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import React from 'react'
import {
Form as FormType,
ObjectField,
IFormFeedback,
isForm,
} from '@formily/core'
import {
useParentForm,
FormProvider,
JSXComponent,
RecordScope,
} from '@formily/react'
import { Form as FormType, ObjectField, IFormFeedback } from '@formily/core'
import { useParentForm, FormProvider, JSXComponent } from '@formily/react'
import { FormLayout, IFormLayoutProps } from '../form-layout'
import { PreviewText } from '../preview-text'
export interface FormProps extends IFormLayoutProps {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/shared/internals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,7 @@ export const getArrayParent = (field: BaseField, index = field.index) => {
export const getObjectParent = (field: BaseField) => {
let parent: any = field.parent
while (parent) {
if (isArrayField(parent)) return
if (isObjectField(parent)) return parent
if (parent === field.form) return
parent = parent.parent
Expand Down
8 changes: 1 addition & 7 deletions packages/next/src/form/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React, { useMemo } from 'react'
import {
FormProvider,
RecordScope,
JSXComponent,
useParentForm,
} from '@formily/react'
import { FormProvider, JSXComponent, useParentForm } from '@formily/react'
import { FormLayout, IFormLayoutProps } from '../form-layout'
import { ConfigProvider } from '@alifd/next'
import {
Expand All @@ -13,7 +8,6 @@ import {
Form as FormType,
ObjectField,
IFormFeedback,
isForm,
} from '@formily/core'
import { PreviewText } from '../preview-text'
export interface FormProps extends IFormLayoutProps {
Expand Down

0 comments on commit 21cff36

Please sign in to comment.