update:过滤条件修改

This commit is contained in:
kvkens 2018-12-11 16:54:25 +08:00
parent be87445379
commit 6768243afc
11 changed files with 18556 additions and 2888 deletions

View File

@ -97,90 +97,145 @@ var FilterDropDown = function (_Component) {
var _this$state = _this.state,
selectValue = _this$state.selectValue,
selectNumberValue = _this$state.selectNumberValue;
var filterDropdownType = _this.props.filterDropdownType;
var _this$props2 = _this.props,
filterDropdownType = _this$props2.filterDropdownType,
filterDropdownIncludeKeys = _this$props2.filterDropdownIncludeKeys;
var locale = (0, _tool.getComponentLocale)(_this.props, _this.context, 'Table', function () {
return _i18n2["default"];
});
switch (filterDropdownType) {
case 'string':
return _react2["default"].createElement(
_beeMenus2["default"],
{
onSelect: _this.onSelectDropdown,
selectedKeys: selectValue
},
_react2["default"].createElement(
Item,
{ key: 'LIKE' },
locale['include']
),
_react2["default"].createElement(
Item,
{ key: 'ULIKE' },
locale['exclusive']
),
_react2["default"].createElement(
Item,
{ key: 'EQ' },
locale['equal']
),
_react2["default"].createElement(
Item,
{ key: 'UEQ' },
locale['unequal']
),
_react2["default"].createElement(
Item,
{ key: 'START' },
locale['begin']
),
_react2["default"].createElement(
Item,
{ key: 'END' },
locale['end']
)
);
case 'number':
return _react2["default"].createElement(
_beeMenus2["default"],
{
onSelect: _this.onSelectDropdown,
selectedKeys: selectNumberValue
},
_react2["default"].createElement(
Item,
{ key: 'GT' },
locale['greater_than']
),
_react2["default"].createElement(
Item,
{ key: 'GTEQ' },
locale['great_than_equal_to']
),
_react2["default"].createElement(
Item,
{ key: 'LT' },
locale['less_than']
),
_react2["default"].createElement(
Item,
{ key: 'LTEQ' },
locale['less_than_equal_to']
),
_react2["default"].createElement(
Item,
{ key: 'EQ' },
locale['be_equal_to']
),
_react2["default"].createElement(
Item,
{ key: 'UEQ' },
locale['not_equal_to']
)
);
default:
return _react2["default"].createElement('div', null);
var stringEnum = {
LIKE: 'include',
ULIKE: 'exclusive',
EQ: 'equal',
UEQ: 'unequal',
START: 'begin',
END: 'end'
};
var numberEnum = {
GT: 'greater_than',
GTEQ: 'great_than_equal_to',
LT: 'less_than',
LTEQ: 'less_than_equal_to',
EQ: 'be_equal_to',
UEQ: 'not_equal_to'
};
if (filterDropdownIncludeKeys != undefined) {
switch (filterDropdownType) {
case 'string':
return _react2["default"].createElement(
_beeMenus2["default"],
{
onSelect: _this.onSelectDropdown,
selectedKeys: selectValue
},
filterDropdownIncludeKeys.map(function (item) {
return _react2["default"].createElement(
Item,
{ key: item },
locale[stringEnum[item]]
);
})
);
case 'number':
return _react2["default"].createElement(
_beeMenus2["default"],
{
onSelect: _this.onSelectDropdown,
selectedKeys: selectNumberValue
},
filterDropdownIncludeKeys.map(function (item) {
return _react2["default"].createElement(
Item,
{ key: item },
locale[numberEnum[item]]
);
})
);
default:
return _react2["default"].createElement('div', null);
}
} else {
switch (filterDropdownType) {
case 'string':
return _react2["default"].createElement(
_beeMenus2["default"],
{
onSelect: _this.onSelectDropdown,
selectedKeys: selectValue
},
_react2["default"].createElement(
Item,
{ key: 'LIKE' },
locale['include']
),
_react2["default"].createElement(
Item,
{ key: 'ULIKE' },
locale['exclusive']
),
_react2["default"].createElement(
Item,
{ key: 'EQ' },
locale['equal']
),
_react2["default"].createElement(
Item,
{ key: 'UEQ' },
locale['unequal']
),
_react2["default"].createElement(
Item,
{ key: 'RLIKE' },
locale['begin']
),
_react2["default"].createElement(
Item,
{ key: 'LLIKE' },
locale['end']
)
);
case 'number':
return _react2["default"].createElement(
_beeMenus2["default"],
{
onSelect: _this.onSelectDropdown,
selectedKeys: selectNumberValue
},
_react2["default"].createElement(
Item,
{ key: 'GT' },
locale['greater_than']
),
_react2["default"].createElement(
Item,
{ key: 'GTEQ' },
locale['great_than_equal_to']
),
_react2["default"].createElement(
Item,
{ key: 'LT' },
locale['less_than']
),
_react2["default"].createElement(
Item,
{ key: 'LTEQ' },
locale['less_than_equal_to']
),
_react2["default"].createElement(
Item,
{ key: 'EQ' },
locale['be_equal_to']
),
_react2["default"].createElement(
Item,
{ key: 'UEQ' },
locale['not_equal_to']
)
);
default:
return _react2["default"].createElement('div', null);
}
}
};

View File

@ -183,6 +183,7 @@ var FilterType = function (_Component) {
_this.renderControl = function (rendertype) {
var _this$props7 = _this.props,
filterDropdownIncludeKeys = _this$props7.filterDropdownIncludeKeys,
dataIndex = _this$props7.dataIndex,
filterDropdown = _this$props7.filterDropdown,
filterDropdownType = _this$props7.filterDropdownType,
@ -213,7 +214,8 @@ var FilterType = function (_Component) {
onClickClear: _this.clearFilter,
isShowClear: _this.state.value,
isShowCondition: filterDropdown,
filterDropdownType: filterDropdownType
filterDropdownType: filterDropdownType,
filterDropdownIncludeKeys: filterDropdownIncludeKeys
})
);
case 'number':
@ -234,7 +236,8 @@ var FilterType = function (_Component) {
onClickClear: _this.clearFilter,
isShowClear: _this.state.value != 0,
isShowCondition: filterDropdown,
filterDropdownType: filterDropdownType
filterDropdownType: filterDropdownType,
filterDropdownIncludeKeys: filterDropdownIncludeKeys
})
);
case 'dropdown':
@ -253,7 +256,8 @@ var FilterType = function (_Component) {
onClickClear: _this.clearFilter,
isShowCondition: filterDropdown,
isShowClear: _this.state.value,
filterDropdownType: filterDropdownType
filterDropdownType: filterDropdownType,
filterDropdownIncludeKeys: filterDropdownIncludeKeys
})
);
case 'date':
@ -275,7 +279,8 @@ var FilterType = function (_Component) {
onClickClear: _this.clearFilter,
isShowCondition: filterDropdown,
isShowClear: _this.state.value,
filterDropdownType: filterDropdownType
filterDropdownType: filterDropdownType,
filterDropdownIncludeKeys: filterDropdownIncludeKeys
})
);
case 'daterange':
@ -300,7 +305,8 @@ var FilterType = function (_Component) {
onSelectDropdown: _this.onSelectDropdown,
onClickClear: _this.clearFilter,
isShowCondition: filterDropdown,
isShowClear: _this.state.value
isShowClear: _this.state.value,
filterDropdownIncludeKeys: filterDropdownIncludeKeys
})
);
case 'bool':
@ -312,7 +318,8 @@ var FilterType = function (_Component) {
onChange: onChange
}),
_react2["default"].createElement(_FilterDropDown2["default"], { locale: locale,
onSelectDropdown: onSelectDropdown
onSelectDropdown: onSelectDropdown,
filterDropdownIncludeKeys: filterDropdownIncludeKeys
})
);
default:

