feat:增加filterInputNumberOptions可设置数值框的参数

This commit is contained in:
kvkens 2018-12-14 10:52:32 +08:00
parent a31bc3e5ac
commit 83915235e1
13 changed files with 90 additions and 17 deletions

View File

@ -134,6 +134,7 @@ class Demo extends Component {
| filterDropdownFocus | 触发点击下拉条件的回调,一般用于异步点击请求数据使用 | function | () => () | | filterDropdownFocus | 触发点击下拉条件的回调,一般用于异步点击请求数据使用 | function | () => () |
| filterDropdownType | 下拉条件类型,分为 string 和 number 条件类型 | string | string | filterDropdownType | 下拉条件类型,分为 string 和 number 条件类型 | string | string
| filterDropdownIncludeKeys | 能够设置指定的下拉条件项通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有 | filterDropdownIncludeKeys | 能够设置指定的下拉条件项通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有
| filterInputNumberOptions | 数值框接收的props具体属性参考bee-input-number | object | null

View File

@ -183,6 +183,7 @@ var FilterType = function (_Component) {
_this.renderControl = function (rendertype) { _this.renderControl = function (rendertype) {
var _this$props7 = _this.props, var _this$props7 = _this.props,
filterInputNumberOptions = _this$props7.filterInputNumberOptions,
filterDropdownIncludeKeys = _this$props7.filterDropdownIncludeKeys, filterDropdownIncludeKeys = _this$props7.filterDropdownIncludeKeys,
dataIndex = _this$props7.dataIndex, dataIndex = _this$props7.dataIndex,
filterDropdown = _this$props7.filterDropdown, filterDropdown = _this$props7.filterDropdown,
@ -222,12 +223,12 @@ var FilterType = function (_Component) {
return _react2["default"].createElement( return _react2["default"].createElement(
'div', 'div',
{ className: clsPrefix + ' filter-wrap' }, { className: clsPrefix + ' filter-wrap' },
_react2["default"].createElement(_beeInputNumber2["default"], { _react2["default"].createElement(_beeInputNumber2["default"], _extends({}, filterInputNumberOptions, {
className: className, className: className,
value: _this.state.value, value: _this.state.value,
onChange: _this.changeNumber, onChange: _this.changeNumber,
iconStyle: 'one' iconStyle: 'one'
}), })),
_react2["default"].createElement(_FilterDropDown2["default"], { _react2["default"].createElement(_FilterDropDown2["default"], {
locale: locale, locale: locale,
dataIndex: dataIndex, dataIndex: dataIndex,

View File

@ -502,7 +502,8 @@ var Table = function (_Component) {
filterdropdowndata: column.filterDropdownData, //自定义数据格式 filterdropdowndata: column.filterDropdownData, //自定义数据格式
filterdropdownfocus: column.filterDropdownFocus, //焦点触发函数回调 filterdropdownfocus: column.filterDropdownFocus, //焦点触发函数回调
filterdropdowntype: column.filterDropdownType, //下拉的类型分为 String,Number 默认是String filterdropdowntype: column.filterDropdownType, //下拉的类型分为 String,Number 默认是String
filterdropdownincludekeys: column.filterDropdownIncludeKeys //下拉条件按照指定的keys去显示 filterdropdownincludekeys: column.filterDropdownIncludeKeys, //下拉条件按照指定的keys去显示
filterinputnumberoptions: column.filterInputNumberOptions //设置数值框内的详细属性
}); });
} }
}); });

View File

@ -244,6 +244,7 @@ var TableHeader = function (_Component) {
, filterDropdown: rows[1][index]["filterdropdown"], , filterDropdown: rows[1][index]["filterdropdown"],
filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number
, filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示 , filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示
, filterInputNumberOptions: rows[1][index]["filterinputnumberoptions"] //设置数值框内的详细属性
}); });
//下拉框选择 //下拉框选择
case "dropdown": case "dropdown":

View File

