mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
feat(amis): 子节点包含部分选中状态时,父节点也标记为部分选中
避免父节点是部分选中而祖先节点是未选中状态的问题
This commit is contained in:
parent
5108906e96
commit
2808790a96
@ -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);
|
||||
});
|
||||
});
|
||||
|
@ -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 {
|
||||
|
@ -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 = [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user