View File

@ -608,11 +608,13 @@
top: 0px;
left: 3px; }
.u-filter-dropdown-menu-wrap .u-dropdown-menu li.u-dropdown-menu-item {
line-height: 32px;
height: 32px;
padding: 0px 16px 0 16px;
cursor: pointer; }
.u-filter-dropdown-menu-wrap {
z-index: 1800; }
.u-filter-dropdown-menu-wrap .u-dropdown-menu li.u-dropdown-menu-item {
line-height: 32px;
height: 32px;
padding: 0px 16px 0 16px;
cursor: pointer; }
.u-checkbox {
height: 16px;

View File

@ -501,7 +501,8 @@ var Table = function (_Component) {
filterdropdownauto: column.filterDropdownAuto, //是否自定义数据
filterdropdowndata: column.filterDropdownData, //自定义数据格式
filterdropdownfocus: column.filterDropdownFocus, //焦点触发函数回调
filterdropdowntype: column.filterDropdownType //下拉的类型分为 String,Number 默认是String
filterdropdowntype: column.filterDropdownType, //下拉的类型分为 String,Number 默认是String
filterdropdownincludekeys: column.filterDropdownIncludeKeys //下拉条件按照指定的keys去显示
});
}
});

View File

@ -229,6 +229,7 @@ var TableHeader = function (_Component) {
, onFilterClear: _this.handlerFilterClear //清除回调
, filterDropdown: rows[1][index]["filterdropdown"] //是否显示下拉条件
, filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number
, filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示
});
//数值输入
case "number":
@ -242,6 +243,7 @@ var TableHeader = function (_Component) {
, onFilterClear: _this.handlerFilterClear //清除回调
, filterDropdown: rows[1][index]["filterdropdown"],
filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number
, filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示
});
//下拉框选择
case "dropdown":
@ -275,6 +277,7 @@ var TableHeader = function (_Component) {
, filterDropdown: rows[1][index]["filterdropdown"],
onFocus: rows[1][index]["filterdropdownfocus"],
filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number
, filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示
});
//日期
case "date":
@ -289,6 +292,7 @@ var TableHeader = function (_Component) {
, onFilterClear: _this.handlerFilterClear //清除回调
, filterDropdown: rows[1][index]["filterdropdown"],
filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number
, filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示
});
//日期范围
case "daterange":
@ -303,6 +307,7 @@ var TableHeader = function (_Component) {
, onFilterClear: _this.handlerFilterClear //清除回调
, filterDropdown: rows[1][index]["filterdropdown"],
filterDropdownType: rows[1][index]["filterdropdowntype"] //下拉的条件类型为string,number
, filterDropdownIncludeKeys: rows[1][index]["filterdropdownincludekeys"] //下拉条件按照指定的keys去显示
});
default:
//不匹配类型默认文本输入

