v1.1.0.Beta

This commit is contained in:
maplemei
2019-11-23 20:10:47 +08:00
parent b14cbaa913
commit 57a0ab9f15
22 changed files with 285 additions and 146 deletions

View File

@@ -79,7 +79,7 @@ if (!Array.prototype.find) {
return callback && (this.filter(callback) || [])[0];
};
}
//拓展Array findIndex方法
if (!Array.prototype.findIndex) {
Array.prototype.findIndex = function(predicate) {
@@ -96,4 +96,13 @@ if (!Array.prototype.findIndex) {
}
return -1;
};
}
//拓展Object values方法
if (!Object.values) {
Object.prototype.values = function(obj) {
return Object.keys(obj).map(function(e) {
return obj[e];
});
};
}

View File

@@ -124,7 +124,10 @@ class Framework extends Component{
resetSelectValue(sels = [], change = [], isAdd, listenOn = true){
let on = this.props.on;
if(isFunction(on) && this.prepare && listenOn){
on({ arr: sels, change, isAdd });
let listenResult = on({ arr: sels, change, isAdd });
if(isArray(listenResult)){
return this.value(listenResult, null, false);
}
}
this.setState({ sels });
}
@@ -360,7 +363,7 @@ class Framework extends Component{
return (
<xm-select { ...xmSelectProps } >
<input class="xm-select-default" name={ config.name } value={ sels.map(item => item[prop.value]).join(',') }></input>
<input class="xm-select-default" lay-verify={ config.layVerify } lay-verType={ config.layVerType } name={ config.name } value={ sels.map(item => item[prop.value]).join(',') }></input>
<i class={ show ? 'xm-icon xm-icon-expand' : 'xm-icon' } />
{ sels.length === 0 && <div class="xm-tips">{ config.tips }</div> }
<Label { ...labelProps } />

View File

@@ -105,7 +105,7 @@ class Tree extends Component{
}
const className = ['xm-option', (dis ? ' disabled' : ''), (selected ? ' selected' : ''), (showIcon ? 'show-icon' : 'hide-icon') ].join(' ');
const iconClass = ['xm-option-icon xm-iconfont', radio ? 'xm-icon-danx' : tree.strict && half ? 'xm-icon-banxuan' : 'xm-icon-duox'].join(' ');
const treeIconClass = ['xm-tree-icon', expand ? 'expand':'', item[children] && (item[children].length > 0 || tree.lazy) ? 'visible':'hidden'].join(' ');
const treeIconClass = ['xm-tree-icon', expand ? 'expand':'', item[children] && (item[children].length > 0 || (tree.lazy && item.__node.loading !== false)) ? 'visible':'hidden'].join(' ');
return (
<div class={ className } style={ itemStyle } value={ item[value] } onClick={ this.optionClick.bind(this, item, selected, item[disabled], 'line') }>
@@ -128,7 +128,7 @@ class Tree extends Component{
return (
<div class="xm-tree">
{ tree.showFolderIcon && tree.showLine && expand && <i class='left-line left-line-group' style={ {left: indent + 3 + 'px'} }></i> }
{ renderItem(item, indent, expand) }
{ renderItem(item, indent, child.length === 0 && item.__node.loading === false ? 0 : expand) }
{ expand && <div class="xm-tree-box">{ child.map(c => renderGroup(c, indent)) }</div> }
</div>
)

View File

@@ -28,7 +28,7 @@ class xmOptions {
this.options = deepMerge(this.options, options);
//如果dom不存在, 则不进行渲染事项
let dom = selector(this.options.el);
let dom = this.options.el.nodeType ? this.options.el : selector(this.options.el);
if(!dom){
warn(`没有找到渲染对象: ${options.el}, 请检查`)
return ;

View File

@@ -16,7 +16,11 @@ export default function (lan = 'zn') {
//自定义数据
content: '',
//表单提交的name
name: 'select',
name: 'select',
//表单验证
layVerify: '',
//验证类型
layVerType: '',
//尺寸
size: 'medium',
//是否禁用多选

View File

@@ -456,7 +456,11 @@ xm-select{
}
.xm-select-default{
display: none !important;
position: absolute;
width: 100%;
height: 100%;
border: none;
visibility: hidden;
}
.xm-select-disabled{