1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import ConfigProvider from '../config-provider';
|
4 | import Base from './base';
|
5 | import tree from './tree';
|
6 | import fixed from './fixed';
|
7 | import selection from './selection';
|
8 | import expanded from './expanded';
|
9 | import virtual from './virtual';
|
10 | import lock from './lock';
|
11 | import stickyLock from './new-lock';
|
12 | import list from './list';
|
13 | import sticky from './sticky';
|
14 | import ListHeader from './list-header';
|
15 | import ListFooter from './list-footer';
|
16 | import { env } from '../util';
|
17 |
|
18 | var ieVersion = env.ieVersion;
|
19 |
|
20 |
|
21 | var ORDER_LIST = [fixed, lock, selection, expanded, virtual, tree, list, sticky];
|
22 | var Table = ORDER_LIST.reduce(function (ret, current) {
|
23 | ret = current(ret);
|
24 | return ret;
|
25 | }, Base);
|
26 |
|
27 | lock._typeMark = 'lock';
|
28 | expanded._typeMark = 'expanded';
|
29 | fixed._typeMark = 'fixed';
|
30 |
|
31 | var StickyLockTable = ORDER_LIST.reduce(function (ret, current) {
|
32 | var newLock = !ieVersion;
|
33 | if (current._typeMark === 'lock') {
|
34 | ret = newLock ? stickyLock(ret) : lock(ret);
|
35 | } else if (current._typeMark === 'expanded') {
|
36 | ret = newLock ? expanded(ret, true) : expanded(ret);
|
37 | } else if (current._typeMark === 'fixed') {
|
38 | ret = newLock ? fixed(ret, true) : fixed(ret);
|
39 | } else {
|
40 | ret = current(ret);
|
41 | }
|
42 | return ret;
|
43 | }, Base);
|
44 |
|
45 | Table.Base = Base;
|
46 | Table.fixed = fixed;
|
47 | Table.lock = lock;
|
48 | Table.selection = selection;
|
49 | Table.expanded = expanded;
|
50 | Table.tree = tree;
|
51 | Table.virtual = virtual;
|
52 | Table.list = list;
|
53 | Table.sticky = sticky;
|
54 |
|
55 | Table.GroupHeader = ListHeader;
|
56 | Table.GroupFooter = ListFooter;
|
57 |
|
58 | Table.StickyLock = ConfigProvider.config(StickyLockTable, {
|
59 | componentName: 'Table'
|
60 | });
|
61 |
|
62 | export default ConfigProvider.config(Table, {
|
63 | componentName: 'Table',
|
64 | transform: function transform(props, deprecated) {
|
65 | if ('expandedRowKeys' in props) {
|
66 | deprecated('expandedRowKeys', 'openRowKeys', 'Table');
|
67 |
|
68 | var _props = props,
|
69 | expandedRowKeys = _props.expandedRowKeys,
|
70 | others = _objectWithoutProperties(_props, ['expandedRowKeys']);
|
71 |
|
72 | props = _extends({ openRowKeys: expandedRowKeys }, others);
|
73 | }
|
74 | if ('onExpandedChange' in props) {
|
75 | deprecated('onExpandedChange', 'onRowOpen', 'Table');
|
76 |
|
77 | var _props2 = props,
|
78 | onExpandedChange = _props2.onExpandedChange,
|
79 | _others = _objectWithoutProperties(_props2, ['onExpandedChange']);
|
80 |
|
81 | props = _extends({ onRowOpen: onExpandedChange }, _others);
|
82 | }
|
83 | if ('isLoading' in props) {
|
84 | deprecated('isLoading', 'loading', 'Table');
|
85 |
|
86 | var _props3 = props,
|
87 | isLoading = _props3.isLoading,
|
88 | _others2 = _objectWithoutProperties(_props3, ['isLoading']);
|
89 |
|
90 | props = _extends({ loading: isLoading }, _others2);
|
91 | }
|
92 | if ('indentSize' in props) {
|
93 | deprecated('indentSize', 'indent', 'Table');
|
94 |
|
95 | var _props4 = props,
|
96 | indentSize = _props4.indentSize,
|
97 | _others3 = _objectWithoutProperties(_props4, ['indentSize']);
|
98 |
|
99 | props = _extends({ indent: indentSize }, _others3);
|
100 | }
|
101 | if ('optimization' in props) {
|
102 | deprecated('optimization', 'pure', 'Table');
|
103 |
|
104 | var _props5 = props,
|
105 | optimization = _props5.optimization,
|
106 | _others4 = _objectWithoutProperties(_props5, ['optimization']);
|
107 |
|
108 | props = _extends({ pure: optimization }, _others4);
|
109 | }
|
110 |
|
111 | if ('getRowClassName' in props) {
|
112 | deprecated('getRowClassName', 'getRowProps', 'Table');
|
113 |
|
114 | var _props6 = props,
|
115 | getRowClassName = _props6.getRowClassName,
|
116 | getRowProps = _props6.getRowProps,
|
117 | _others5 = _objectWithoutProperties(_props6, ['getRowClassName', 'getRowProps']);
|
118 |
|
119 | if (getRowClassName) {
|
120 | var newGetRowProps = function newGetRowProps() {
|
121 | return _extends({
|
122 | className: getRowClassName.apply(undefined, arguments)
|
123 | }, getRowProps ? getRowProps.apply(undefined, arguments) : {});
|
124 | };
|
125 |
|
126 | props = _extends({ getRowProps: newGetRowProps }, _others5);
|
127 | } else {
|
128 | props = _extends({ getRowProps: getRowProps }, _others5);
|
129 | }
|
130 | }
|
131 |
|
132 | if ('getRowProps' in props) {
|
133 | deprecated('getRowProps', 'rowProps', 'Table in 1.15.0');
|
134 |
|
135 | var _props7 = props,
|
136 | _getRowProps = _props7.getRowProps,
|
137 | _others6 = _objectWithoutProperties(_props7, ['getRowProps']);
|
138 |
|
139 | props = _extends({ rowProps: _getRowProps }, _others6);
|
140 | }
|
141 |
|
142 | if ('getCellProps' in props) {
|
143 | deprecated('getCellProps', 'cellProps', 'Table in 1.15.0');
|
144 |
|
145 | var _props8 = props,
|
146 | getCellProps = _props8.getCellProps,
|
147 | _others7 = _objectWithoutProperties(_props8, ['getCellProps']);
|
148 |
|
149 | props = _extends({ cellProps: getCellProps }, _others7);
|
150 | }
|
151 |
|
152 | return props;
|
153 | }
|
154 | }); |
\ | No newline at end of file |