1 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
2 | import _typeof from 'babel-runtime/helpers/typeof';
|
3 | import _extends from 'babel-runtime/helpers/extends';
|
4 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
5 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
6 | import _inherits from 'babel-runtime/helpers/inherits';
|
7 |
|
8 | var _class, _temp;
|
9 |
|
10 | import React from 'react';
|
11 | import PropTypes from 'prop-types';
|
12 | import { findDOMNode } from 'react-dom';
|
13 | import classnames from 'classnames';
|
14 | import shallowElementEquals from 'shallow-element-equals';
|
15 | import { polyfill } from 'react-lifecycles-compat';
|
16 | import Loading from '../loading';
|
17 | import ConfigProvider from '../config-provider';
|
18 | import zhCN from '../locale/zh-cn';
|
19 | import { log, obj, dom } from '../util';
|
20 | import BodyComponent from './base/body';
|
21 | import HeaderComponent from './base/header';
|
22 | import WrapperComponent from './base/wrapper';
|
23 | import RowComponent from './base/row';
|
24 | import CellComponent from './base/cell';
|
25 | import FilterComponent from './base/filter';
|
26 | import SortComponent from './base/sort';
|
27 | import Column from './column';
|
28 | import ColumnGroup from './column-group';
|
29 |
|
30 | var Children = React.Children,
|
31 | noop = function noop() {};
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | var Table = (_temp = _class = function (_React$Component) {
|
43 | _inherits(Table, _React$Component);
|
44 |
|
45 | function Table(props, context) {
|
46 | _classCallCheck(this, Table);
|
47 |
|
48 | var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
49 |
|
50 | _this.state = {
|
51 | sort: _this.props.sort || {}
|
52 | };
|
53 |
|
54 | _this.onSort = function (dataIndex, order, sort) {
|
55 | if (typeof _this.props.sort === 'undefined') {
|
56 | _this.setState({
|
57 | sort: sort
|
58 | }, function () {
|
59 | _this.props.onSort(dataIndex, order, sort);
|
60 | });
|
61 | } else {
|
62 | _this.props.onSort(dataIndex, order, sort);
|
63 | }
|
64 | };
|
65 |
|
66 | _this.onFilter = function (filterParams) {
|
67 | _this.props.onFilter(filterParams);
|
68 | };
|
69 |
|
70 | _this.onResizeChange = function (dataIndex, value) {
|
71 | _this.props.onResizeChange(dataIndex, value);
|
72 | };
|
73 |
|
74 | _this.getResizeProxyDomRef = function (resizeProxyDom) {
|
75 | if (!resizeProxyDom) {
|
76 | return _this.resizeProxyDomRef;
|
77 | }
|
78 | _this.resizeProxyDomRef = resizeProxyDom;
|
79 | };
|
80 |
|
81 | _this.getWrapperRef = function (wrapper) {
|
82 | if (!wrapper) {
|
83 | return _this.wrapper;
|
84 | }
|
85 | _this.wrapper = wrapper;
|
86 | };
|
87 |
|
88 | _this.getAffixRef = function (affixRef) {
|
89 | if (!affixRef) {
|
90 | return _this.affixRef;
|
91 | }
|
92 | _this.affixRef = affixRef;
|
93 | };
|
94 |
|
95 | _this.getHeaderCellRef = function (i, j, cell) {
|
96 | var cellRef = 'header_cell_' + i + '_' + j;
|
97 | if (!cell) {
|
98 | return _this[cellRef];
|
99 | }
|
100 | _this[cellRef] = cell;
|
101 | };
|
102 |
|
103 | _this.getRowRef = function (i, row) {
|
104 | var rowRef = 'row_' + i;
|
105 | if (!row) {
|
106 | return _this[rowRef];
|
107 | }
|
108 | _this[rowRef] = row;
|
109 | };
|
110 |
|
111 | _this.getCellRef = function (i, j, cell) {
|
112 | var cellRef = 'cell_' + i + '_' + j;
|
113 | if (!cell) {
|
114 | return _this[cellRef];
|
115 | }
|
116 | _this[cellRef] = cell;
|
117 | };
|
118 |
|
119 | _this.handleColHoverClass = function (rowIndex, colIndex, isAdd) {
|
120 | var crossline = _this.props.crossline;
|
121 |
|
122 | var funcName = isAdd ? 'addClass' : 'removeClass';
|
123 | if (crossline) {
|
124 | _this.props.entireDataSource.forEach(function (val, index) {
|
125 | try {
|
126 |
|
127 |
|
128 |
|
129 | var currentCol = findDOMNode(_this.getCellRef(index, colIndex));
|
130 | currentCol && dom[funcName](currentCol, 'hovered');
|
131 | } catch (error) {
|
132 | return null;
|
133 | }
|
134 | });
|
135 | }
|
136 | };
|
137 |
|
138 | _this.findEventTarget = function (e) {
|
139 | var prefix = _this.props.prefix;
|
140 |
|
141 | var target = dom.getClosest(e.target, 'td.' + prefix + 'table-cell');
|
142 | var colIndex = target && target.getAttribute('data-next-table-col');
|
143 | var rowIndex = target && target.getAttribute('data-next-table-row');
|
144 |
|
145 | try {
|
146 |
|
147 |
|
148 |
|
149 | var currentCol = findDOMNode(_this.getCellRef(rowIndex, colIndex));
|
150 | if (currentCol === target) {
|
151 | return {
|
152 | colIndex: colIndex,
|
153 | rowIndex: rowIndex
|
154 | };
|
155 | }
|
156 | } catch (error) {
|
157 | return {};
|
158 | }
|
159 |
|
160 | return {};
|
161 | };
|
162 |
|
163 | _this.onBodyMouseOver = function (e) {
|
164 | var crossline = _this.props.crossline;
|
165 |
|
166 | if (!crossline) {
|
167 | return;
|
168 | }
|
169 |
|
170 | var _this$findEventTarget = _this.findEventTarget(e),
|
171 | colIndex = _this$findEventTarget.colIndex,
|
172 | rowIndex = _this$findEventTarget.rowIndex;
|
173 |
|
174 |
|
175 |
|
176 | if (!colIndex || !rowIndex) {
|
177 | return;
|
178 | }
|
179 | _this.handleColHoverClass(rowIndex, colIndex, true);
|
180 | _this.colIndex = colIndex;
|
181 | _this.rowIndex = rowIndex;
|
182 | };
|
183 |
|
184 | _this.onBodyMouseOut = function (e) {
|
185 | var crossline = _this.props.crossline;
|
186 |
|
187 | if (!crossline) {
|
188 | return;
|
189 | }
|
190 |
|
191 | var _this$findEventTarget2 = _this.findEventTarget(e),
|
192 | colIndex = _this$findEventTarget2.colIndex,
|
193 | rowIndex = _this$findEventTarget2.rowIndex;
|
194 |
|
195 |
|
196 |
|
197 | if (!colIndex || !rowIndex) {
|
198 | return;
|
199 | }
|
200 | _this.handleColHoverClass(_this.rowIndex, _this.colIndex, false);
|
201 | _this.colIndex = -1;
|
202 | _this.rowIndex = -1;
|
203 | };
|
204 |
|
205 | _this.addColIndex = function (children) {
|
206 | var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
207 |
|
208 | children.forEach(function (child, i) {
|
209 | child.__colIndex = start + i;
|
210 | });
|
211 | };
|
212 |
|
213 | _this.getTableEl = function (ref) {
|
214 | _this.tableEl = ref;
|
215 | };
|
216 |
|
217 | var _this$context = _this.context,
|
218 | getTableInstance = _this$context.getTableInstance,
|
219 | getTableInstanceForVirtual = _this$context.getTableInstanceForVirtual,
|
220 | getTableInstanceForFixed = _this$context.getTableInstanceForFixed,
|
221 | getTableInstanceForExpand = _this$context.getTableInstanceForExpand;
|
222 |
|
223 | getTableInstance && getTableInstance(props.lockType, _this);
|
224 | getTableInstanceForFixed && getTableInstanceForFixed(props.lockType, _this);
|
225 | getTableInstanceForVirtual && getTableInstanceForVirtual(props.lockType, _this);
|
226 | getTableInstanceForExpand && getTableInstanceForExpand(_this);
|
227 | _this.notRenderCellIndex = [];
|
228 | return _this;
|
229 | }
|
230 |
|
231 | Table.prototype.getChildContext = function getChildContext() {
|
232 | return {
|
233 | notRenderCellIndex: this.notRenderCellIndex || [],
|
234 | lockType: this.props.lockType
|
235 | };
|
236 | };
|
237 |
|
238 | Table.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps) {
|
239 | var state = {};
|
240 |
|
241 | if (typeof nextProps.sort !== 'undefined') {
|
242 | state.sort = nextProps.sort;
|
243 | }
|
244 |
|
245 | return state;
|
246 | };
|
247 |
|
248 | Table.prototype.componentDidMount = function componentDidMount() {
|
249 | this.notRenderCellIndex = [];
|
250 | };
|
251 |
|
252 | Table.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState, nextContext) {
|
253 | if (nextProps.pure) {
|
254 | var isEqual = shallowElementEquals(nextProps, this.props) && obj.shallowEqual(nextState, this.state) && obj.shallowEqual(nextContext, this.context);
|
255 | return !isEqual;
|
256 | }
|
257 |
|
258 | return true;
|
259 | };
|
260 |
|
261 | Table.prototype.componentDidUpdate = function componentDidUpdate() {
|
262 | this.notRenderCellIndex = [];
|
263 | };
|
264 |
|
265 | Table.prototype.normalizeChildrenState = function normalizeChildrenState(props) {
|
266 | var columns = props.columns;
|
267 | if (props.children) {
|
268 | columns = this.normalizeChildren(props);
|
269 | }
|
270 | return this.fetchInfoFromBinaryChildren(columns);
|
271 | };
|
272 |
|
273 |
|
274 |
|
275 |
|
276 | Table.prototype.normalizeChildren = function normalizeChildren(props) {
|
277 | var columns = props.columns;
|
278 |
|
279 | var getChildren = function getChildren(children) {
|
280 | var ret = [];
|
281 | Children.forEach(children, function (child) {
|
282 | if (child) {
|
283 | var _props = _extends({}, child.props);
|
284 |
|
285 | if (child.ref) {
|
286 | _props.ref = child.ref;
|
287 | }
|
288 |
|
289 | if (!(child && ['function', 'object'].indexOf(_typeof(child.type)) > -1 && (child.type._typeMark === 'column' || child.type._typeMark === 'columnGroup'))) {
|
290 | log.warning('Use <Table.Column/>, <Table.ColumnGroup/> as child.');
|
291 | }
|
292 | ret.push(_props);
|
293 | if (child.props.children) {
|
294 | _props.children = getChildren(child.props.children);
|
295 | }
|
296 | }
|
297 | });
|
298 | return ret;
|
299 | };
|
300 | if (props.children) {
|
301 | columns = getChildren(props.children);
|
302 | }
|
303 | return columns;
|
304 | };
|
305 |
|
306 | Table.prototype.fetchInfoFromBinaryChildren = function fetchInfoFromBinaryChildren(children) {
|
307 | var hasGroupHeader = false;
|
308 | var flatChildren = [],
|
309 | groupChildren = [],
|
310 | getChildren = function getChildren() {
|
311 | var propsChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
312 | var level = arguments[1];
|
313 |
|
314 | groupChildren[level] = groupChildren[level] || [];
|
315 | propsChildren.forEach(function (child) {
|
316 | if (child.children) {
|
317 | hasGroupHeader = true;
|
318 | getChildren(child.children, level + 1);
|
319 | } else {
|
320 | flatChildren.push(child);
|
321 | }
|
322 | groupChildren[level].push(child);
|
323 | });
|
324 | },
|
325 | getColSpan = function getColSpan(children, colSpan) {
|
326 | colSpan = colSpan || 0;
|
327 | children.forEach(function (child) {
|
328 | if (child.children) {
|
329 | colSpan = getColSpan(child.children, colSpan);
|
330 | } else {
|
331 | colSpan += 1;
|
332 | }
|
333 | });
|
334 | return colSpan;
|
335 | };
|
336 |
|
337 | getChildren(children, 0);
|
338 |
|
339 | groupChildren.forEach(function (groupChild, i) {
|
340 | groupChild.forEach(function (child, j) {
|
341 | var colSpan = void 0;
|
342 | var children = child.children;
|
343 |
|
344 | if (children) {
|
345 | colSpan = getColSpan(children);
|
346 | child.colSpan = colSpan;
|
347 | groupChildren[i][j] = child;
|
348 | }
|
349 | });
|
350 | });
|
351 |
|
352 | var _props2 = this.props,
|
353 | lockType = _props2.lockType,
|
354 | lengths = _props2.lengths;
|
355 |
|
356 | var start = lockType === 'right' ? lengths.origin - lengths.right : 0;
|
357 | this.addColIndex(flatChildren, start);
|
358 |
|
359 | return {
|
360 | flatChildren: flatChildren,
|
361 | groupChildren: groupChildren,
|
362 | hasGroupHeader: hasGroupHeader
|
363 | };
|
364 | };
|
365 |
|
366 | Table.prototype.renderColGroup = function renderColGroup(flatChildren) {
|
367 | var cols = flatChildren.map(function (col, index) {
|
368 | var width = col.width;
|
369 | var style = {};
|
370 | if (width) {
|
371 | style = {
|
372 | width: width
|
373 | };
|
374 | }
|
375 |
|
376 | return React.createElement('col', { style: style, key: index });
|
377 | });
|
378 | return React.createElement(
|
379 | 'colgroup',
|
380 | { key: 'table-colgroup' },
|
381 | cols
|
382 | );
|
383 | };
|
384 |
|
385 |
|
386 | Table.prototype.renderTable = function renderTable(groupChildren, flatChildren) {
|
387 | if (flatChildren.length || !flatChildren.length && !this.props.lockType) {
|
388 | var _props3 = this.props,
|
389 | hasHeader = _props3.hasHeader,
|
390 | components = _props3.components,
|
391 | prefix = _props3.prefix,
|
392 | wrapperContent = _props3.wrapperContent,
|
393 | filterParams = _props3.filterParams,
|
394 | locale = _props3.locale,
|
395 | dataSource = _props3.dataSource,
|
396 | emptyContent = _props3.emptyContent,
|
397 | loading = _props3.loading,
|
398 | primaryKey = _props3.primaryKey,
|
399 | cellProps = _props3.cellProps,
|
400 | rowProps = _props3.rowProps,
|
401 | onRowClick = _props3.onRowClick,
|
402 | onRowMouseEnter = _props3.onRowMouseEnter,
|
403 | onRowMouseLeave = _props3.onRowMouseLeave,
|
404 | expandedIndexSimulate = _props3.expandedIndexSimulate,
|
405 | pure = _props3.pure,
|
406 | rtl = _props3.rtl,
|
407 | crossline = _props3.crossline,
|
408 | sortIcons = _props3.sortIcons,
|
409 | tableWidth = _props3.tableWidth;
|
410 | var sort = this.state.sort;
|
411 | var _components$Header = components.Header,
|
412 | Header = _components$Header === undefined ? HeaderComponent : _components$Header,
|
413 | _components$Wrapper = components.Wrapper,
|
414 | Wrapper = _components$Wrapper === undefined ? WrapperComponent : _components$Wrapper,
|
415 | _components$Body = components.Body,
|
416 | Body = _components$Body === undefined ? BodyComponent : _components$Body;
|
417 |
|
418 | var colGroup = this.renderColGroup(flatChildren);
|
419 |
|
420 | return [React.createElement('div', {
|
421 | key: prefix + 'table-column-resize-proxy',
|
422 | ref: this.getResizeProxyDomRef,
|
423 | className: prefix + 'table-column-resize-proxy'
|
424 | }), React.createElement(
|
425 | Wrapper,
|
426 | {
|
427 | key: prefix + 'table-wrapper',
|
428 | colGroup: colGroup,
|
429 | ref: this.getWrapperRef,
|
430 | prefix: prefix,
|
431 | tableWidth: tableWidth
|
432 | },
|
433 | hasHeader ? React.createElement(Header, {
|
434 | prefix: prefix,
|
435 | rtl: rtl,
|
436 | pure: pure,
|
437 | affixRef: this.getAffixRef,
|
438 | colGroup: colGroup,
|
439 | className: prefix + 'table-header',
|
440 | filterParams: filterParams,
|
441 | tableEl: this.tableEl,
|
442 | columns: groupChildren,
|
443 | locale: locale,
|
444 | headerCellRef: this.getHeaderCellRef,
|
445 | components: components,
|
446 | onFilter: this.onFilter,
|
447 | sort: sort,
|
448 | onResizeChange: this.onResizeChange,
|
449 | onSort: this.onSort,
|
450 | sortIcons: sortIcons,
|
451 | tableWidth: tableWidth,
|
452 | resizeProxyDomRef: this.resizeProxyDomRef
|
453 | }) : null,
|
454 | React.createElement(Body, {
|
455 | prefix: prefix,
|
456 | rtl: rtl,
|
457 | pure: pure,
|
458 | crossline: crossline,
|
459 | colGroup: colGroup,
|
460 | className: prefix + 'table-body',
|
461 | components: components,
|
462 | loading: loading,
|
463 | emptyContent: emptyContent,
|
464 | getCellProps: cellProps,
|
465 | primaryKey: primaryKey,
|
466 | getRowProps: rowProps,
|
467 | columns: flatChildren,
|
468 | rowRef: this.getRowRef,
|
469 | cellRef: this.getCellRef,
|
470 | onRowClick: onRowClick,
|
471 | expandedIndexSimulate: expandedIndexSimulate,
|
472 | tableEl: this.tableEl,
|
473 | onRowMouseEnter: onRowMouseEnter,
|
474 | onRowMouseLeave: onRowMouseLeave,
|
475 | dataSource: dataSource,
|
476 | locale: locale,
|
477 | onBodyMouseOver: this.onBodyMouseOver,
|
478 | onBodyMouseOut: this.onBodyMouseOut,
|
479 | tableWidth: tableWidth
|
480 | }),
|
481 | wrapperContent
|
482 | )];
|
483 | } else {
|
484 | return null;
|
485 | }
|
486 | };
|
487 |
|
488 | |
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 | Table.prototype.render = function render() {
|
495 | var _classnames;
|
496 |
|
497 | var ret = this.normalizeChildrenState(this.props);
|
498 | this.groupChildren = ret.groupChildren;
|
499 | this.flatChildren = ret.flatChildren;
|
500 |
|
501 | var table = this.renderTable(ret.groupChildren, ret.flatChildren),
|
502 | _props4 = this.props,
|
503 | className = _props4.className,
|
504 | style = _props4.style,
|
505 | hasBorder = _props4.hasBorder,
|
506 | isZebra = _props4.isZebra,
|
507 | loading = _props4.loading,
|
508 | size = _props4.size,
|
509 | hasHeader = _props4.hasHeader,
|
510 | prefix = _props4.prefix,
|
511 | dataSource = _props4.dataSource,
|
512 | entireDataSource = _props4.entireDataSource,
|
513 | onSort = _props4.onSort,
|
514 | onResizeChange = _props4.onResizeChange,
|
515 | onRowClick = _props4.onRowClick,
|
516 | onRowMouseEnter = _props4.onRowMouseEnter,
|
517 | onRowMouseLeave = _props4.onRowMouseLeave,
|
518 | onFilter = _props4.onFilter,
|
519 | rowProps = _props4.rowProps,
|
520 | cellProps = _props4.cellProps,
|
521 | scrollToRow = _props4.scrollToRow,
|
522 | primaryKey = _props4.primaryKey,
|
523 | components = _props4.components,
|
524 | wrapperContent = _props4.wrapperContent,
|
525 | lockType = _props4.lockType,
|
526 | locale = _props4.locale,
|
527 | expandedIndexSimulate = _props4.expandedIndexSimulate,
|
528 | refs = _props4.refs,
|
529 | pure = _props4.pure,
|
530 | rtl = _props4.rtl,
|
531 | emptyContent = _props4.emptyContent,
|
532 | filterParams = _props4.filterParams,
|
533 | columns = _props4.columns,
|
534 | sortIcons = _props4.sortIcons,
|
535 | _props4$loadingCompon = _props4.loadingComponent,
|
536 | LoadingComponent = _props4$loadingCompon === undefined ? Loading : _props4$loadingCompon,
|
537 | tableLayout = _props4.tableLayout,
|
538 | tableWidth = _props4.tableWidth,
|
539 | ref = _props4.ref,
|
540 | others = _objectWithoutProperties(_props4, ['className', 'style', 'hasBorder', 'isZebra', 'loading', 'size', 'hasHeader', 'prefix', 'dataSource', 'entireDataSource', 'onSort', 'onResizeChange', 'onRowClick', 'onRowMouseEnter', 'onRowMouseLeave', 'onFilter', 'rowProps', 'cellProps', 'scrollToRow', 'primaryKey', 'components', 'wrapperContent', 'lockType', 'locale', 'expandedIndexSimulate', 'refs', 'pure', 'rtl', 'emptyContent', 'filterParams', 'columns', 'sortIcons', 'loadingComponent', 'tableLayout', 'tableWidth', 'ref']),
|
541 | cls = classnames((_classnames = {}, _classnames[prefix + 'table'] = true, _classnames[prefix + 'table-' + size] = size, _classnames[prefix + 'table-layout-' + tableLayout] = tableLayout, _classnames['only-bottom-border'] = !hasBorder, _classnames['no-header'] = !hasHeader, _classnames.zebra = isZebra, _classnames[className] = className, _classnames));
|
542 |
|
543 |
|
544 | if (rtl) {
|
545 | others.dir = 'rtl';
|
546 | }
|
547 |
|
548 | var content = React.createElement(
|
549 | 'div',
|
550 | _extends({
|
551 | className: cls,
|
552 | style: style,
|
553 | ref: ref || this.getTableEl
|
554 | }, obj.pickOthers(Object.keys(Table.propTypes), others)),
|
555 | table
|
556 | );
|
557 | if (loading) {
|
558 | var loadingClassName = prefix + 'table-loading';
|
559 | return React.createElement(
|
560 | LoadingComponent,
|
561 | { className: loadingClassName },
|
562 | content
|
563 | );
|
564 | }
|
565 | return content;
|
566 | };
|
567 |
|
568 | return Table;
|
569 | }(React.Component), _class.Column = Column, _class.ColumnGroup = ColumnGroup, _class.Header = HeaderComponent, _class.Body = BodyComponent, _class.Wrapper = WrapperComponent, _class.Row = RowComponent, _class.Cell = CellComponent, _class.Filter = FilterComponent, _class.Sort = SortComponent, _class.propTypes = _extends({}, ConfigProvider.propTypes, {
|
570 | |
571 |
|
572 |
|
573 | prefix: PropTypes.string,
|
574 | pure: PropTypes.bool,
|
575 | rtl: PropTypes.bool,
|
576 | |
577 |
|
578 |
|
579 | tableLayout: PropTypes.oneOf(['fixed', 'auto']),
|
580 | |
581 |
|
582 |
|
583 | tableWidth: PropTypes.number,
|
584 | |
585 |
|
586 |
|
587 | className: PropTypes.string,
|
588 | |
589 |
|
590 |
|
591 | style: PropTypes.object,
|
592 | |
593 |
|
594 |
|
595 | size: PropTypes.oneOf(['small', 'medium']),
|
596 | |
597 |
|
598 |
|
599 | dataSource: PropTypes.array,
|
600 | entireDataSource: PropTypes.array,
|
601 | |
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 | onRowClick: PropTypes.func,
|
608 | |
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 | onRowMouseEnter: PropTypes.func,
|
615 | |
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 | onRowMouseLeave: PropTypes.func,
|
622 | |
623 |
|
624 |
|
625 |
|
626 |
|
627 | onSort: PropTypes.func,
|
628 | |
629 |
|
630 |
|
631 |
|
632 | onFilter: PropTypes.func,
|
633 | |
634 |
|
635 |
|
636 |
|
637 |
|
638 | onResizeChange: PropTypes.func,
|
639 | |
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 | rowProps: PropTypes.func,
|
646 | |
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 | cellProps: PropTypes.func,
|
655 | |
656 |
|
657 |
|
658 | hasBorder: PropTypes.bool,
|
659 | |
660 |
|
661 |
|
662 | hasHeader: PropTypes.bool,
|
663 | |
664 |
|
665 |
|
666 | isZebra: PropTypes.bool,
|
667 | |
668 |
|
669 |
|
670 | loading: PropTypes.bool,
|
671 | |
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 | loadingComponent: PropTypes.func,
|
678 | |
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 | filterParams: PropTypes.object,
|
685 | |
686 |
|
687 |
|
688 | sort: PropTypes.object,
|
689 | |
690 |
|
691 |
|
692 | sortIcons: PropTypes.object,
|
693 | |
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | locale: PropTypes.object,
|
706 | components: PropTypes.object,
|
707 | |
708 |
|
709 |
|
710 | columns: PropTypes.array,
|
711 | |
712 |
|
713 |
|
714 | emptyContent: PropTypes.node,
|
715 | |
716 |
|
717 |
|
718 | primaryKey: PropTypes.oneOfType([PropTypes.symbol, PropTypes.string]),
|
719 | lockType: PropTypes.oneOf(['left', 'right']),
|
720 | wrapperContent: PropTypes.any,
|
721 | refs: PropTypes.object,
|
722 | |
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 | expandedRowRender: PropTypes.func,
|
729 | |
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 | rowExpandable: PropTypes.func,
|
736 | |
737 |
|
738 |
|
739 | expandedRowIndent: PropTypes.array,
|
740 | |
741 |
|
742 |
|
743 | hasExpandedRowCtrl: PropTypes.bool,
|
744 | |
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 | getExpandedColProps: PropTypes.func,
|
751 | |
752 |
|
753 |
|
754 | openRowKeys: PropTypes.array,
|
755 | |
756 |
|
757 |
|
758 |
|
759 | defaultOpenRowKeys: PropTypes.array,
|
760 | |
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 | onRowOpen: PropTypes.func,
|
768 | onExpandedRowClick: PropTypes.func,
|
769 | |
770 |
|
771 |
|
772 | fixedHeader: PropTypes.bool,
|
773 | |
774 |
|
775 |
|
776 | maxBodyHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
777 | |
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 | rowSelection: PropTypes.object,
|
790 | |
791 |
|
792 |
|
793 | stickyHeader: PropTypes.bool,
|
794 | |
795 |
|
796 |
|
797 | offsetTop: PropTypes.number,
|
798 | |
799 |
|
800 |
|
801 | affixProps: PropTypes.object,
|
802 | |
803 |
|
804 |
|
805 | indent: PropTypes.number,
|
806 | |
807 |
|
808 |
|
809 | isTree: PropTypes.bool,
|
810 | |
811 |
|
812 |
|
813 | useVirtual: PropTypes.bool,
|
814 | rowHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
815 | |
816 |
|
817 |
|
818 |
|
819 | scrollToRow: PropTypes.number,
|
820 | |
821 |
|
822 |
|
823 | onBodyScroll: PropTypes.func,
|
824 | |
825 |
|
826 |
|
827 | expandedIndexSimulate: PropTypes.bool,
|
828 | |
829 |
|
830 |
|
831 | crossline: PropTypes.bool,
|
832 | lengths: PropTypes.object
|
833 | }), _class.defaultProps = {
|
834 | dataSource: [],
|
835 | onRowClick: noop,
|
836 | onRowMouseEnter: noop,
|
837 | onRowMouseLeave: noop,
|
838 | onSort: noop,
|
839 | onFilter: noop,
|
840 | onResizeChange: noop,
|
841 | size: 'medium',
|
842 | rowProps: noop,
|
843 | cellProps: noop,
|
844 | prefix: 'next-',
|
845 | hasBorder: true,
|
846 | hasHeader: true,
|
847 | isZebra: false,
|
848 | loading: false,
|
849 | expandedIndexSimulate: false,
|
850 | primaryKey: 'id',
|
851 | components: {},
|
852 | locale: zhCN.Table,
|
853 | crossline: false
|
854 | }, _class.childContextTypes = {
|
855 | notRenderCellIndex: PropTypes.array,
|
856 | lockType: PropTypes.oneOf(['left', 'right'])
|
857 | }, _class.contextTypes = {
|
858 | getTableInstance: PropTypes.func,
|
859 | getTableInstanceForFixed: PropTypes.func,
|
860 | getTableInstanceForVirtual: PropTypes.func,
|
861 | getTableInstanceForExpand: PropTypes.func
|
862 | }, _temp);
|
863 | Table.displayName = 'Table';
|
864 |
|
865 |
|
866 | export default polyfill(Table); |
\ | No newline at end of file |