|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+import { DownOutlined } from '@ant-design/icons';
|
|
|
2
|
+import { Badge, Dropdown, Space, Table } from 'antd';
|
|
|
3
|
+import React from 'react';
|
|
|
4
|
+const items = [
|
|
|
5
|
+ {
|
|
|
6
|
+ key: '1',
|
|
|
7
|
+ label: 'Action 1',
|
|
|
8
|
+ },
|
|
|
9
|
+ {
|
|
|
10
|
+ key: '2',
|
|
|
11
|
+ label: 'Action 2',
|
|
|
12
|
+ },
|
|
|
13
|
+];
|
|
|
14
|
+const NestedTableComponent = () => {
|
|
|
15
|
+ const expandedRowRender = () => {
|
|
|
16
|
+ const columns = [
|
|
|
17
|
+ {
|
|
|
18
|
+ title: 'Date',
|
|
|
19
|
+ dataIndex: 'date',
|
|
|
20
|
+ key: 'date',
|
|
|
21
|
+ },
|
|
|
22
|
+ {
|
|
|
23
|
+ title: 'Name',
|
|
|
24
|
+ dataIndex: 'name',
|
|
|
25
|
+ key: 'name',
|
|
|
26
|
+ },
|
|
|
27
|
+ {
|
|
|
28
|
+ title: 'Status',
|
|
|
29
|
+ key: 'state',
|
|
|
30
|
+ render: () => (
|
|
|
31
|
+ <span>
|
|
|
32
|
+ <Badge status="success" />
|
|
|
33
|
+ Finished
|
|
|
34
|
+ </span>
|
|
|
35
|
+ ),
|
|
|
36
|
+ },
|
|
|
37
|
+ {
|
|
|
38
|
+ title: 'Upgrade Status',
|
|
|
39
|
+ dataIndex: 'upgradeNum',
|
|
|
40
|
+ key: 'upgradeNum',
|
|
|
41
|
+ },
|
|
|
42
|
+ {
|
|
|
43
|
+ title: 'Action',
|
|
|
44
|
+ dataIndex: 'operation',
|
|
|
45
|
+ key: 'operation',
|
|
|
46
|
+ render: () => (
|
|
|
47
|
+ <Space size="middle">
|
|
|
48
|
+ <a>Pause</a>
|
|
|
49
|
+ <a>Stop</a>
|
|
|
50
|
+ <Dropdown
|
|
|
51
|
+ menu={{
|
|
|
52
|
+ items,
|
|
|
53
|
+ }}
|
|
|
54
|
+ >
|
|
|
55
|
+ <a>
|
|
|
56
|
+ More <DownOutlined />
|
|
|
57
|
+ </a>
|
|
|
58
|
+ </Dropdown>
|
|
|
59
|
+ </Space>
|
|
|
60
|
+ ),
|
|
|
61
|
+ },
|
|
|
62
|
+ ];
|
|
|
63
|
+ const data = [];
|
|
|
64
|
+ for (let i = 0; i < 3; ++i) {
|
|
|
65
|
+ data.push({
|
|
|
66
|
+ key: i.toString(),
|
|
|
67
|
+ date: '2014-12-24 23:12:00',
|
|
|
68
|
+ name: 'This is production name',
|
|
|
69
|
+ upgradeNum: 'Upgraded: 56',
|
|
|
70
|
+ });
|
|
|
71
|
+ }
|
|
|
72
|
+ return <Table columns={columns} dataSource={data} pagination={false} />;
|
|
|
73
|
+ };
|
|
|
74
|
+ const columns = [
|
|
|
75
|
+ {
|
|
|
76
|
+ title: 'Name',
|
|
|
77
|
+ dataIndex: 'name',
|
|
|
78
|
+ key: 'name',
|
|
|
79
|
+ },
|
|
|
80
|
+ {
|
|
|
81
|
+ title: 'Platform',
|
|
|
82
|
+ dataIndex: 'platform',
|
|
|
83
|
+ key: 'platform',
|
|
|
84
|
+ },
|
|
|
85
|
+ {
|
|
|
86
|
+ title: 'Version',
|
|
|
87
|
+ dataIndex: 'version',
|
|
|
88
|
+ key: 'version',
|
|
|
89
|
+ },
|
|
|
90
|
+ {
|
|
|
91
|
+ title: 'Upgraded',
|
|
|
92
|
+ dataIndex: 'upgradeNum',
|
|
|
93
|
+ key: 'upgradeNum',
|
|
|
94
|
+ },
|
|
|
95
|
+ {
|
|
|
96
|
+ title: 'Creator',
|
|
|
97
|
+ dataIndex: 'creator',
|
|
|
98
|
+ key: 'creator',
|
|
|
99
|
+ },
|
|
|
100
|
+ {
|
|
|
101
|
+ title: 'Date',
|
|
|
102
|
+ dataIndex: 'createdAt',
|
|
|
103
|
+ key: 'createdAt',
|
|
|
104
|
+ },
|
|
|
105
|
+ {
|
|
|
106
|
+ title: 'Action',
|
|
|
107
|
+ key: 'operation',
|
|
|
108
|
+ render: () => <a>Publish</a>,
|
|
|
109
|
+ },
|
|
|
110
|
+ ];
|
|
|
111
|
+ const data = [];
|
|
|
112
|
+ for (let i = 0; i < 3; ++i) {
|
|
|
113
|
+ data.push({
|
|
|
114
|
+ key: i.toString(),
|
|
|
115
|
+ name: 'Screem',
|
|
|
116
|
+ platform: 'iOS',
|
|
|
117
|
+ version: '10.3.4.5654',
|
|
|
118
|
+ upgradeNum: 500,
|
|
|
119
|
+ creator: 'Jack',
|
|
|
120
|
+ createdAt: '2014-12-24 23:12:00',
|
|
|
121
|
+ });
|
|
|
122
|
+ }
|
|
|
123
|
+ return (
|
|
|
124
|
+ <>
|
|
|
125
|
+ <Table
|
|
|
126
|
+ columns={columns}
|
|
|
127
|
+ expandable={{
|
|
|
128
|
+ expandedRowRender,
|
|
|
129
|
+ defaultExpandedRowKeys: ['0'],
|
|
|
130
|
+ }}
|
|
|
131
|
+ dataSource={data}
|
|
|
132
|
+ />
|
|
|
133
|
+ <Table
|
|
|
134
|
+ columns={columns}
|
|
|
135
|
+ expandable={{
|
|
|
136
|
+ expandedRowRender,
|
|
|
137
|
+ defaultExpandedRowKeys: ['0'],
|
|
|
138
|
+ }}
|
|
|
139
|
+ dataSource={data}
|
|
|
140
|
+ size="middle"
|
|
|
141
|
+ />
|
|
|
142
|
+ <Table
|
|
|
143
|
+ columns={columns}
|
|
|
144
|
+ expandable={{
|
|
|
145
|
+ expandedRowRender,
|
|
|
146
|
+ defaultExpandedRowKeys: ['0'],
|
|
|
147
|
+ }}
|
|
|
148
|
+ dataSource={data}
|
|
|
149
|
+ size="small"
|
|
|
150
|
+ />
|
|
|
151
|
+ </>
|
|
|
152
|
+ );
|
|
|
153
|
+};
|
|
|
154
|
+export default NestedTableComponent;
|