v1.0.9
This commit is contained in:
@@ -11,6 +11,8 @@ export default function (lan = 'zn') {
|
||||
data: [],
|
||||
//表单提交的name
|
||||
name: 'select',
|
||||
//尺寸
|
||||
size: 'medium',
|
||||
//默认选中数据, 优先级大于selected
|
||||
initValue: null,
|
||||
//默认提示
|
||||
|
||||
@@ -145,6 +145,14 @@ class xmOptions {
|
||||
}
|
||||
childs[this.options.el].del(sels);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 闪烁警告边框
|
||||
*/
|
||||
warning(color){
|
||||
childs[this.options.el].updateBorderColor(color || this.options.theme.maxColor);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ class Framework extends Component{
|
||||
|
||||
render(config, { sels, show }) {
|
||||
const { tips, theme, prop, style, radio, repeat, clickClose, on, max, maxMethod } = config;
|
||||
const borderStyle = { borderColor: this.state.tmpColor || theme.color };
|
||||
const borderStyle = { borderColor: theme.color };
|
||||
//最外层边框的属性
|
||||
const xmSelectProps = {
|
||||
style: {
|
||||
@@ -185,7 +185,16 @@ class Framework extends Component{
|
||||
},
|
||||
onClick: this.onClick.bind(this),
|
||||
ua: checkUserAgent(),
|
||||
size: config.size,
|
||||
}
|
||||
if(this.state.tmpColor){
|
||||
xmSelectProps.style.borderColor = this.state.tmpColor;
|
||||
setTimeout(() => {
|
||||
xmSelectProps.style.borderColor = '';
|
||||
this.updateBorderColor('')
|
||||
}, 300);
|
||||
}
|
||||
|
||||
//右边下拉箭头的变化class
|
||||
const iconClass = show ? 'xm-icon xm-icon-expand' : 'xm-icon';
|
||||
//提示信息的属性
|
||||
@@ -214,8 +223,6 @@ class Framework extends Component{
|
||||
let maxCount = toNum(max);
|
||||
if(maxCount > 0 && sels.length >= maxCount){
|
||||
this.updateBorderColor(theme.maxColor);
|
||||
//恢复正常
|
||||
setTimeout(() => this.updateBorderColor(''), 300);
|
||||
//查看是否需要回调
|
||||
maxMethod && isFunction(maxMethod) && maxMethod(sels, item);
|
||||
return ;
|
||||
|
||||
@@ -81,11 +81,10 @@ class General extends Component{
|
||||
this.__value = v;
|
||||
|
||||
//让搜索变成异步的
|
||||
this.searchCid = setTimeout(() => this.setState({
|
||||
filterValue: this.__value,
|
||||
remote: true,
|
||||
callback: true,
|
||||
}), this.props.delay);
|
||||
this.searchCid = setTimeout(() => {
|
||||
this.callback = true;
|
||||
this.setState({ filterValue: this.__value, remote: true })
|
||||
}, this.props.delay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,12 +123,12 @@ class General extends Component{
|
||||
}
|
||||
|
||||
componentDidUpdate(){
|
||||
if(this.state.callback){
|
||||
this.setState({ callback: false });
|
||||
|
||||
if(this.callback){
|
||||
this.callback = false;
|
||||
|
||||
let done = this.props.filterDone;
|
||||
if(isFunction(done)){
|
||||
done(this.state.filterValue);
|
||||
done(this.state.filterValue, this.tempData || []);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,6 +144,7 @@ class General extends Component{
|
||||
if(filterable){
|
||||
if(remoteSearch){//是否进行远程搜索
|
||||
if(this.state.remote){
|
||||
this.callback = false;
|
||||
this.setState({ loading: true, remote: false });
|
||||
//让输入框失去焦点
|
||||
this.blur();
|
||||
@@ -152,6 +152,7 @@ class General extends Component{
|
||||
//回调后可以重新聚焦
|
||||
this.focus();
|
||||
|
||||
this.callback = true;
|
||||
this.setState({ loading: false });
|
||||
this.props.onReset(result, 'data');
|
||||
}, this.props.show);
|
||||
@@ -260,6 +261,7 @@ class General extends Component{
|
||||
}
|
||||
|
||||
let safetyArr = deepMerge([], arr);
|
||||
this.tempData = safetyArr;
|
||||
|
||||
//工具条操作
|
||||
const toolbar = (
|
||||
@@ -302,8 +304,7 @@ class General extends Component{
|
||||
const selected = !!sels.find(sel => sel[value] == item[value])
|
||||
const iconStyle = selected ? {
|
||||
color: theme.color,
|
||||
border: 'none',
|
||||
fontSize: '18px'
|
||||
border: 'none'
|
||||
} : {
|
||||
borderColor: theme.color,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user