@@ -3,29 +3,28 @@ import React from 'react';
3
3
import DataTable from '~/components/data-table' ; // `~` is replaced with design-system-react at runtime
4
4
import DataTableColumn from '~/components/data-table/column' ;
5
5
import DataTableCell from '~/components/data-table/cell' ;
6
+ import DataTableInteractiveLink from '~/components/data-table/interactive-link' ;
6
7
import IconSettings from '~/components/icon-settings' ;
7
8
8
- const CustomDataTableCell = ( { children, ...props } ) => (
9
+ const CustomDataTableCellKeyboardNavigation = ( { children, ...props } ) => (
9
10
< DataTableCell { ...props } >
10
- < a
11
- href = "#"
12
- onClick = { ( event ) => {
13
- event . preventDefault ( ) ;
14
- } }
15
- >
16
- { children }
17
- </ a >
11
+ < DataTableInteractiveLink
12
+ onClick = { ( event ) => {
13
+ event . preventDefault ( ) ;
14
+ } } >
15
+ { children }
16
+ </ DataTableInteractiveLink >
18
17
</ DataTableCell >
19
18
) ;
20
- CustomDataTableCell . displayName = DataTableCell . displayName ;
19
+ CustomDataTableCellKeyboardNavigation . displayName = DataTableCell . displayName ;
21
20
22
- const columns = [
21
+ const columnsKeyboardNavigation = [
23
22
< DataTableColumn
24
23
key = "opportunity"
25
24
label = "Opportunity Name"
26
25
property = "opportunityName"
27
26
>
28
- < CustomDataTableCell />
27
+ < CustomDataTableCellKeyboardNavigation />
29
28
</ DataTableColumn > ,
30
29
31
30
< DataTableColumn
@@ -43,7 +42,7 @@ const columns = [
43
42
< DataTableColumn key = "amount" label = "Amount" property = "amount" /> ,
44
43
45
44
< DataTableColumn key = "contact" label = "Contact" property = "contact" >
46
- < CustomDataTableCell />
45
+ < CustomDataTableCellKeyboardNavigation />
47
46
</ DataTableColumn > ,
48
47
] ;
49
48
@@ -90,53 +89,33 @@ class Example extends React.Component {
90
89
< React . Fragment >
91
90
< React . Fragment >
92
91
< h3 className = "slds-text-heading_medium slds-m-vertical_medium" >
93
- Fully resizable
94
- </ h3 >
95
- < IconSettings iconPath = "/assets/icons" >
96
- < div style = { { overflow : 'auto' } } >
97
- < DataTable
98
- items = { this . state . items }
99
- id = "DataTableExample-1-resizable-cols"
100
- resizable
101
- resizerOptions = { {
102
- resizeMode : 'overflow' ,
103
- onResize : ( columnsResized ) => {
104
- console . log ( JSON . stringify ( columnsResized ) ) ;
105
- } ,
106
- } }
107
- >
108
- { columns }
109
- </ DataTable >
110
- </ div >
111
- </ IconSettings >
112
- </ React . Fragment >
113
- < React . Fragment >
114
- < h3 className = "slds-text-heading_medium slds-m-vertical_medium" >
115
- Columns 0 and 3 fixed
92
+ Resizeable: Columns 0 and 3 fixed
116
93
</ h3 >
117
94
< IconSettings iconPath = "/assets/icons" >
118
95
< div style = { { overflow : 'auto' } } >
119
96
< DataTable
120
97
items = { this . state . items }
121
98
id = "DataTableExample-2-resizable-cols"
122
99
resizable
100
+ fixedHeader
123
101
fixedLayout
124
- resizerOptions = { {
102
+ keyboardNavigation
103
+ resizerOptions = { {
125
104
resizeMode : 'overflow' ,
126
105
onResize : ( columnsResized ) => {
127
106
console . log ( JSON . stringify ( columnsResized ) ) ;
128
107
} ,
129
108
disabledColumns : [ 0 , 3 ] ,
130
109
} }
131
110
>
132
- { columns }
111
+ { columnsKeyboardNavigation }
133
112
</ DataTable >
134
113
</ div >
135
114
</ IconSettings >
136
115
</ React . Fragment >
137
116
< React . Fragment >
138
117
< h3 className = "slds-text-heading_medium slds-m-vertical_medium" >
139
- With fixed header
118
+ Resizeable: With fixed header
140
119
</ h3 >
141
120
< IconSettings iconPath = "/assets/icons" >
142
121
< div style = { { overflow : 'auto' } } >
@@ -145,6 +124,7 @@ class Example extends React.Component {
145
124
id = "DataTableExample-3-resizable-cols"
146
125
fixedHeader
147
126
fixedLayout
127
+ keyboardNavigation
148
128
resizable
149
129
resizerOptions = { {
150
130
resizeMode : 'overflow' ,
@@ -153,7 +133,7 @@ class Example extends React.Component {
153
133
} ,
154
134
} }
155
135
>
156
- { columns }
136
+ { columnsKeyboardNavigation }
157
137
</ DataTable >
158
138
</ div >
159
139
</ IconSettings >
@@ -178,7 +158,7 @@ class Example extends React.Component {
178
158
} ,
179
159
} }
180
160
>
181
- { columns }
161
+ { columnsKeyboardNavigation }
182
162
</ DataTable >
183
163
</ div >
184
164
</ IconSettings >
0 commit comments