UNPKG

1.59 kBJavaScriptView Raw
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4Object.defineProperty(exports, "__esModule", {
5 value: true
6});
7exports.INTERNAL_COL_DEFINE = void 0;
8exports.getExpandableProps = getExpandableProps;
9var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
12var _excluded = ["expandable"];
13var INTERNAL_COL_DEFINE = exports.INTERNAL_COL_DEFINE = 'RC_TABLE_INTERNAL_COL_DEFINE';
14function getExpandableProps(props) {
15 var expandable = props.expandable,
16 legacyExpandableConfig = (0, _objectWithoutProperties2.default)(props, _excluded);
17 var config;
18 if ('expandable' in props) {
19 config = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, legacyExpandableConfig), expandable);
20 } else {
21 if (process.env.NODE_ENV !== 'production' && ['indentSize', 'expandedRowKeys', 'defaultExpandedRowKeys', 'defaultExpandAllRows', 'expandedRowRender', 'expandRowByClick', 'expandIcon', 'onExpand', 'onExpandedRowsChange', 'expandedRowClassName', 'expandIconColumnIndex', 'showExpandColumn', 'title'].some(function (prop) {
22 return prop in props;
23 })) {
24 (0, _warning.default)(false, 'expanded related props have been moved into `expandable`.');
25 }
26 config = legacyExpandableConfig;
27 }
28 if (config.showExpandColumn === false) {
29 config.expandIconColumnIndex = -1;
30 }
31 return config;
32}
\No newline at end of file