File diff suppressed because one or more lines are too long

42
dist/demo.css vendored
View File

@ -6680,10 +6680,6 @@ input.u-button[type="submit"] {
clear: both;
display: table;
content: ''; }
.u-pagination-list > li.iconBtn > a {
padding: 0 11px;
font-size: 22px;
line-height: 1.57142857; }
.u-pagination-list > li > a, .u-pagination-list > li > span {
display: inline-block;
text-decoration: none;
@ -6771,15 +6767,9 @@ input.u-button[type="submit"] {
margin: 5px;
float: left;
min-width: 120px; }
.u-pagination .data_per_select > span {
display: inline-block;
line-height: 36px;
float: left; }
.u-pagination .data_per_select .u-select {
width: 50px;
margin: 0 6px;
height: 36px;
float: left; }
margin: 0 6px; }
.u-pagination .data_per_select .u-select .u-select-selection {
height: 36px; }
.u-pagination .data_per_select .u-select .u-select-selection .u-select-selection-rendered {
@ -6799,26 +6789,20 @@ input.u-button[type="submit"] {
.u-pagination .page_jump {
float: left;
margin: 5px; }
.u-pagination .page_jump > span {
display: inline-block;
line-height: 36px;
float: left; }
.u-pagination .page_jump_value {
outline: none;
-webkit-appearance: none;
background: #fff;
border-radius: 4px;
line-height: 32px;
width: 50px;
margin: 0 6px;
text-align: center;
border: 1px solid #d7d7d7; }
.u-pagination .page_jump_btn,
.u-pagination .page_jump_value {
margin: 0 6px;
padding: 0;
height: 36px;
line-height: 34px;
box-sizing: border-box;
float: left; }
.u-pagination .page_jump_btn {
margin-top: -3px;
margin-left: 10px;
border-color: #d7d7d7; }
.u-pagination-total {
float: left;
height: 36px;
@ -10367,4 +10351,16 @@ li.rc-time-picker-panel-select-option-disabled:hover {
.demo25 .u-table-filter-column-filter-icon {
right: 15px; }
th .drop-menu .uf {
font-size: 12px;
visibility: hidden;
margin-left: 15px; }
th:hover .uf {
visibility: visible; }
.demo3 .u-table-thead th {
padding-top: 0px;
padding-bottom: 0px; }
/*# sourceMappingURL=demo.css.map */

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

21138
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

@ -125,8 +125,8 @@ class FilterDropDown extends Component {
<Item key="ULIKE">{locale['exclusive']}</Item>
<Item key="EQ">{locale['equal']}</Item>
<Item key="UEQ">{locale['unequal']}</Item>
<Item key="START">{locale['begin']}</Item>
<Item key="END">{locale['end']}</Item>
<Item key="RLIKE">{locale['begin']}</Item>
<Item key="LLIKE">{locale['end']}</Item>
</Menu>
case 'number':
return <Menu