UNPKG

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