react-component / select Goto Github PK
View Code? Open in Web Editor NEWReact Select
Home Page: https://select.react-component.now.sh/
License: MIT License
React Select
Home Page: https://select.react-component.now.sh/
License: MIT License
省市区联动,怎么重置value啊
想使用 combo 模式来做搜索框,目前的问题是无法通过组件的 props 来获取 keyDown 事件,来完成比如回车进行搜索 (input 的 keyDown 全都内部处理掉了),关于这个这边推荐的处理方式是什么样的~
用于区别样式。
tree-select 中确定只有 onChange 监听整个所有的变化;onSearch 监听输入框的变化。
select 组件也 删除掉 onSelect / onDeselect ,会有什么问题?
The way export now is a bad example.
Instead of this:
import Select from './Select';
import Option from './Option';
import OptGroup from './OptGroup';
Select.Option = Option;
Select.OptGroup = OptGroup;
export default Select;
Should be like this:
import Select from './Select';
import Option from './Option';
import OptGroup from './OptGroup';
export { Select, Option, OptGroup}
With bad export, it makes impossible to use your module correctly in Typescript language.
为什么搜索匹配的是Option的value,而不是展示出来的文字?
<Option value="1">测试一</Option>
我在搜索框中输入“测试”,搜索不到内容,输入“1”,能搜到“测试一”
演示:http://react-component.github.io/select/examples/multiple.html
版本:5.4.0
重现步骤:点击删除 x
,会弹出下拉框。
貌似新版取消了 placeholder 属性?看了下参数列表里好像也没有 placeholder 了,是换新属性名称了么?
Search for a value not in the drop down list. The notFoundContent "not found" shows up in the drop down, which is disabled and can not be clicked by the mouse. But the component breaks if we press down arrow followed by enter key. The case is possibly not handled. The example in the site also is broken.
希望实现 http://react-component.github.io/select/examples/mul-tag-suggest.html 的效果,用户键入后动态获取数据。
但又不希望像 tags 模式下可以随意键入,只能选择。
修改了一个输入框A的值,如果焦点没有离开输入框,就点了另外一个输入框B的增加或减少按钮,输入框A的改动不会生效
default false
defaults to true
style applied to dropdown
Select.jsx 里面还是有加 module.exports = exports['default'] 的,应该是有在用 add-module-exports ,但 index 的 export 方式会导致 add-module-exports 失效。
export { Option, OptGroup };
export default Select;
但这样不会
export.Option = Option;
export.OptGroup = OptGroup;
export default Select
https://github.com/react-component/select/blob/master/src/Select.jsx#L98
在 props 有 value 的情况下,combobox 的展示值 inputValue 就等于 value[0],那么可否像 multiple 一样可以对应 label 呢~ 毕竟选出来的值一般还是看 label 的
没有看到这个配置项
Currently, if no result matches the users input string, "NOT_FOUND" is shown.
类似原生的 <optgroup></optgroup>
。
Seems as though there is a bug if you have the component go from disabled={false}
to disabled={true}
and then back to disabled={false}
. I'm investigating the issue further to see if I can make a pull request.
目前开发使用的是 0.13.3 的 react,安装这个总是失败,是否有支持 0.13 的版本?
发现一个问题, 当点击出下拉菜单后, 这个菜单 DOM 时直接 append 到 body 中, 并且计算了一个绝对定位来搞定位置问题的.
那么问题来了, 如果我本来就是一个绝对定位的 box, 在里面要使用 Select 的话就会变得比较麻烦. 每次移动都要去计算它对于 body 来说的绝对定位位置. (因为实际上这个 box 是没有移动的, 比较典型的场景是 Modal)
在 rc-calendar 中暴露了一个 align 参数使用 dom-align 用来解决这个问题, 这个配置相当繁琐(需要配合 DOM id). 而且在 rc-select 也没有提供相应的接口. 那如果遇到这个情况应该如何处理呢? 像上面说的不停的手动计算吗?
所以, 为什么 rc-select 以及 rc-calendar 不直接把内容 append 到 触发的input DOM 的后面呢? 这样只需要相对于父元素定位就可以了, 因为 input 和 rc-xxx 的父元素相同, 定位是相当方便的.
谢谢.
目前 disabled 依赖样式 pointer-events: none;
实现,有两个问题:
pointer-events
IE11 才支持。not-allowed
.Infinite scroll
这样我就必须把option的children和value写成一致
例如:
<Option value="2009年">2009年</Option>
而不能
<Option value="2009">2009年</Option>
正常的select应该是这样的:
[
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' }
]
选择one的时候,input显示的是One,显示的是label的值。value是one,两个还是不一样的。现在select展示的就是value的值。
https://github.com/JedWatson/react-select 这个select就是这种符合原生select模式的。
Hi, how can i get the selected value(s) from the React component?
业务中有这种需求:在 tags input select 里,想直接输入一串如 name1,name2,name3,name4,nam5,....
这样比较长的内容(预先准备好的人员列表),组件自动根据分隔符(例如这里的逗号),split 出来,然后分别验证这些条目是否合法(如果分别发Ajax将会很多、不可行),再转换为一个个 tag。
这种需求一般是单独做一个「导入」文件或组的功能来实现,但放到 tags-input 组件或 select 组件里,感觉也有一定合理性。
在 select2 的 Automatic tokenization example 里输入 red,blue,green,
这串特定分割的字符串,会自动根据逗号 split 出三个 tag 出来。select2 这个还能输入更多自动保存到选择list里,也不涉及到发Ajax操作。
<Select defaultValue={0}>
<Option value={0}>0</Option>
<Option value={1}>1</Option>
</Select>
演示:http://react-component.github.io/select/examples/suggest.html
版本:5.4.0
重现步骤:输入『w』,弹出搜索建议框,删除『w』后再次输入『r』,第一个选项未默认高亮。希望可以实现默认高亮功能。
当组件就是普通的 select 控件的时候,select 的宽度会随着选择的 option 的值的宽度而变化,是不是考虑能取到最大 option 的宽度赋到 select 上?我看了系统默认控件的系统就是这样的。
解决方法是Select.jsx中174行改为数组
if (!sel.length && showNotFound && props.notFoundContent) {
sel = [<MenuItem disabled value='NOT_FOUND'>{props.notFoundContent}</MenuItem>];
}
i would like to render a value also:
e.g. - select icon with:
https://www.dropbox.com/s/5tsg0vl8lnccfir/Screenshot%202016-02-17%2012.42.15.png?dl=0
but after selection:
https://www.dropbox.com/s/qhea6uik4e93uyl/Screenshot%202016-02-17%2012.42.59.png?dl=0
i would like to render icon, not the value :(
is it possible?
需求如题
#75 的问题并没有解决
问题不是出在 没有挂变量,而是多于一个 export 时,add-module-exports 是没有效果,这导致 lib/index.js 里最后是没有那句 module.exports = export['default'].
var Search = React.createClass({
getInitialState() {
return {
data: []
}
},
fetchData(value) {
jsonp('http://suggest.taobao.com/sug?' + querystring.encode({
code: 'utf-8',
q: value
}), (err, d) => {
var result = d.result;
var data = [];
result.forEach((r)=> {
data.push({
value: r[0],
text: r[0]
});
});
this.setState({
data: data
});
});
},
handleSelect(value) {
console.log('select ', value);
},
render() {
var data = this.state.data;
var options = data.map((d) => {
return <Option value={d.value}>{d.text}</Option>;
});
return <div>
<h1>suggest</h1>
<div style={{width: 300}}>
<Select combobox onChange={this.fetchData} onSelect={this.handleSelect} filterOption={false}>
{options}
</Select>
</div>
</div>;
}
});
If children include a null child
, this line will raise error.
Consider following situation, if showJack
is null, rc-select should filter the null child.
<Select defaultValue="lucy" style={{ width: 120 }}>
{ showJack && <Option value="jack">Jack</Option> }
<Option value="lucy">Lucy</Option>
</Select>
Please add support to remove .rc-select-dropdown-menu-item-selected
from the selected item if another item has .rc-select-dropdown-menu-item-active
.
The reason is that I would like the select dropdown to behave as in native <select>
where only a single item of a dropdown is highlighted at a time.
select的搜索功能无法检测中文
styles changes after selection.
here is before selection:
https://www.dropbox.com/s/p7jgte1ml01f7ea/Screenshot%202016-02-17%2011.55.19.png?dl=0
https://www.dropbox.com/s/zozxao96mbeq9du/Screenshot%202016-02-17%2011.57.44.png?dl=0
and it's after selection:
https://www.dropbox.com/s/0uwb1axgtjld79i/Screenshot%202016-02-17%2011.56.41.png?dl=0
https://www.dropbox.com/s/pm9dzx4siw7gcy6/Screenshot%202016-02-17%2011.57.22.png?dl=0
support monitor search input
support defaultValue prop for select
<Select optionLabelProp="label">
<Option value="heihei" labe={<i>!</i>}>haha</Option>
</Select>
support filterOption as function
filterOption(inputValue,child):Boolean
prop of Option used as filter if filterOption is true
support option as second parameter
onSelect(value,option)
Opened dropdown menu has currently a class like rc-select-dropdown-placement-bottomLeft
. We need similar class for the select itself.
In our design the dropdown is attached to select and we want to remove the rounded corners on both select and dropdown on the side they touch. For this we must also know which direction did the dropdown open.
Hello. Thanks for the awesome component!
Please how to get rid of the gap between dropdown and select menu? The dropdown is positioned absolutely so I can't do .rc-select-dropdown { position: relative; top: -2px }
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.