@ -13,9 +13,40 @@ import Button from 'bee-button';
const columns29 = [ const columns29 = [
{ title: "姓名", width: 180, dataIndex: "name", key: "name", filterType: "text", filterDropdown: "show",filterDropdownIncludeKeys:['LIKE','EQ'] }, {
{ title: "年龄", width: 150, dataIndex: "age", key: "age", filterType: "dropdown", filterDropdown: "show",filterDropdownType:"number",filterDropdownIncludeKeys:['EQ'] }, title: "姓名",
{ title: "日期", width: 200, dataIndex: "date", key: "date", filterType: "date", filterDropdown: "show", format: "YYYY-MM-DD" } width: 180,
dataIndex: "name",
key: "name",
filterType: "text",
filterDropdown: "show",
filterDropdownIncludeKeys: ['LIKE', 'EQ']
},
{
title: "年龄",
width: 170,
dataIndex: "age",
key: "age",
filterType: "number",
filterDropdown: "show",
filterDropdownType: "number",
filterDropdownIncludeKeys: ['EQ'],
filterInputNumberOptions: {
max: 200,
min: 0,
step: 1,
precision: 0
}
},
{
title: "日期",
width: 200,
dataIndex: "date",
key: "date",
filterType: "date",
filterDropdown: "show",
format: "YYYY-MM-DD"
}
]; ];
const data29 = [ const data29 = [
@ -116,7 +147,7 @@ class Demo29 extends Component {
onHide={this.close} onHide={this.close}
autoFocus={false} autoFocus={false}
enforceFocus={false} enforceFocus={false}
> >
<Modal.Header closeButton> <Modal.Header closeButton>
<Modal.Title>过滤行</Modal.Title> <Modal.Title>过滤行</Modal.Title>
</Modal.Header> </Modal.Header>

File diff suppressed because one or more lines are too long

44
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -81,6 +81,7 @@ import 'bee-table/build/Table.css';
| filterDropdownFocus | 触发点击下拉条件的回调,一般用于异步点击请求数据使用 | function | () => () | | filterDropdownFocus | 触发点击下拉条件的回调,一般用于异步点击请求数据使用 | function | () => () |
| filterDropdownType | 下拉条件类型,分为 string 和 number 条件类型 | string | string | filterDropdownType | 下拉条件类型,分为 string 和 number 条件类型 | string | string
| filterDropdownIncludeKeys | 能够设置指定的下拉条件项通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有 | filterDropdownIncludeKeys | 能够设置指定的下拉条件项通过设置keys 其中string条件可设置:LIKE,ULIKE,EQ,UEQ,START,END.number条件可设置:GT,GTEQ,LT,LTEQ,EQ,UEQ | array | [] 不设置此属性为显示所有
| filterInputNumberOptions | 数值框接收的props具体属性参考bee-input-number | object | null
{% include "mixin.md"%} {% include "mixin.md"%}

View File

@ -95,4 +95,4 @@
"react-addons-test-utils": "^15.5.0", "react-addons-test-utils": "^15.5.0",
"react-dom": "^15.5.0" "react-dom": "^15.5.0"
} }
} }

View File

@ -157,7 +157,7 @@ class FilterType extends Component {
* @returns * @returns
*/ */
renderControl = (rendertype) => { renderControl = (rendertype) => {
let { filterDropdownIncludeKeys, dataIndex, filterDropdown, filterDropdownType, format, className, onChange, onSelectDropdown, clsPrefix, locale } = this.props; let { filterInputNumberOptions, filterDropdownIncludeKeys, dataIndex, filterDropdown, filterDropdownType, format, className, onChange, onSelectDropdown, clsPrefix, locale } = this.props;
switch (rendertype) { switch (rendertype) {
case 'text': case 'text':
return <div className={`${clsPrefix} filter-wrap`}> return <div className={`${clsPrefix} filter-wrap`}>
@ -184,6 +184,7 @@ class FilterType extends Component {
case 'number': case 'number':
return <div className={`${clsPrefix} filter-wrap`}> return <div className={`${clsPrefix} filter-wrap`}>
<InputNumber <InputNumber
{...filterInputNumberOptions}
className={className} className={className}
value={this.state.value} value={this.state.value}
onChange={this.changeNumber} onChange={this.changeNumber}

View File

@ -402,7 +402,8 @@ class Table extends Component {
filterdropdowndata: column.filterDropdownData,//自定义数据格式 filterdropdowndata: column.filterDropdownData,//自定义数据格式
filterdropdownfocus: column.filterDropdownFocus,//焦点触发函数回调 filterdropdownfocus: column.filterDropdownFocus,//焦点触发函数回调
filterdropdowntype: column.filterDropdownType,//下拉的类型分为 String,Number 默认是String filterdropdowntype: column.filterDropdownType,//下拉的类型分为 String,Number 默认是String
filterdropdownincludekeys: column.filterDropdownIncludeKeys//下拉条件按照指定的keys去显示 filterdropdownincludekeys: column.filterDropdownIncludeKeys,//下拉条件按照指定的keys去显示
filterinputnumberoptions: column.filterInputNumberOptions//设置数值框内的详细属性
}); });
} }
}); });

View File

@ -417,6 +417,7 @@ class TableHeader extends Component {
filterDropdown={rows[1][index]["filterdropdown"]} filterDropdown={rows[1][index]["filterdropdown"]}
filterDropdownType={rows[1][index]["filterdropdowntype"]}//下拉的条件类型为string,number filterDropdownType={rows[1][index]["filterdropdowntype"]}//下拉的条件类型为string,number
filterDropdownIncludeKeys={rows[1][index]["filterdropdownincludekeys"]}//下拉条件按照指定的keys去显示 filterDropdownIncludeKeys={rows[1][index]["filterdropdownincludekeys"]}//下拉条件按照指定的keys去显示
filterInputNumberOptions={rows[1][index]["filterinputnumberoptions"]}//设置数值框内的详细属性
/> />
); );
//下拉框选择 //下拉框选择