react-live-data-table 1.0.7 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/ReactDataTable.jsx +17 -31
package/package.json
CHANGED
package/src/ReactDataTable.jsx
CHANGED
@@ -15,7 +15,6 @@ function ReactDataTable({
|
|
15
15
|
staticData = null,
|
16
16
|
emptyText,
|
17
17
|
rowHeights = 40,
|
18
|
-
checkboxStyle,
|
19
18
|
headerProps = {} // Added default value
|
20
19
|
}) {
|
21
20
|
const tableContainerRef = React.useRef(null);
|
@@ -160,24 +159,6 @@ function ReactDataTable({
|
|
160
159
|
|
161
160
|
const flatData = data.pages.flatMap(page => page.data);
|
162
161
|
|
163
|
-
const checkBoxStyle = checkboxStyle ? checkboxStyle : {
|
164
|
-
cursor: 'pointer',
|
165
|
-
background: 'rgb(249, 250, 251)',
|
166
|
-
height: '18px',
|
167
|
-
width: '18px',
|
168
|
-
display: 'flex',
|
169
|
-
alignItems: 'center',
|
170
|
-
justifyContent: 'center',
|
171
|
-
borderRadius: '4px',
|
172
|
-
border: '1px solid rgb(204, 204, 204)',
|
173
|
-
fontSize: '12px',
|
174
|
-
color: 'rgb(0, 122, 179)',
|
175
|
-
position: 'absolute',
|
176
|
-
top: '50%',
|
177
|
-
left: '50%',
|
178
|
-
transform: 'translate(-50%, -50%)'
|
179
|
-
};
|
180
|
-
|
181
162
|
const checkboxColumn = {
|
182
163
|
id: 'select',
|
183
164
|
size: 50,
|
@@ -186,24 +167,28 @@ function ReactDataTable({
|
|
186
167
|
header: ({ data }) => (
|
187
168
|
<div className="flex items-center justify-center h-[40px]">
|
188
169
|
<input
|
189
|
-
|
170
|
+
id={data.id}
|
190
171
|
type="checkbox"
|
172
|
+
className='bg-gray-700 rounded-4 border-gray-200 text-blue-400 focus:ring-0 focus:ring-white'
|
191
173
|
checked={Object.keys(selectedRows).length > 0 && data.every(row => selectedRows[row.id])}
|
192
174
|
onChange={(e) => handleSelectAll(e.target.checked, flatData)}
|
193
175
|
/>
|
194
176
|
</div>
|
195
177
|
),
|
196
|
-
cell: ({ row }) =>
|
197
|
-
|
198
|
-
<
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
178
|
+
cell: ({ row }) => {
|
179
|
+
return (
|
180
|
+
<div className="flex items-center justify-center h-[40px]" onClick={(e) => e.stopPropagation()}>
|
181
|
+
<input
|
182
|
+
id={row.id}
|
183
|
+
type="checkbox"
|
184
|
+
className='bg-gray-700 rounded-4 border-gray-200 text-blue-400 focus:ring-0 focus:ring-white'
|
185
|
+
checked={!!selectedRows[row.id]}
|
186
|
+
onClick={(e) => e.stopPropagation()}
|
187
|
+
onChange={(e) => { e.stopPropagation(); handleSelectRow(e.target.checked, row, flatData) }}
|
188
|
+
/>
|
189
|
+
</div>
|
190
|
+
)
|
191
|
+
}
|
207
192
|
};
|
208
193
|
|
209
194
|
const enhancedColumns = showCheckbox ? [checkboxColumn, ...columns] : columns;
|
@@ -289,6 +274,7 @@ function ReactDataTable({
|
|
289
274
|
>
|
290
275
|
{enhancedColumns.map(column => (
|
291
276
|
<td
|
277
|
+
|
292
278
|
key={column.accessorKey || column.id}
|
293
279
|
className={`text-left font-normal border-r ${column?.cellProps?.className || ''}`}
|
294
280
|
style={{
|