diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 000000000..d18969d8c
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,16 @@
+const base = require('@umijs/fabric/dist/eslint');
+
+module.exports = {
+ ...base,
+ rules: {
+ ...base.rules,
+ 'react/no-array-index-key': 0,
+ 'react/sort-comp': 0,
+ '@typescript-eslint/no-explicit-any': 1,
+ 'react/no-find-dom-node': 1,
+ 'react/require-default-props': 0,
+ 'no-confusing-arrow': 0,
+ 'jsx-a11y/label-has-for': 0,
+ 'jsx-a11y/label-has-associated-control': 0,
+ },
+};
diff --git a/.fatherrc.js b/.fatherrc.js
new file mode 100644
index 000000000..767a2abfe
--- /dev/null
+++ b/.fatherrc.js
@@ -0,0 +1,8 @@
+export default {
+ cjs: 'babel',
+ esm: { type: 'babel', importLibToEs: true },
+ preCommit: {
+ eslint: true,
+ prettier: true,
+ },
+};
diff --git a/.gitignore b/.gitignore
index a3b5eb63d..15278f7ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.storybook
*.iml
*.log
.idea/
diff --git a/.travis.yml b/.travis.yml
index 1b9f79ca2..d16a491a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ notifications:
- yesmeck@gmail.com
node_js:
-- 8
+- 10
script:
- |
diff --git a/assets/bordered.less b/assets/bordered.less
index f3ad2e84a..239059136 100644
--- a/assets/bordered.less
+++ b/assets/bordered.less
@@ -1,11 +1,55 @@
-@tablePrefixCls: rc-table;
-@table-border-color: #e9e9e9;
-
-.@{tablePrefixCls}.bordered {
- table {
- border-collapse: collapse;
- }
- th, td {
- border: 1px solid @table-border-color;
+.move-enter,
+.move-appear {
+ opacity: 0;
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
+ animation-duration: 2.5s;
+ animation-fill-mode: both;
+ animation-play-state: paused;
+}
+.move-leave {
+ animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
+ animation-duration: 0.5s;
+ animation-fill-mode: both;
+ animation-play-state: paused;
+}
+.move-enter.move-enter-active,
+.move-appear.move-enter-active {
+ animation-name: moveLeftIn;
+ animation-play-state: running;
+}
+.move-leave.move-leave-active {
+ animation-name: moveRightOut;
+ animation-play-state: running;
+}
+@keyframes moveLeftIn {
+ 0% {
+ transform-origin: 0 0;
+ transform: translateX(30px);
+ opacity: 0;
+ background: #fff6de;
+ }
+ 20% {
+ transform-origin: 0 0;
+ transform: translateX(0);
+ opacity: 1;
+ }
+ 80% {
+ background: #fff6de;
+ }
+ 100% {
+ background: transparent;
+ opacity: 1;
+ }
+}
+@keyframes moveRightOut {
+ 0% {
+ transform-origin: 0 0;
+ transform: translateX(0);
+ opacity: 1;
+ }
+ 100% {
+ transform-origin: 0 0;
+ transform: translateX(-30px);
+ opacity: 0;
}
}
diff --git a/examples/animation.html b/examples/animation.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/animation.js b/examples/animation.js
index 93a7998f0..8ee181b5a 100644
--- a/examples/animation.js
+++ b/examples/animation.js
@@ -1,10 +1,9 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React from 'react';
-import ReactDOM from 'react-dom';
-import Table from 'rc-table';
import Animate from 'rc-animate';
-import 'rc-table/assets/index.less';
-import 'rc-table/assets/animation.less';
+import Table from '../src';
+import '../assets/index.less';
+import '../assets/animation.less';
const AnimateBody = props => ;
@@ -38,26 +37,32 @@ class Demo extends React.Component {
onDelete(key, e) {
console.log('Delete', key);
e.preventDefault();
- const data = this.state.data.filter(item => item.key !== key);
- this.setState({ data });
+ this.setState(({ data }) => ({
+ data: data.filter(item => item.key !== key),
+ }));
}
onAdd() {
- const data = [...this.state.data];
- data.push({
- a: 'new data',
- b: 'new data',
- c: 'new data',
- key: Date.now(),
- });
- this.setState({ data });
+ this.setState(({ data }) => ({
+ data: [
+ ...data,
+ {
+ a: 'new data',
+ b: 'new data',
+ c: 'new data',
+ key: Date.now(),
+ },
+ ],
+ }));
}
render() {
return (
Table row with animation
-
+
, document.getElementById('__react-content'));
+
+export default Demo;
+/* eslint-enable */
diff --git a/examples/childrenIndent.html b/examples/childrenIndent.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/childrenIndent.js b/examples/childrenIndent.js
index f77d388eb..99baa6a9d 100644
--- a/examples/childrenIndent.js
+++ b/examples/childrenIndent.js
@@ -1,8 +1,7 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React from 'react';
-import ReactDOM from 'react-dom';
-import Table from 'rc-table';
-import 'rc-table/assets/index.less';
+import Table from '../src';
+import '../assets/index.less';
const columns = [
{
@@ -100,7 +99,9 @@ function onExpand(expanded, record) {
console.log('onExpand', expanded, record);
}
-ReactDOM.render(
-
,
- document.getElementById('__react-content'),
+const Demo = () => (
+
);
+
+export default Demo;
+/* eslint-enable */
diff --git a/examples/className.html b/examples/className.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/className.js b/examples/className.js
index b67bc4ecf..5b9b4adb2 100644
--- a/examples/className.js
+++ b/examples/className.js
@@ -1,8 +1,7 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React from 'react';
-import ReactDOM from 'react-dom';
-import Table from 'rc-table';
-import 'rc-table/assets/index.less';
+import Table from '../src';
+import '../assets/index.less';
const columns = [
{
@@ -44,7 +43,7 @@ const data = [
{ a: '1333', c: 'eee', d: 2, key: '3' },
];
-ReactDOM.render(
+const Demo = () => (
rowClassName and className
-
,
- document.getElementById('__react-content'),
+
);
+
+export default Demo;
+/* eslint-enable */
diff --git a/examples/colspan-rowspan.html b/examples/colspan-rowspan.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/colspan-rowspan.js b/examples/colspan-rowspan.js
index b04d65e58..60b58b9fc 100644
--- a/examples/colspan-rowspan.js
+++ b/examples/colspan-rowspan.js
@@ -1,8 +1,7 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React from 'react';
-import ReactDOM from 'react-dom';
-import Table from 'rc-table';
-import 'rc-table/assets/index.less';
+import Table from '../src';
+import '../assets/index.less';
const columns = [
{
@@ -128,10 +127,12 @@ const data = [
{ a: '资料统计完毕于xxxx年xxx月xxx日', key: '6' },
];
-ReactDOM.render(
+const Demo = () => (
,
- document.getElementById('__react-content'),
+
);
+
+export default Demo;
+/* eslint-enable */
diff --git a/examples/column-resize.html b/examples/column-resize.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/column-resize.js b/examples/column-resize.js
index e56bcfc68..cc6bc199a 100644
--- a/examples/column-resize.js
+++ b/examples/column-resize.js
@@ -1,10 +1,9 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React from 'react';
-import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
-import Table from 'rc-table';
-import 'rc-table/assets/index.less';
import { Resizable } from 'react-resizable';
+import Table from '../src';
+import '../assets/index.less';
import 'react-resizable/css/styles.css';
const ResizeableTitle = props => {
@@ -84,4 +83,5 @@ class Demo extends React.Component {
}
}
-ReactDOM.render(, document.getElementById('__react-content'));
+export default Demo;
+/* eslint-enable */
diff --git a/examples/dropdown.html b/examples/dropdown.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/examples/dropdown.js b/examples/dropdown.js
index 7950dbda7..06a742646 100644
--- a/examples/dropdown.js
+++ b/examples/dropdown.js
@@ -1,15 +1,14 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React from 'react';
-import ReactDOM from 'react-dom';
-import Table from 'rc-table';
import Menu, { Item, Divider } from 'rc-menu';
import DropDown from 'rc-dropdown';
-import 'rc-table/assets/index.less';
import 'rc-dropdown/assets/index.css';
import 'rc-menu/assets/index.css';
+import Table from '../src';
+import '../assets/index.less';
const data = [];
-for (let i = 0; i < 10; i++) {
+for (let i = 0; i < 10; i += 1) {
data.push({
key: i,
a: `a${i}`,
@@ -61,6 +60,7 @@ class Demo extends React.Component {
-