diff --git a/packages/amis-core/__tests__/store/table.test.ts b/packages/amis-core/__tests__/store/table.test.ts index 5d7845212..8da90eb20 100644 --- a/packages/amis-core/__tests__/store/table.test.ts +++ b/packages/amis-core/__tests__/store/table.test.ts @@ -107,7 +107,7 @@ describe('TableStore', () => { expect(secondLevel2.checked).toBe(false); expect(secondLevel2.partial).toBe(true); - expect(firstLevel.partial).toBe(false); expect(firstLevel.checked).toBe(false); + expect(firstLevel.partial).toBe(true); }); }); diff --git a/packages/amis-core/src/store/table.ts b/packages/amis-core/src/store/table.ts index 0ea84b37f..89123a711 100644 --- a/packages/amis-core/src/store/table.ts +++ b/packages/amis-core/src/store/table.ts @@ -226,7 +226,13 @@ export const Row = types }, get partial(): boolean { - return this.childrenSelected() === SELECTED_STATUS.PARTIAL; + const childrenSelected = + this.childrenSelected() === SELECTED_STATUS.PARTIAL; + const childrenPartial = (self as IRow).children.some( + (child: IRow) => child.partial + ); + + return childrenSelected || childrenPartial; }, get checked(): boolean { diff --git a/packages/amis/__tests__/renderers/Table/Cell.test.tsx b/packages/amis/__tests__/renderers/Table/Cell.test.tsx index c9a84a193..4037343fb 100644 --- a/packages/amis/__tests__/renderers/Table/Cell.test.tsx +++ b/packages/amis/__tests__/renderers/Table/Cell.test.tsx @@ -7,7 +7,7 @@ import { within } from '@testing-library/react'; import {render as amisRender} from '../../../src'; -import {makeEnv, wait} from '../../helper'; +import {makeEnv} from '../../helper'; const items = [ {