-
Notifications
You must be signed in to change notification settings - Fork 600
Expand file tree
/
Copy pathcolumn.jsx
More file actions
117 lines (112 loc) · 3.86 KB
/
column.jsx
File metadata and controls
117 lines (112 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import React from 'react';
import PropTypes from 'prop-types';
/**
* Table.Column
* @order 0
**/
export default class Column extends React.Component {
static propTypes = {
/**
* 指定列对应的字段,支持`a.b`形式的快速取值
*/
dataIndex: PropTypes.string,
/**
* 行渲染的逻辑
* value, rowIndex, record, context四个属性只可读不可被更改
* Function(value, index, record) => Element
*/
cell: PropTypes.oneOfType([PropTypes.element, PropTypes.node, PropTypes.func]),
/**
* 表头显示的内容
*/
title: PropTypes.oneOfType([PropTypes.element, PropTypes.node, PropTypes.func]),
/**
* 写到 header 单元格上的title属性
*/
htmlTitle: PropTypes.string,
/**
* 是否支持排序
*/
sortable: PropTypes.bool,
/**
* 排序的方向。
* 设置 ['desc', 'asc'],表示降序、升序
* 设置 ['desc', 'asc', 'default'],表示表示降序、升序、不排序
* @version 1.23
*/
sortDirections: PropTypes.arrayOf(PropTypes.oneOf(['desc', 'asc', 'default'])),
/**
* 列宽,注意在锁列的情况下一定需要配置宽度
*/
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/**
* 单元格的对齐方式
*/
align: PropTypes.oneOf(['left', 'center', 'right']),
/**
* 单元格标题的对齐方式, 不配置默认读取align值
*/
alignHeader: PropTypes.oneOf(['left', 'center', 'right']),
/**
* 生成标题过滤的菜单, 格式为`[{label:'xxx', value:'xxx'}]`
*/
filters: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
})
),
/**
* 过滤的模式是单选还是多选
*/
filterMode: PropTypes.oneOf(['single', 'multiple']),
/**
* filter 模式下传递给 Menu 菜单的属性, 默认继承 `Menu` 组件的API
* @property {Boolean} subMenuSelectable 默认为`false` subMenu是否可选择
* @property {Boolean} isSelectIconRight 默认为`false` 是否将选中图标居右。注意:SubMenu 上的选中图标一直居左,不受此API控制
*/
filterMenuProps: PropTypes.object,
filterProps: PropTypes.object,
/**
* 是否支持锁列,可选值为`left`,`right`, `true`
*/
lock: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
/**
* 是否支持列宽调整, 当该值设为true,table的布局方式会修改为fixed.
*/
resizable: PropTypes.bool,
/**
* (推荐使用)是否支持异步列宽调整, 当该值设为true,table的布局方式会修改为fixed.
* @version 1.24
*/
asyncResizable: PropTypes.bool,
/**
* header cell 横跨的格数,设置为0表示不出现此 th
*/
colSpan: PropTypes.number,
/**
* 设置该列单元格的word-break样式,对于id类、中文类适合用all,对于英文句子适合用word
* @enumdesc all, word
* @default all
* @version 1.23
*/
wordBreak: PropTypes.oneOf(['all', 'word']),
};
static contextTypes = {
parent: PropTypes.any,
};
static defaultProps = {
cell: value => value,
filterMode: 'multiple',
filterMenuProps: {
subMenuSelectable: false,
},
filterProps: {},
resizable: false,
asyncResizable: false,
};
static _typeMark = 'column';
render() {
return null;
}
}