Skip to content

Commit

Permalink
Fix Select #536
Browse files Browse the repository at this point in the history
Fix doc site scrollbars
  • Loading branch information
e1emeb0t committed Aug 8, 2017
1 parent dc3f07a commit b1c4253
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion site/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ body {

pre {
background-color: transparent;
overflow-x: auto;
padding: 18px 24px;
line-height: 1.8;
font-size: 12px;
Expand Down
3 changes: 1 addition & 2 deletions src/select/Option.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export default class Option extends Component {

queryChange(query: string) {
// query 里如果有正则中的特殊字符,需要先将这些字符转义
let parsedQuery = query.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1');

const parsedQuery = query.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1');
const visible = new RegExp(parsedQuery, 'i').test(this.currentLabel());

if (!visible) {
Expand Down
18 changes: 10 additions & 8 deletions src/select/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -733,26 +733,28 @@ class Select extends Component {
this.state.optionsCount++;
this.state.filteredOptionsCount++;

this.setState(this.state);
this.forceUpdate();
this.handleValueChange();
}

onOptionDestroy(option: any) {
this.state.optionsCount--;
this.state.filteredOptionsCount--;

let index = this.state.options.indexOf(option);
const index = this.state.options.indexOf(option);

if (index > -1) {
this.state.options.splice(index, 1);
}

this.setState(this.state, () => {
this.state.options.forEach(el => {
if (el != option) {
el.resetIndex();
}
});
this.state.options.forEach(el => {
if (el != option) {
el.resetIndex();
}
});

this.forceUpdate();
this.handleValueChange();
}

onOptionClick(option: any) {
Expand Down

0 comments on commit b1c4253

Please sign in to comment.