固定列在过滤栏位上显示单不可以点击

This commit is contained in:
wanghaoo 2018-11-29 11:44:56 +08:00
parent 3c91162336
commit c3c3331b51
4 changed files with 84 additions and 51 deletions

View File

@ -90,7 +90,7 @@ function filterColumn(Table, Popover) {
showModal = _state.showModal; showModal = _state.showModal;
var locale = (0, _tool.getComponentLocale)(this.props, this.context, 'Table', function () { var locale = (0, _tool.getComponentLocale)(this.props, this.context, "Table", function () {
return _i18n2["default"]; return _i18n2["default"];
}); });
@ -115,7 +115,7 @@ function filterColumn(Table, Popover) {
_react2["default"].createElement( _react2["default"].createElement(
"span", "span",
{ className: prefixCls + "-clear-setting", onClick: this.clear }, { className: prefixCls + "-clear-setting", onClick: this.clear },
locale['resetSettings'] locale["resetSettings"]
), ),
_react2["default"].createElement( _react2["default"].createElement(
"div", "div",
@ -127,11 +127,13 @@ function filterColumn(Table, Popover) {
return _react2["default"].createElement( return _react2["default"].createElement(
"div", "div",
{ className: prefixCls + "-cont" }, { className: prefixCls + "-cont" },
_react2["default"].createElement(Table, _extends({}, this.props, { columns: _columns, data: data _react2["default"].createElement(Table, _extends({}, this.props, {
columns: _columns,
data: data
// scroll={scroll} // scroll={scroll}
// scroll={{x:this.getCloumnsScroll(columns)}} // scroll={{x:this.getCloumnsScroll(columns)}}
})), })),
_react2["default"].createElement( this.props.columnFilterAble == false ? "" : _react2["default"].createElement(
"div", "div",
{ className: prefixCls + "-filter-icon" }, { className: prefixCls + "-filter-icon" },
_react2["default"].createElement( _react2["default"].createElement(
@ -140,7 +142,8 @@ function filterColumn(Table, Popover) {
id: "filter_column_popover", id: "filter_column_popover",
placement: "left", placement: "left",
content: content, content: content,
show: showModal }, show: showModal
},
_react2["default"].createElement( _react2["default"].createElement(
"div", "div",
{ className: prefixCls + "-pop-column-filter-cont" }, { className: prefixCls + "-pop-column-filter-cont" },
@ -155,6 +158,7 @@ function filterColumn(Table, Popover) {
}(_react.Component), _class.defaultProps = { }(_react.Component), _class.defaultProps = {
prefixCls: "u-table-filter-column", prefixCls: "u-table-filter-column",
afterFilter: noop, afterFilter: noop,
columnFilterAble: true,
scroll: {} scroll: {}
}, _initialiseProps = function _initialiseProps() { }, _initialiseProps = function _initialiseProps() {
var _this2 = this; var _this2 = this;
@ -162,7 +166,7 @@ function filterColumn(Table, Popover) {
this.setColumOrderByIndex = function (_column) { this.setColumOrderByIndex = function (_column) {
_column.forEach(function (da) { _column.forEach(function (da) {
//默认所有的列都显示如果传递ifshow属性根据ifshow属性值来判断是否显示某列 //默认所有的列都显示如果传递ifshow属性根据ifshow属性值来判断是否显示某列
if (da.hasOwnProperty('ifshow')) { if (da.hasOwnProperty("ifshow")) {
da.checked = da.ifshow ? true : false; da.checked = da.ifshow ? true : false;
da.ifshow = da.checked; da.ifshow = da.checked;
} else { } else {
@ -208,20 +212,27 @@ function filterColumn(Table, Popover) {
var columns = _this2.state.columns; var columns = _this2.state.columns;
return columns.map(function (da, i) { return columns.map(function (da, i) {
if (!da.fixed) {
return _react2["default"].createElement( return _react2["default"].createElement(
"div", "div",
{ key: da.key + "_" + i, className: prefixCls + "-pop-cont-item" }, {
_react2["default"].createElement(_beeCheckbox2["default"], { id: da.key, checked: da.checked, onClick: function onClick() { key: da.key + "_" + i,
_this2.checkedColumItemClick(da); className: prefixCls + "-pop-cont-item"
} }), },
_react2["default"].createElement( _react2["default"].createElement(_beeCheckbox2["default"], {
"span", id: da.key,
null, disabled: da.fixed,
da.title checked: da.checked,
) onClick: function onClick() {
); _this2.checkedColumItemClick(da);
} }
}),
_react2["default"].createElement(
"span",
null,
da.title
)
);
}); });
}; };

58
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

@ -89,23 +89,29 @@ export default function filterColumn(Table, Popover) {
const { prefixCls } = this.props; const { prefixCls } = this.props;
const { columns } = this.state; const { columns } = this.state;
return columns.map((da, i) => { return columns.map((da, i) => {
if (!da.fixed) { let paramObj = {
id:da.key,
checked:da.checked
}
if(da.fixed){
paramObj.disabled = true
}else{
paramObj.onClick = () => {
this.checkedColumItemClick(da);
}
}
return ( return (
<div <div
key={da.key + "_" + i} key={da.key + "_" + i}
className={`${prefixCls}-pop-cont-item`} className={`${prefixCls}-pop-cont-item`}
> >
<Checkbox <Checkbox {...paramObj}/>
id={da.key}
checked={da.checked}
onClick={() => {
this.checkedColumItemClick(da);
}}
/>
<span>{da.title}</span> <span>{da.title}</span>
</div> </div>
); );
}
}); });
}; };