Skip to content

Commit

Permalink
Merge branch 'master' into lessPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Dec 12, 2018
2 parents 1f2945e + fc8a21d commit 154e678
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
49 changes: 49 additions & 0 deletions components/select/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,55 @@ exports[`renders ./components/select/demo/custom-dropdown-menu.md correctly 1`]
</div>
`;

exports[`renders ./components/select/demo/hide-selected.md correctly 1`] = `
<div
class="ant-select ant-select-enabled"
style="width:100%"
>
<div
aria-autocomplete="list"
aria-controls="test-uuid"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--multiple"
role="combobox"
>
<div
class="ant-select-selection__rendered"
>
<div
class="ant-select-selection__placeholder"
style="display:block;user-select:none;-webkit-user-select:none"
unselectable="on"
>
Inserted are removed
</div>
<ul>
<li
class="ant-select-search ant-select-search--inline"
>
<div
class="ant-select-search__field__wrap"
>
<input
autocomplete="off"
class="ant-select-search__field"
value=""
/>
<span
class="ant-select-search__field__mirror"
>
 
</span>
</div>
</li>
</ul>
</div>
</div>
</div>
`;

exports[`renders ./components/select/demo/label-in-value.md correctly 1`] = `
<div
class="ant-select ant-select-enabled"
Expand Down
52 changes: 52 additions & 0 deletions components/select/demo/hide-selected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
order: 22
title:
zh-CN: 隐藏已选择选项
en-US: Hide Already Selected
---

## zh-CN

隐藏下拉列表中已选择的选项。

## en-US

Hide already selected options in the dropdown.

````jsx
import { Select } from 'antd';

const OPTIONS = ['Apples', 'Nails', 'Bananas', 'Helicopters'];

class SelectWithHiddenSelectedOptions extends React.Component {
state = {
selectedItems: [],
};

handleChange = selectedItems => {
this.setState({ selectedItems });
};

render() {
const { selectedItems } = this.state;
const filteredOptions = OPTIONS.filter(o => !selectedItems.includes(o));
return (
<Select
mode="multiple"
placeholder="Inserted are removed"
value={selectedItems}
onChange={this.handleChange}
style={{ width: '100%' }}
>
{filteredOptions.map(item => (
<Select.Option key={item} value={item}>
{item}
</Select.Option>
))}
</Select>
);
}
}

ReactDOM.render(<SelectWithHiddenSelectedOptions />, mountNode);
````
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@
"ansi-styles": "^3.2.1",
"ant-design-palettes": "^1.1.3",
"antd-theme-generator": "^1.1.4",
"antd-tools": "^6.1.1",
"antd-tools": "^6.1.3",
"babel-cli": "^6.26.0",
"babel-eslint": "^10.0.1",
"bisheng": "^1.0.0",
"bisheng-plugin-antd": "^0.17.0",
"bisheng-plugin-description": "^0.1.4",
"bisheng-plugin-react": "^0.6.3",
"bisheng-plugin-react": "^1.0.0",
"bisheng-plugin-toc": "^0.4.4",
"commander": "^2.18.0",
"core-js": "^2.5.7",
Expand Down

0 comments on commit 154e678

Please sign in to comment.