Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
'default-case': 0,
'eslint-comments/disable-enable-pair': 0,
'jsx-a11y/interactive-supports-focus': 0,
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'@typescript-eslint/no-object-literal-type-assertion': 0,
},
};
7 changes: 1 addition & 6 deletions examples/disable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-named-as-default-member */
import '../assets/index.less';
import React from 'react';
import TreeSelect from '../src';
Expand Down Expand Up @@ -76,11 +75,7 @@ class Demo extends React.Component {
return (
<div>
<TreeSelect {...tProps} />
<input
type="checkbox"
onChange={e => this.switch(e.target.checked)}
/>{' '}
禁用
<input type="checkbox" onChange={e => this.switch(e.target.checked)} /> 禁用
</div>
);
}
Expand Down
9 changes: 8 additions & 1 deletion src/generate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,14 @@ export default function generate(config: {
];
}
return [newRawValues, valueHalfCheckedKeys];
}, [value, mergedMultiple, mergedLabelInValue, treeCheckable, treeCheckStrictly]);
}, [
value,
flattedOptions,
mergedMultiple,
mergedLabelInValue,
treeCheckable,
treeCheckStrictly,
]);

const selectValues = useSelectValues(rawValues, {
treeConduction,
Expand Down
41 changes: 41 additions & 0 deletions tests/Select.checkable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,4 +712,45 @@ describe('TreeSelect.checkable', () => {

expect(wrapper.exists('.rc-tree-select-tree-treenode-checkbox-checked')).toBeTruthy();
});

// https://github.com/ant-design/ant-design/issues/32184
it('should pass correct keys', () => {
const wrapper = mount(
<TreeSelect
open
treeCheckable
showCheckedStrategy={TreeSelect.SHOW_PARENT}
value={['parent']}
treeData={[
{
label: 'parent',
value: 'parent',
},
]}
/>,
);

expect(wrapper.find('Tree').prop('checkedKeys')).toEqual(
expect.objectContaining({ checked: ['parent'] }),
);

wrapper.setProps({
treeData: [
{
label: 'parent',
value: 'parent',
children: [
{
label: 'child',
value: 'child',
},
],
},
],
});

expect(wrapper.find('Tree').prop('checkedKeys')).toEqual(
expect.objectContaining({ checked: ['parent', 'child'] }),
);
});
});
2 changes: 0 additions & 2 deletions tests/__mocks__/rc-motion/lib/CSSMotionList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */

import React from 'react';
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
import CSSMotionList, { genCSSMotionList } from 'rc-motion/lib/CSSMotionList';
Expand Down