diff --git a/components/table/Table.jsx b/components/table/Table.jsx index 8619fcba6..347450c12 100755 --- a/components/table/Table.jsx +++ b/components/table/Table.jsx @@ -549,7 +549,7 @@ export default { const filtersToSetState = { ...filters }; // Remove filters which is controlled getFilteredValueColumns({ columns: props.columns }).forEach(col => { - const columnKey = this.getColumnKey(col); + const columnKey = getColumnKey(col); if (columnKey) { delete filtersToSetState[columnKey]; } diff --git a/components/table/__tests__/Table.sorter.test.js b/components/table/__tests__/Table.sorter.test.js index 497c3fd6a..11894b26c 100644 --- a/components/table/__tests__/Table.sorter.test.js +++ b/components/table/__tests__/Table.sorter.test.js @@ -146,8 +146,8 @@ describe('Table.sorter', () => { const sorter3 = handleChange.mock.calls[2][2]; expect(sorter3.column).toBe(undefined); expect(sorter3.order).toBe(undefined); - expect(sorter3.field).toBe(undefined); - expect(sorter3.columnKey).toBe(undefined); + expect(sorter3.field).toBe('name'); + expect(sorter3.columnKey).toBe('name'); }); }); diff --git a/components/table/__tests__/__snapshots__/Table.filter.test.js.snap b/components/table/__tests__/__snapshots__/Table.filter.test.js.snap index c087e36e0..5eca072e5 100644 --- a/components/table/__tests__/__snapshots__/Table.filter.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.filter.test.js.snap @@ -24,38 +24,33 @@ exports[`Table.filter renders filter correctly 1`] = ` - -
Name
- - - - - - - Jack - - - - Lucy - - - - Tom - - - - Jerry - - - - +
Name +
+ + + + + Jack + + + Lucy + + + Tom + + + Jerry + + + + `; exports[`Table.filter renders menu correctly 1`] = ` diff --git a/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap b/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap index 6978876a2..220a1bb7e 100644 --- a/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.pagination.test.js.snap @@ -14,37 +14,34 @@ exports[`Table.pagination renders pagination correctly 1`] = ` - -
Name
- - - - - - - Jack - - - - Lucy - - - - +
Name +
+ + + + + Jack + + + Lucy + + + - + + `; diff --git a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap index 2fdd92146..e639893a0 100644 --- a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap @@ -11,96 +11,87 @@ exports[`Table.rowSelection fix selection column on the left 1`] = `
- + - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
Name
-
- Jack
- Lucy
- Tom
- Jerry
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
- +
+
+
+
Name +
+ + + + + + Jack + + + + Lucy + + + + Tom + + + + Jerry + + + - + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + + `; exports[`Table.rowSelection render with default selection correctly 1`] = ` diff --git a/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap b/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap index a8210830a..b09dc3d5a 100644 --- a/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.sorter.test.js.snap @@ -3,14 +3,7 @@ exports[`Table.sorter renders sorter icon correctly 1`] = ` - -
Name
-
- +
Name
`; diff --git a/components/table/__tests__/__snapshots__/Table.test.js.snap b/components/table/__tests__/__snapshots__/Table.test.js.snap index b64e1618e..bb610c839 100644 --- a/components/table/__tests__/__snapshots__/Table.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.test.js.snap @@ -15,44 +15,38 @@ exports[`Table align column should not override cell style 1`] = ` - -
Name
- - -
Age
- - - - - - - - - 32 - - - - - - 42 - - - - - +
Name +
+
Age +
+ + + + + + 32 + + + + 42 + + + - + + + `; @@ -72,41 +66,35 @@ exports[`Table renders JSX correctly 1`] = ` - -
Name
- - -
Age
- - - - -
First Name
- - -
Last Name
- - - - - - - John - Brown - 32 - - - - Jim - Green - 42 - - - - - - - +
Name +
+
Age +
+ + +
First Name +
+
Last Name +
+ + + + + John + Brown + 32 + + + Jim + Green + 42 + + + + + + + `; diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index d9982e36b..41725b9e7 100644 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -16,33 +16,38 @@ exports[`renders ./components/table/demo/ajax.md correctly 1`] = ` - -
Name
-
- - -
Gender
- - -
Email
- - - - - - -
- +
Name
+
+
Gender +
+
Email +
+ + + + + +
+
+
+ + + + + + + +
+

No Data

+ + + `; exports[`renders ./components/table/demo/basic.md correctly 1`] = ` @@ -63,75 +68,67 @@ exports[`renders ./components/table/demo/basic.md correctly 1`] = ` - -
Name
- - -
Age
- - -
Address
- - -
Tags
- - -
Action
- - - - - - - John Brown - 32 - New York No. 1 Lake Park -
+
Name +
+
Age +
+
Address +
+
Tags +
+
Action +
+ + + + + John Brown + 32 + New York No. 1 Lake Park + NICE -
+ DEVELOPER -
- Invite 一 John Brown
Delete
More actions
- - - - Jim Green - 42 - London No. 1 Lake Park -
+ + Invite 一 John Brown Delete More actions + + + Jim Green + 42 + London No. 1 Lake Park + LOSER -
- Invite 一 Jim Green
Delete
More actions
- - - - Joe Black - 32 - Sidney No. 1 Lake Park -
+ + Invite 一 Jim Green Delete More actions + + + Joe Black + 32 + Sidney No. 1 Lake Park + COOL -
+ TEACHER -
- Invite 一 Joe Black
Delete
More actions
- - - - - - - - - + + Invite 一 Joe Black Delete More actions + + + + + + + + + `; @@ -154,57 +151,51 @@ exports[`renders ./components/table/demo/bordered.md correctly 1`] = ` - -
Name
- - -
Cash Assets
- - -
Address
- - - - - - - John Brown - ¥300,000.00 - New York No. 1 Lake Park - - - - Jim Green - ¥1,256,000.00 - London No. 1 Lake Park - - - - Joe Black - ¥120,000.00 - Sidney No. 1 Lake Park - - - - - - - - +
Name +
+
Cash Assets +
+
Address +
+ + + + + John Brown + ¥300,000.00 + New York No. 1 Lake Park + + + Jim Green + ¥1,256,000.00 + London No. 1 Lake Park + + + Joe Black + ¥120,000.00 + Sidney No. 1 Lake Park + + + + + + + + + `; exports[`renders ./components/table/demo/colspan-rowspan.md correctly 1`] = ` @@ -225,79 +216,70 @@ exports[`renders ./components/table/demo/colspan-rowspan.md correctly 1`] = ` - -
Name
- - -
Age
- - -
Home phone
- - -
Address
- - - - - - - John Brown - 32 - 0571-22098909 - 18889898989 - New York No. 1 Lake Park - - - - Jim Green - 42 - 0571-22098333 - 18889898888 - London No. 1 Lake Park - - - - Joe Black - 32 - 0575-22098909 - 18900010002 - Sidney No. 1 Lake Park - - - - Jim Red - 18 - - 18900010002 - London No. 2 Lake Park - - - - Jake White - - - - - - - - - - - - + 18900010002 + London No. 2 Lake Park + + + Jake White + + + + + + + + + + + + `; exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] = ` @@ -316,66 +298,59 @@ exports[`renders ./components/table/demo/custom-filter-panel.md correctly 1`] = - -
Name
- - -
Age
- - -
Address
- - - - - - - John Brown - 32 - New York No. 1 Lake Park - - - - Joe Black - 42 - London No. 1 Lake Park - - - - Jim Green - 32 - Sidney No. 1 Lake Park - - - - Jim Red - 32 - London No. 2 Lake Park - - - - - - - +
Name +
+
Age +
+
Address +
+ + + + + John Brown + 32 + New York No. 1 Lake Park + + + Joe Black + 42 + London No. 1 Lake Park + + + Jim Green + 32 + Sidney No. 1 Lake Park + + + Jim Red + 32 + London No. 2 Lake Park + + + + + + + `; exports[`renders ./components/table/demo/edit-cell.md correctly 1`] = ` @@ -396,70 +371,64 @@ exports[`renders ./components/table/demo/edit-cell.md correctly 1`] = ` - -
name
- - -
age
- - -
address
- - -
operation
- - - - - - - -
-
- Edward King 0 -
-
- - 32 - London, Park Lane no. 0 - Delete - - - - -
-
- Edward King 1 -
-
- - 32 - London, Park Lane no. 1 - Delete - - - +
name +
+
age +
+
address +
+
operation +
+ + + + + +
+
+ Edward King 0 +
- - - - + + 32 + London, Park Lane no. 0 + Delete + + + +
+
+ Edward King 1 +
+
+ + 32 + London, Park Lane no. 1 + Delete + + + + + + + + `; exports[`renders ./components/table/demo/edit-row.md correctly 1`] = ` @@ -479,199 +448,263 @@ exports[`renders ./components/table/demo/edit-row.md correctly 1`] = ` - -
name
- - -
age
- - -
address
- - -
operation
- - - - - - - -
Edrward 0
- - -
32
- - -
London Park no. 0
- - -
Edit
- - - - - -
Edrward 1
- - -
32
- - -
London Park no. 1
- - -
Edit
- - - - - -
Edrward 2
- - -
32
- - -
London Park no. 2
- - -
Edit
- - - - - -
Edrward 3
- - -
32
- - -
London Park no. 3
- - -
Edit
- - - - - -
Edrward 4
- - -
32
- - -
London Park no. 4
- - -
Edit
- - - - - -
Edrward 5
- - -
32
- - -
London Park no. 5
- - -
Edit
- - - - - -
Edrward 6
- - -
32
- - -
London Park no. 6
- - -
Edit
- - - - - -
Edrward 7
- - -
32
- - -
London Park no. 7
- - -
Edit
- - - - - -
Edrward 8
- - -
32
- - -
London Park no. 8
- - -
Edit
- - - - - -
Edrward 9
- - -
32
- - -
London Park no. 9
- - -
Edit
- - - - - - - - - +
name +
+
age +
+
address +
+
operation +
+ + + + + +
Edrward 0
+ + +
32
+ + +
London Park no. 0
+ + +
Edit
+ + + + +
Edrward 1
+ + +
32
+ + +
London Park no. 1
+ + +
Edit
+ + + + +
Edrward 2
+ + +
32
+ + +
London Park no. 2
+ + +
Edit
+ + + + +
Edrward 3
+ + +
32
+ + +
London Park no. 3
+ + +
Edit
+ + + + +
Edrward 4
+ + +
32
+ + +
London Park no. 4
+ + +
Edit
+ + + + +
Edrward 5
+ + +
32
+ + +
London Park no. 5
+ + +
Edit
+ + + + +
Edrward 6
+ + +
32
+ + +
London Park no. 6
+ + +
Edit
+ + + + +
Edrward 7
+ + +
32
+ + +
London Park no. 7
+ + +
Edit
+ + + + +
Edrward 8
+ + +
32
+ + +
London Park no. 8
+ + +
Edit
+ + + + +
Edrward 9
+ + +
32
+ + +
London Park no. 9
+ + +
Edit
+ + + + + + + + + +`; + +exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` +
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name +
Age +
Address +
Long Column Long Column Long Column +
Long Column Long Column +
Long Column +
John Brown32New York No. 1 Lake Park, New York No. 1 Lake ParkNew York No. 1 Lake Park, New York No. 1 Lake ParkNew York No. 1 Lake Park, New York No. 1 Lake ParkNew York No. 1 Lake Park, New York No. 1 Lake Park
Jim Green42London No. 2 Lake Park, London No. 2 Lake ParkLondon No. 2 Lake Park, London No. 2 Lake ParkLondon No. 2 Lake Park, London No. 2 Lake ParkLondon No. 2 Lake Park, London No. 2 Lake Park
Joe Black32Sidney No. 1 Lake Park, Sidney No. 1 Lake ParkSidney No. 1 Lake Park, Sidney No. 1 Lake ParkSidney No. 1 Lake Park, Sidney No. 1 Lake ParkSidney No. 1 Lake Park, Sidney No. 1 Lake Park
+
+
+
+ +
+
+
`; exports[`renders ./components/table/demo/expand.md correctly 1`] = ` @@ -693,63 +726,65 @@ exports[`renders ./components/table/demo/expand.md correctly 1`] = ` - -
Name
- - -
Age
- - -
Address
- - -
Action
- - - - - - - John Brown - 32 - New York No. 1 Lake Park - Delete - - - - - Jim Green - 42 - London No. 1 Lake Park - Delete - - - - - Joe Black - 32 - Sidney No. 1 Lake Park - Delete - - - - - - - - - +
Name +
+
Age +
+
Address +
+
Action +
+ + + + + +
+ + John Brown + 32 + New York No. 1 Lake Park + Delete + + + + +
+ + Jim Green + 42 + London No. 1 Lake Park + Delete + + + + +
+ + Joe Black + 32 + Sidney No. 1 Lake Park + Delete + + + + + + + + + `; exports[`renders ./components/table/demo/expand-children.md correctly 1`] = ` @@ -762,66 +797,62 @@ exports[`renders ./components/table/demo/expand-children.md correctly 1`] = `
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
Name
-
-
Age
-
-
Address
-
John Brown sr.60New York No. 1 Lake Park
Joe Black32Sidney No. 1 Lake Park
-
- - - - - +
+
+
+
Name +
+
Age +
+
Address +
+ + + + + + +
John Brown sr. + 60 + New York No. 1 Lake Park + + + + + + + + + + + Joe Black + 32 + Sidney No. 1 Lake Park + + + + + + + + + `; @@ -829,11 +860,11 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = `
-
+
-
+
@@ -850,158 +881,136 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Full Name
-
-
Age
-
-
Column 1
-
-
Column 2
-
-
Column 3
-
-
Column 4
-
-
Column 5
-
-
Column 6
-
-
Column 7
-
-
Column 8
-
-
Action
-
- John Brown32New York ParkNew York ParkNew York ParkNew York ParkNew York ParkNew York ParkNew York ParkNew York Parkaction
- Jim Green40London ParkLondon ParkLondon ParkLondon ParkLondon ParkLondon ParkLondon ParkLondon Parkaction
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
-
Full Name
-
-
Age
-
- John Brown32
- Jim Green40
-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - -
-
Action
-
action
action
-
-
-
-
-
- -
+
Full Name +
+
Age +
+
Column 1 +
+
Column 2 +
+
Column 3 +
+
Column 4 +
+
Column 5 +
+
Column 6
+
Column 7
+
Column 8
+
Action
+ + + + + John Brown + 32 + New York Park + New York Park + New York Park + New York Park + New York Park + New York Park + New York Park + New York Park + action + + + Jim Green + 40 + London Park + London Park + London Park + London Park + London Park + London Park + London Park + London Park + action + + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
Full Name +
Age +
John Brown32
Jim Green40
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + +
Action +
action
action
+
+
+
+ + + + `; exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] = `
-
+
@@ -1021,374 +1030,336 @@ exports[`renders ./components/table/demo/fixed-columns-header.md correctly 1`] = - -
Full Name
- - -
Age
- - -
Column 1
- - -
Column 2
- - -
Column 3
- - -
Column 4
- - -
Column 5
- - -
Column 6
- - -
Column 7
- - -
Column 8
- - -
Action
- - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Edrward 032London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0action
- Edrward 132London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1action
- Edrward 232London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2action
- Edrward 332London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3action
- Edrward 432London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4action
- Edrward 532London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5action
- Edrward 632London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6action
- Edrward 732London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7action
- Edrward 832London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8action
- Edrward 932London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9action
-
-
-
-
- - - - - - - - - - - -
-
Full Name
-
-
Age
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Edrward 032
- Edrward 132
- Edrward 232
- Edrward 332
- Edrward 432
- Edrward 532
- Edrward 632
- Edrward 732
- Edrward 832
- Edrward 932
-
-
-
-
-
- - - - - - - - - -
-
Action
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
action
action
action
action
action
action
action
action
action
action
-
-
-
-
-
- -
+
Full Name +
+
Age +
+
Column 1 +
+
Column 2 +
+
Column 3 +
+
Column 4 +
+
Column 5 +
+
Column 6
+
Column 7
+
Column 8
+
Action
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Edrward 032London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0London Park no. 0action
Edrward 132London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1London Park no. 1action
Edrward 232London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2London Park no. 2action
Edrward 332London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3London Park no. 3action
Edrward 432London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4London Park no. 4action
Edrward 532London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5London Park no. 5action
Edrward 632London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6London Park no. 6action
Edrward 732London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7London Park no. 7action
Edrward 832London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8London Park no. 8action
Edrward 932London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9London Park no. 9action
+
+
+
+
+ + + + + + + + + + + +
Full Name +
Age +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Edrward 032
Edrward 132
Edrward 232
Edrward 332
Edrward 432
Edrward 532
Edrward 632
Edrward 732
Edrward 832
Edrward 932
+
+
+
+ + + + + + + + + +
Action +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
action
action
action
action
action
action
action
action
action
action
+
+
+
+
+ + + + + `; exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = `
-
+
@@ -1400,701 +1371,604 @@ exports[`renders ./components/table/demo/fixed-header.md correctly 1`] = ` - -
Name
- - -
Age
- - -
Address
- - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Edward King 032London, Park Lane no. 0
- Edward King 132London, Park Lane no. 1
- Edward King 232London, Park Lane no. 2
- Edward King 332London, Park Lane no. 3
- Edward King 432London, Park Lane no. 4
- Edward King 532London, Park Lane no. 5
- Edward King 632London, Park Lane no. 6
- Edward King 732London, Park Lane no. 7
- Edward King 832London, Park Lane no. 8
- Edward King 932London, Park Lane no. 9
- Edward King 1032London, Park Lane no. 10
- Edward King 1132London, Park Lane no. 11
- Edward King 1232London, Park Lane no. 12
- Edward King 1332London, Park Lane no. 13
- Edward King 1432London, Park Lane no. 14
- Edward King 1532London, Park Lane no. 15
- Edward King 1632London, Park Lane no. 16
- Edward King 1732London, Park Lane no. 17
- Edward King 1832London, Park Lane no. 18
- Edward King 1932London, Park Lane no. 19
- Edward King 2032London, Park Lane no. 20
- Edward King 2132London, Park Lane no. 21
- Edward King 2232London, Park Lane no. 22
- Edward King 2332London, Park Lane no. 23
- Edward King 2432London, Park Lane no. 24
- Edward King 2532London, Park Lane no. 25
- Edward King 2632London, Park Lane no. 26
- Edward King 2732London, Park Lane no. 27
- Edward King 2832London, Park Lane no. 28
- Edward King 2932London, Park Lane no. 29
- Edward King 3032London, Park Lane no. 30
- Edward King 3132London, Park Lane no. 31
- Edward King 3232London, Park Lane no. 32
- Edward King 3332London, Park Lane no. 33
- Edward King 3432London, Park Lane no. 34
- Edward King 3532London, Park Lane no. 35
- Edward King 3632London, Park Lane no. 36
- Edward King 3732London, Park Lane no. 37
- Edward King 3832London, Park Lane no. 38
- Edward King 3932London, Park Lane no. 39
- Edward King 4032London, Park Lane no. 40
- Edward King 4132London, Park Lane no. 41
- Edward King 4232London, Park Lane no. 42
- Edward King 4332London, Park Lane no. 43
- Edward King 4432London, Park Lane no. 44
- Edward King 4532London, Park Lane no. 45
- Edward King 4632London, Park Lane no. 46
- Edward King 4732London, Park Lane no. 47
- Edward King 4832London, Park Lane no. 48
- Edward King 4932London, Park Lane no. 49
-
-
-
+
Name +
+
Age +
+
Address +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Edward King 032London, Park Lane no. 0
Edward King 132London, Park Lane no. 1
Edward King 232London, Park Lane no. 2
Edward King 332London, Park Lane no. 3
Edward King 432London, Park Lane no. 4
Edward King 532London, Park Lane no. 5
Edward King 632London, Park Lane no. 6
Edward King 732London, Park Lane no. 7
Edward King 832London, Park Lane no. 8
Edward King 932London, Park Lane no. 9
Edward King 1032London, Park Lane no. 10
Edward King 1132London, Park Lane no. 11
Edward King 1232London, Park Lane no. 12
Edward King 1332London, Park Lane no. 13
Edward King 1432London, Park Lane no. 14
Edward King 1532London, Park Lane no. 15
Edward King 1632London, Park Lane no. 16
Edward King 1732London, Park Lane no. 17
Edward King 1832London, Park Lane no. 18
Edward King 1932London, Park Lane no. 19
Edward King 2032London, Park Lane no. 20
Edward King 2132London, Park Lane no. 21
Edward King 2232London, Park Lane no. 22
Edward King 2332London, Park Lane no. 23
Edward King 2432London, Park Lane no. 24
Edward King 2532London, Park Lane no. 25
Edward King 2632London, Park Lane no. 26
Edward King 2732London, Park Lane no. 27
Edward King 2832London, Park Lane no. 28
Edward King 2932London, Park Lane no. 29
Edward King 3032London, Park Lane no. 30
Edward King 3132London, Park Lane no. 31
Edward King 3232London, Park Lane no. 32
Edward King 3332London, Park Lane no. 33
Edward King 3432London, Park Lane no. 34
Edward King 3532London, Park Lane no. 35
Edward King 3632London, Park Lane no. 36
Edward King 3732London, Park Lane no. 37
Edward King 3832London, Park Lane no. 38
Edward King 3932London, Park Lane no. 39
Edward King 4032London, Park Lane no. 40
Edward King 4132London, Park Lane no. 41
Edward King 4232London, Park Lane no. 42
Edward King 4332London, Park Lane no. 43
Edward King 4432London, Park Lane no. 44
Edward King 4532London, Park Lane no. 45
Edward King 4632London, Park Lane no. 46
Edward King 4732London, Park Lane no. 47
Edward King 4832London, Park Lane no. 48
Edward King 4932London, Park Lane no. 49
-
+ +
+ + `; exports[`renders ./components/table/demo/grouping-columns.md correctly 1`] = `
-
+
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Name
-
-
Other
-
-
Company
-
-
Gender
-
-
Age
-
-
-
Address
-
-
Company Address
-
-
Company Name
-
-
Street
-
-
Block
-
-
Building
-
-
Door No.
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- John Brown1Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown2Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown3Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown4Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown5Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown6Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown7Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown8Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown9Lake ParkC2035Lake Street 42SoftLake CoM
- John Brown10Lake ParkC2035Lake Street 42SoftLake CoM
-
-
-
- - - - - - -
-
Name
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- John Brown
- John Brown
- John Brown
- John Brown
- John Brown
- John Brown
- John Brown
- John Brown
- John Brown
- John Brown
-
-
-
-
-
- - + + + + + + - - - -
-
Gender
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M
M
M
M
M
M
M
M
M
M
-
-
-
-
-
- -
+
Name +
+
Other +
+
Company +
+
Gender +
+ + +
Age
+
+
Address +
+
Company Address +
+
Company Name
+ + +
Street
+
Block
+ + +
Building
+
Door No.
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
John Brown1Lake ParkC2035Lake Street 42SoftLake CoM
John Brown2Lake ParkC2035Lake Street 42SoftLake CoM
John Brown3Lake ParkC2035Lake Street 42SoftLake CoM
John Brown4Lake ParkC2035Lake Street 42SoftLake CoM
John Brown5Lake ParkC2035Lake Street 42SoftLake CoM
John Brown6Lake ParkC2035Lake Street 42SoftLake CoM
John Brown7Lake ParkC2035Lake Street 42SoftLake CoM
John Brown8Lake ParkC2035Lake Street 42SoftLake CoM
John Brown9Lake ParkC2035Lake Street 42SoftLake CoM
John Brown10Lake ParkC2035Lake Street 42SoftLake CoM
+
+
+
+
+ + + + + + + + + +
Name +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
John Brown
John Brown
John Brown
John Brown
John Brown
John Brown
John Brown
John Brown
John Brown
John Brown
+
+
+
+ + + + + + + + + +
Gender +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
M
M
M
M
M
M
M
M
M
M
+
+
+
+
+ + + + + `; exports[`renders ./components/table/demo/head.md correctly 1`] = ` @@ -2113,77 +1987,57 @@ exports[`renders ./components/table/demo/head.md correctly 1`] = ` - -
Name
-
- - -
Age
-
- - -
Address
-
- - - - - - - John Brown - 32 - New York No. 1 Lake Park - - - - Jim Green - 42 - London No. 1 Lake Park - - - - Joe Black - 32 - Sidney No. 1 Lake Park - - - - Jim Red - 32 - London No. 2 Lake Park - - - - - - - +
Name
+
+
Age
+
+
Address
+
+ + + + + Jim Green + 42 + London No. 1 Lake Park + + + John Brown + 32 + New York No. 1 Lake Park + + + Joe Black + 32 + Sidney No. 1 Lake Park + + + Jim Red + 32 + London No. 2 Lake Park + + + + + + + `; exports[`renders ./components/table/demo/nested-table.md correctly 1`] = ` @@ -2208,80 +2062,78 @@ exports[`renders ./components/table/demo/nested-table.md correctly 1`] = ` - -
Name
- - -
Platform
- - -
Version
- - -
Upgraded
- - -
Creator
- - -
Date
- - -
Action
- - - - - - - Screem - iOS - 10.3.4.5654 - 500 - Jack - 2014-12-24 23:12:00 - Publish - - - - - Screem - iOS - 10.3.4.5654 - 500 - Jack - 2014-12-24 23:12:00 - Publish - - - - - Screem - iOS - 10.3.4.5654 - 500 - Jack - 2014-12-24 23:12:00 - Publish - - - - - - - - - - +
Name +
+
Platform +
+
Version +
+
Upgraded +
+
Creator +
+
Date +
+
Action
+ + + + + +
+ + Screem + iOS + 10.3.4.5654 + 500 + Jack + 2014-12-24 23:12:00 + Publish + + + + +
+ + Screem + iOS + 10.3.4.5654 + 500 + Jack + 2014-12-24 23:12:00 + Publish + + + + +
+ + Screem + iOS + 10.3.4.5654 + 500 + Jack + 2014-12-24 23:12:00 + Publish + + + + + + + + + + `; @@ -2291,7 +2143,7 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = `
-
+
@@ -2303,79 +2155,57 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` - -
Name
-
- - -
Age
-
- - -
Address
-
- - - - - - - John Brown - 32 - New York No. 1 Lake Park - - - - Jim Green - 42 - London No. 1 Lake Park - - - - Joe Black - 32 - Sidney No. 1 Lake Park - - - - Jim Red - 32 - London No. 2 Lake Park - - - -
-
-
- +
Name
+
+
Age
+
+
Address
+
+ + + + + John Brown + 32 + New York No. 1 Lake Park + + + Jim Green + 42 + London No. 1 Lake Park + + + Joe Black + 32 + Sidney No. 1 Lake Park + + + Jim Red + 32 + London No. 2 Lake Park + + +
+ +
+ + `; @@ -2389,75 +2219,66 @@ exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
Name
-
-
Age
-
-
Address
-
- John Brown32New York No. 1 Lake Park
- Jim Green42London No. 1 Lake Park
- Joe Black32Sidney No. 1 Lake Park
- Disabled User99Sidney No. 1 Lake Park
-
- - - - - +
+
+
+
Name +
+
Age +
+
Address +
+ + + + + + John Brown + 32 + New York No. 1 Lake Park + + + + Jim Green + 42 + London No. 1 Lake Park + + + + Joe Black + 32 + Sidney No. 1 Lake Park + + + + Disabled User + 99 + Sidney No. 1 Lake Park + + + + + + + + + `; @@ -2473,123 +2294,108 @@ exports[`renders ./components/table/demo/row-selection-and-operation.md correctl
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
Name
-
-
Age
-
-
Address
-
- Edward King 032London, Park Lane no. 0
- Edward King 132London, Park Lane no. 1
- Edward King 232London, Park Lane no. 2
- Edward King 332London, Park Lane no. 3
- Edward King 432London, Park Lane no. 4
- Edward King 532London, Park Lane no. 5
- Edward King 632London, Park Lane no. 6
- Edward King 732London, Park Lane no. 7
- Edward King 832London, Park Lane no. 8
- Edward King 932London, Park Lane no. 9
-
- - - - - +
+
+
+
Name +
+
Age +
+
Address +
+ + + + + + Edward King 0 + 32 + London, Park Lane no. 0 + + + + Edward King 1 + 32 + London, Park Lane no. 1 + + + + Edward King 2 + 32 + London, Park Lane no. 2 + + + + Edward King 3 + 32 + London, Park Lane no. 3 + + + + Edward King 4 + 32 + London, Park Lane no. 4 + + + + Edward King 5 + 32 + London, Park Lane no. 5 + + + + Edward King 6 + 32 + London, Park Lane no. 6 + + + + Edward King 7 + 32 + London, Park Lane no. 7 + + + + Edward King 8 + 32 + London, Park Lane no. 8 + + + + Edward King 9 + 32 + London, Park Lane no. 9 + + + + + + + + + `; exports[`renders ./components/table/demo/row-selection-custom.md correctly 1`] = ` @@ -2602,125 +2408,109 @@ exports[`renders ./components/table/demo/row-selection-custom.md correctly 1`] =
- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
Name
-
-
Age
-
-
Address
-
- Edward King 032London, Park Lane no. 0
- Edward King 132London, Park Lane no. 1
- Edward King 232London, Park Lane no. 2
- Edward King 332London, Park Lane no. 3
- Edward King 432London, Park Lane no. 4
- Edward King 532London, Park Lane no. 5
- Edward King 632London, Park Lane no. 6
- Edward King 732London, Park Lane no. 7
- Edward King 832London, Park Lane no. 8
- Edward King 932London, Park Lane no. 9
-
- - - - - +
+
+
+
+
Name +
+
Age +
+
Address +
+ + + + + + Edward King 0 + 32 + London, Park Lane no. 0 + + + + Edward King 1 + 32 + London, Park Lane no. 1 + + + + Edward King 2 + 32 + London, Park Lane no. 2 + + + + Edward King 3 + 32 + London, Park Lane no. 3 + + + + Edward King 4 + 32 + London, Park Lane no. 4 + + + + Edward King 5 + 32 + London, Park Lane no. 5 + + + + Edward King 6 + 32 + London, Park Lane no. 6 + + + + Edward King 7 + 32 + London, Park Lane no. 7 + + + + Edward King 8 + 32 + London, Park Lane no. 8 + + + + Edward King 9 + 32 + London, Park Lane no. 9 + + + + + + + + + `; @@ -2742,119 +2532,107 @@ exports[`renders ./components/table/demo/size.md correctly 1`] = ` - -
Name
- - -
Age
- - -
Address
- - - - - - - John Brown - 32 - New York No. 1 Lake Park - - - - Jim Green - 42 - London No. 1 Lake Park - - - - Joe Black - 32 - Sidney No. 1 Lake Park - - - - - - - +
Name +
+
Age +
+
Address +
+ + + + + John Brown + 32 + New York No. 1 Lake Park + + + Jim Green + 42 + London No. 1 Lake Park + + + Joe Black + 32 + Sidney No. 1 Lake Park + + + -

Small size table

-
-
-
-
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Name
-
-
Age
-
-
Address
-
- John Brown32New York No. 1 Lake Park
- Jim Green42London No. 1 Lake Park
- Joe Black32Sidney No. 1 Lake Park
-
-
-
-
+
+
+

Small size table

+
+
+
+
+
- -
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name +
Age +
Address +
John Brown32New York No. 1 Lake Park
Jim Green42London No. 1 Lake Park
Joe Black32Sidney No. 1 Lake Park
+ +
+
+ + `; exports[`renders ./components/table/demo/template.md correctly 1`] = ` @@ -2876,75 +2654,64 @@ exports[`renders ./components/table/demo/template.md correctly 1`] = ` - -
Name
- - -
Age
- - -
Address
- - -
Tags
- - -
Action
- - - - -
First Name
- - -
Last Name
- - - - - - - John - Brown - 32 - New York No. 1 Lake Park -
nice
developer
- Action 一 John
Delete
- - - - Jim - Green - 42 - London No. 1 Lake Park -
loser
- Action 一 Jim
Delete
- - - - Joe - Black - 32 - Sidney No. 1 Lake Park -
cool
teacher
- Action 一 Joe
Delete
- - - - - - - - - +
Name +
+
Age +
+
Address +
+
Tags +
+
Action +
+ + +
First Name +
+
Last Name
+ + + + + John + Brown + 32 + New York No. 1 Lake Park + nicedeveloper + Action 一 John Delete + + + Jim + Green + 42 + London No. 1 Lake Park + loser + Action 一 Jim Delete + + + Joe + Black + 32 + Sidney No. 1 Lake Park + coolteacher + Action 一 Joe Delete + + + + + + + + + `; diff --git a/components/table/__tests__/__snapshots__/empty.test.js.snap b/components/table/__tests__/__snapshots__/empty.test.js.snap index bce809622..4a92bb528 100644 --- a/components/table/__tests__/__snapshots__/empty.test.js.snap +++ b/components/table/__tests__/__snapshots__/empty.test.js.snap @@ -21,46 +21,44 @@ exports[`Table renders empty table 1`] = ` - -
Column 1
- - -
Column 2
- - -
Column 3
- - -
Column 4
- - -
Column 5
- - -
Column 6
- - -
Column 7
- - -
Column 8
- - - - - - -
-
-
No Data
-

No Data

-
-
- - - +
Column 1 +
+
Column 2 +
+
Column 3 +
+
Column 4 +
+
Column 5 +
+
Column 6 +
+
Column 7
+
Column 8
+ + + + + +
+
+
+ + + + + + + +
+

No Data

+ + + + + `; exports[`Table renders empty table with custom emptyText 1`] = ` @@ -84,40 +82,30 @@ exports[`Table renders empty table with custom emptyText 1`] = ` - -
Column 1
- - -
Column 2
- - -
Column 3
- - -
Column 4
- - -
Column 5
- - -
Column 6
- - -
Column 7
- - -
Column 8
- - - - - - -
custom empty text
- - - - +
Column 1 +
+
Column 2 +
+
Column 3 +
+
Column 4 +
+
Column 5 +
+
Column 6 +
+
Column 7
+
Column 8
+ + + + + +
custom empty text
+ + + + `; @@ -146,107 +134,97 @@ exports[`Table renders empty table with fixed columns 1`] = ` - -
Full Name
- - -
Age
- - -
Column 1
- - -
Column 2
- - -
Column 3
- - -
Column 4
- - -
Column 5
- - -
Column 6
- - -
Column 7
- - -
Column 8
- - -
Action
- - - - - - -
-
-
No Data
-

No Data

-
-
- -
- -
-
- - - - - - - - - - - - -
-
Full Name
-
-
Age
-
-
-
-
-
- -
-
- - - - - - - - - - -
-
Action
-
-
-
-
- - - +
Full Name +
+
Age +
+
Column 1 +
+
Column 2 +
+
Column 3 +
+
Column 4 +
+
Column 5 +
+
Column 6
+
Column 7
+
Column 8
+
Action
+ + + + + +
+
+
+ + + + + + + +
+

No Data

+ +
+ +
+
+ + + + + + + + + + + + +
Full Name +
Age +
+
+
+
+
+ +
+
+ + + + + + + + + + +
Action +
+
+
+
+ + + + + `; exports[`Table renders empty table without emptyText when loading 1`] = `
-
+
@@ -266,39 +244,42 @@ exports[`Table renders empty table without emptyText when loading 1`] = ` - -
Column 1
- - -
Column 2
- - -
Column 3
- - -
Column 4
- - -
Column 5
- - -
Column 6
- - -
Column 7
- - -
Column 8
- - - - - -
-
-
-
-
+
Column 1 +
+
Column 2 +
+
Column 3 +
+
Column 4 +
+
Column 5 +
+
Column 6 +
+
Column 7
+
Column 8
+ + + + + +
+
+
+ + + + + + + +
+

No Data

+ + + + + `; diff --git a/components/table/demo/head.md b/components/table/demo/head.md index f3bbe0cb1..3d50f4607 100644 --- a/components/table/demo/head.md +++ b/components/table/demo/head.md @@ -21,106 +21,107 @@ If a `sortOrder` or `defaultSortOrder` is specified with the value `ascend` or ` ``` diff --git a/components/vc-table/src/TableHeaderRow.jsx b/components/vc-table/src/TableHeaderRow.jsx index 4bae5db51..107691b05 100644 --- a/components/vc-table/src/TableHeaderRow.jsx +++ b/components/vc-table/src/TableHeaderRow.jsx @@ -32,9 +32,8 @@ const TableHeaderRow = { return ( {row.map((cell, i) => { - const { column, isLast, children, ...cellProps } = cell; + const { column, isLast, children, className, ...cellProps } = cell; const customProps = column.customHeaderCell ? column.customHeaderCell(column) : {}; - const headerCellProps = mergeProps( { attrs: { @@ -49,15 +48,11 @@ const TableHeaderRow = { if (column.align) { headerCellProps.style = { ...customProps.style, textAlign: column.align }; - headerCellProps.class = classNames(customProps.cls, column.class, column.className, { - [`${prefixCls}-align-${column.align}`]: !!column.align, - }); } + headerCellProps.class = classNames( - customProps.className, - customProps.class, - column.class, - column.className, + customProps.class || customProps.className, + column.class || column.className, { [`${prefixCls}-align-${column.align}`]: !!column.align, [`${prefixCls}-row-cell-ellipsis`]: !!column.ellipsis,