fix #2 Accessing PropTypes via the main React package is deprecated

- Upgrade react to 15.5.x
This commit is contained in:
Devin Chen 2017-06-03 20:34:07 +08:00
parent 456270d01c
commit fa5aafb33a
16 changed files with 130 additions and 91 deletions

View File

@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
var _react = require('react');
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -15,14 +21,14 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var propTypes = {
className: _react.PropTypes.string,
colSpan: _react.PropTypes.number,
title: _react.PropTypes.node,
dataIndex: _react.PropTypes.string,
width: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
fixed: _react.PropTypes.oneOf([true, 'left', 'right']),
render: _react.PropTypes.func,
onCellClick: _react.PropTypes.func
className: _propTypes2["default"].string,
colSpan: _propTypes2["default"].number,
title: _propTypes2["default"].node,
dataIndex: _propTypes2["default"].string,
width: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
fixed: _propTypes2["default"].oneOf([true, 'left', 'right']),
render: _propTypes2["default"].func,
onCellClick: _propTypes2["default"].func
};
var Column = function (_Component) {

View File

@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
var _react = require('react');
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -27,7 +33,7 @@ var ColumnGroup = function (_Component) {
}(_react.Component);
ColumnGroup.propTypes = {
title: _react.PropTypes.node
title: _propTypes2["default"].node
};
exports["default"] = ColumnGroup;
module.exports = exports['default'];

View File

@ -8,6 +8,10 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _shallowequal = require('shallowequal');
var _shallowequal2 = _interopRequireDefault(_shallowequal);
@ -23,12 +27,12 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var propTypes = {
record: _react.PropTypes.object,
clsPrefix: _react.PropTypes.string,
expandable: _react.PropTypes.any,
expanded: _react.PropTypes.bool,
needIndentSpaced: _react.PropTypes.bool,
onExpand: _react.PropTypes.func
record: _propTypes2["default"].object,
clsPrefix: _propTypes2["default"].string,
expandable: _propTypes2["default"].any,
expanded: _propTypes2["default"].bool,
needIndentSpaced: _propTypes2["default"].bool,
onExpand: _propTypes2["default"].func
};
var ExpandIcon = function (_Component) {

View File

@ -10,6 +10,10 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _TableRow = require('./TableRow');
var _TableRow2 = _interopRequireDefault(_TableRow);
@ -24,7 +28,7 @@ var _shallowequal = require('shallowequal');
var _shallowequal2 = _interopRequireDefault(_shallowequal);
var _addEventListener = require('rc-util/lib/Dom/addEventListener');
var _addEventListener = require('tinper-bee-core/lib/addEventListener');
var _addEventListener2 = _interopRequireDefault(_addEventListener);
@ -49,36 +53,36 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var propTypes = {
data: _react.PropTypes.array,
expandIconAsCell: _react.PropTypes.bool,
defaultExpandAllRows: _react.PropTypes.bool,
expandedRowKeys: _react.PropTypes.array,
defaultExpandedRowKeys: _react.PropTypes.array,
useFixedHeader: _react.PropTypes.bool,
columns: _react.PropTypes.array,
clsPrefix: _react.PropTypes.string,
bodyStyle: _react.PropTypes.object,
style: _react.PropTypes.object,
data: _propTypes2["default"].array,
expandIconAsCell: _propTypes2["default"].bool,
defaultExpandAllRows: _propTypes2["default"].bool,
expandedRowKeys: _propTypes2["default"].array,
defaultExpandedRowKeys: _propTypes2["default"].array,
useFixedHeader: _propTypes2["default"].bool,
columns: _propTypes2["default"].array,
clsPrefix: _propTypes2["default"].string,
bodyStyle: _propTypes2["default"].object,
style: _propTypes2["default"].object,
//特殊的渲染规则的key值
rowKey: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.func]),
rowClassName: _react.PropTypes.func,
expandedRowClassName: _react.PropTypes.func,
childrenColumnName: _react.PropTypes.string,
onExpand: _react.PropTypes.func,
onExpandedRowsChange: _react.PropTypes.func,
indentSize: _react.PropTypes.number,
onRowClick: _react.PropTypes.func,
onRowDoubleClick: _react.PropTypes.func,
expandIconColumnIndex: _react.PropTypes.number,
rowKey: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].func]),
rowClassName: _propTypes2["default"].func,
expandedRowClassName: _propTypes2["default"].func,
childrenColumnName: _propTypes2["default"].string,
onExpand: _propTypes2["default"].func,
onExpandedRowsChange: _propTypes2["default"].func,
indentSize: _propTypes2["default"].number,
onRowClick: _propTypes2["default"].func,
onRowDoubleClick: _propTypes2["default"].func,
expandIconColumnIndex: _propTypes2["default"].number,
//是否显示表头
showHeader: _react.PropTypes.bool,
title: _react.PropTypes.func,
footer: _react.PropTypes.func,
emptyText: _react.PropTypes.func,
scroll: _react.PropTypes.object,
rowRef: _react.PropTypes.func,
getBodyWrapper: _react.PropTypes.func,
children: _react.PropTypes.node
showHeader: _propTypes2["default"].bool,
title: _propTypes2["default"].func,
footer: _propTypes2["default"].func,
emptyText: _propTypes2["default"].func,
scroll: _propTypes2["default"].object,
rowRef: _propTypes2["default"].func,
getBodyWrapper: _propTypes2["default"].func,
children: _propTypes2["default"].node
};
var defaultProps = {
@ -224,7 +228,7 @@ var Table = function (_Component) {
this.props.onExpandedRowsChange(expandedRowKeys);
};
Table.prototype.onExpanded = function onExpanded(expanded, record, e, index) {
Table.prototype.onExpanded = function onExpanded(expanded, record, index, e) {
if (e) {
e.preventDefault();
e.stopPropagation();
@ -276,7 +280,7 @@ var Table = function (_Component) {
if (expandIconAsCell && fixed !== 'right') {
rows[0].unshift({
key: 'rc-table-expandIconAsCell',
key: 'u-table-expandIconAsCell',
className: clsPrefix + '-expand-icon-th',
title: '',
rowSpan: rows.length
@ -470,7 +474,7 @@ var Table = function (_Component) {
if (this.props.expandIconAsCell && fixed !== 'right') {
cols.push(_react2["default"].createElement('col', {
className: this.props.clsPrefix + '-expand-icon-col',
key: 'rc-table-expand-icon-col'
key: 'u-table-expand-icon-col'
}));
}
var leafColumns = void 0;

View File

@ -8,6 +8,10 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _objectPath = require('object-path');
var _objectPath2 = _interopRequireDefault(_objectPath);
@ -23,13 +27,13 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var propTypes = {
record: _react.PropTypes.object,
clsPrefix: _react.PropTypes.string,
index: _react.PropTypes.number,
indent: _react.PropTypes.number,
indentSize: _react.PropTypes.number,
column: _react.PropTypes.object,
expandIcon: _react.PropTypes.node
record: _propTypes2["default"].object,
clsPrefix: _propTypes2["default"].string,
index: _propTypes2["default"].number,
indent: _propTypes2["default"].number,
indentSize: _propTypes2["default"].number,
column: _propTypes2["default"].object,
expandIcon: _propTypes2["default"].node
};
var TableCell = function (_Component) {

View File

@ -10,6 +10,10 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _shallowequal = require('shallowequal');
var _shallowequal2 = _interopRequireDefault(_shallowequal);
@ -25,9 +29,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var propTypes = {
clsPrefix: _react.PropTypes.string,
rowStyle: _react.PropTypes.object,
rows: _react.PropTypes.array
clsPrefix: _propTypes2["default"].string,
rowStyle: _propTypes2["default"].object,
rows: _propTypes2["default"].array
};
var TableHeader = function (_Component) {

View File

@ -8,6 +8,10 @@ var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _TableCell = require('./TableCell');
var _TableCell2 = _interopRequireDefault(_TableCell);
@ -27,28 +31,28 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var propTypes = {
onDestroy: _react.PropTypes.func,
onRowClick: _react.PropTypes.func,
onRowDoubleClick: _react.PropTypes.func,
record: _react.PropTypes.object,
clsPrefix: _react.PropTypes.string,
expandIconColumnIndex: _react.PropTypes.number,
onHover: _react.PropTypes.func,
columns: _react.PropTypes.array,
height: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]),
visible: _react.PropTypes.bool,
index: _react.PropTypes.number,
hoverKey: _react.PropTypes.any,
expanded: _react.PropTypes.bool,
expandable: _react.PropTypes.any,
onExpand: _react.PropTypes.func,
needIndentSpaced: _react.PropTypes.bool,
className: _react.PropTypes.string,
indent: _react.PropTypes.number,
indentSize: _react.PropTypes.number,
expandIconAsCell: _react.PropTypes.bool,
expandRowByClick: _react.PropTypes.bool,
store: _react.PropTypes.object.isRequired
onDestroy: _propTypes2["default"].func,
onRowClick: _propTypes2["default"].func,
onRowDoubleClick: _propTypes2["default"].func,
record: _propTypes2["default"].object,
clsPrefix: _propTypes2["default"].string,
expandIconColumnIndex: _propTypes2["default"].number,
onHover: _propTypes2["default"].func,
columns: _propTypes2["default"].array,
height: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
visible: _propTypes2["default"].bool,
index: _propTypes2["default"].number,
hoverKey: _propTypes2["default"].any,
expanded: _propTypes2["default"].bool,
expandable: _propTypes2["default"].any,
onExpand: _propTypes2["default"].func,
needIndentSpaced: _propTypes2["default"].bool,
className: _propTypes2["default"].string,
indent: _propTypes2["default"].number,
indentSize: _propTypes2["default"].number,
expandIconAsCell: _propTypes2["default"].bool,
expandRowByClick: _propTypes2["default"].bool,
store: _propTypes2["default"].object.isRequired
};
var defaultProps = {
@ -119,7 +123,7 @@ var TableRow = function (_Component) {
onExpand = _props3.onExpand;
if (expandable && expandRowByClick) {
onExpand(!expanded, record, index);
onExpand(!expanded, record, index, event);
}
onRowClick(record, index, event);
};

File diff suppressed because one or more lines are too long

View File

@ -52,8 +52,8 @@
"console-polyfill": "~0.2.1",
"enzyme": "^2.4.1",
"es5-shim": "~4.1.10",
"react": "15.3.2",
"react-addons-test-utils": "15.3.2",
"react-dom": "15.3.2"
"react": "^15.5.0",
"react-addons-test-utils": "^15.5.0",
"react-dom": "^15.5.0"
}
}

View File

@ -1,4 +1,5 @@
import { Component, PropTypes } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';
const propTypes = {
className: PropTypes.string,

View File

@ -1,4 +1,5 @@
import { Component, PropTypes } from 'react';
import { Component } from 'react';
import PropTypes from 'prop-types';
export default class ColumnGroup extends Component {
static propTypes = {

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import shallowequal from 'shallowequal';
const propTypes = {

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import TableRow from './TableRow';
import TableHeader from './TableHeader';
import { measureScrollbar, debounce, warningOnce } from './utils';

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import objectPath from 'object-path';
const propTypes = {

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import shallowequal from 'shallowequal';
const propTypes = {

View File

@ -1,4 +1,5 @@
import React, { PropTypes, Component } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import TableCell from './TableCell';
import ExpandIcon from './ExpandIcon';