新增 multiSelectConfig API,用于自定义 Checkbox 属性,如设置复选框为红色填充
This commit is contained in:
parent
492b2a5de4
commit
4eab282716
|
@ -162,7 +162,8 @@ function multiSelect(Table, Checkbox) {
|
|||
prefixCls: "u-table-mult-select",
|
||||
getSelectedDataFunc: function getSelectedDataFunc() {},
|
||||
autoSelect: false,
|
||||
autoCheckedByClickRows: true
|
||||
autoCheckedByClickRows: true,
|
||||
multiSelectConfig: {}
|
||||
}, _initialiseProps = function _initialiseProps() {
|
||||
var _this2 = this;
|
||||
|
||||
|
@ -302,6 +303,7 @@ function multiSelect(Table, Checkbox) {
|
|||
};
|
||||
|
||||
this.getDefaultColumns = function (columns) {
|
||||
var multiSelectConfig = _this2.props.multiSelectConfig;
|
||||
var _state2 = _this2.state,
|
||||
checkedAll = _state2.checkedAll,
|
||||
indeterminate = _state2.indeterminate;
|
||||
|
@ -322,7 +324,7 @@ function multiSelect(Table, Checkbox) {
|
|||
className: 'u-table-multiSelect-column',
|
||||
title: _react2["default"].createElement(Checkbox, _extends({
|
||||
className: 'table-checkbox'
|
||||
}, checkAttr, {
|
||||
}, checkAttr, multiSelectConfig, {
|
||||
disabled: disabledCount == dataLength ? true : false,
|
||||
onChange: _this2.onAllCheckChange
|
||||
})),
|
||||
|
@ -336,7 +338,7 @@ function multiSelect(Table, Checkbox) {
|
|||
return _react2["default"].createElement(Checkbox, _extends({
|
||||
key: index,
|
||||
className: 'table-checkbox'
|
||||
}, attr, {
|
||||
}, attr, multiSelectConfig, {
|
||||
checked: record._checked,
|
||||
onClick: _this2.handleClick,
|
||||
onChange: _this2.onCheckboxChange(text, record, index)
|
||||
|
|
|
@ -61,20 +61,13 @@ class Demo12 extends Component {
|
|||
|
||||
render() {
|
||||
let multiObj = {
|
||||
type: "checkbox"
|
||||
inverse: true, //设置选中为红色填充
|
||||
};
|
||||
return (
|
||||
<MultiSelectTable
|
||||
columns={columns}
|
||||
data={data}
|
||||
multiSelect={multiObj}
|
||||
rowClassName={(record,index,indent)=>{
|
||||
if (record._checked) {
|
||||
return 'selected';
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}}
|
||||
// multiSelectConfig={multiObj} //可以自定义 Checkbox 属性
|
||||
getSelectedDataFunc={this.getSelectedDataFunc}/>
|
||||
);
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -292,6 +292,7 @@ Table 组件参数:
|
|||
| 参数 | 说明 | 类型 | 返回值 |
|
||||
| ------ | ---------- | -------- | ---- |
|
||||
| getSelectedDataFunc | 返回当前选中的数据数组 | Function | `selectedList` : 当前选中的行数据集合<br>`record` : 当前操作行数据<br>`index` : 当前操作行索引 |
|
||||
| multiSelectConfig | 自定义 Checkbox 属性,如设置复选框为红色填充 | Object | - |
|
||||
|
||||
Data 数组参数:
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@ export default function multiSelect(Table, Checkbox) {
|
|||
prefixCls: "u-table-mult-select",
|
||||
getSelectedDataFunc:()=>{},
|
||||
autoSelect: false,
|
||||
autoCheckedByClickRows: true
|
||||
autoCheckedByClickRows: true,
|
||||
multiSelectConfig: {}
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
|
@ -243,6 +244,7 @@ export default function multiSelect(Table, Checkbox) {
|
|||
|
||||
|
||||
getDefaultColumns=(columns)=>{
|
||||
let {multiSelectConfig} = this.props;
|
||||
let {checkedAll,indeterminate} = this.state;
|
||||
let checkAttr = {checked:checkedAll?true:false};
|
||||
const data = this.props.data;
|
||||
|
@ -262,6 +264,7 @@ export default function multiSelect(Table, Checkbox) {
|
|||
<Checkbox
|
||||
className="table-checkbox"
|
||||
{...checkAttr}
|
||||
{...multiSelectConfig}
|
||||
disabled={disabledCount==dataLength?true:false}
|
||||
onChange={this.onAllCheckChange}
|
||||
/>
|
||||
|
@ -277,6 +280,7 @@ export default function multiSelect(Table, Checkbox) {
|
|||
key={index}
|
||||
className="table-checkbox"
|
||||
{...attr}
|
||||
{...multiSelectConfig}
|
||||
checked={record._checked}
|
||||
onClick={this.handleClick}
|
||||
onChange={this.onCheckboxChange(text, record, index)}
|
||||
|
|
Loading…
Reference in New Issue