react-live-data-table 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-live-data-table",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Your React component package with Tailwind",
5
5
  "main": "src/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -15,6 +15,7 @@ function ReactDataTable({
15
15
  staticData = null,
16
16
  emptyText,
17
17
  rowHeights = 40,
18
+ checkboxStyle,
18
19
  headerProps = {} // Added default value
19
20
  }) {
20
21
  const tableContainerRef = React.useRef(null);
@@ -159,6 +160,24 @@ function ReactDataTable({
159
160
 
160
161
  const flatData = data.pages.flatMap(page => page.data);
161
162
 
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
+
162
181
  const checkboxColumn = {
163
182
  id: 'select',
164
183
  size: 50,
@@ -167,6 +186,7 @@ function ReactDataTable({
167
186
  header: ({ data }) => (
168
187
  <div className="flex items-center justify-center h-[40px]">
169
188
  <input
189
+ id={data.id}
170
190
  type="checkbox"
171
191
  checked={Object.keys(selectedRows).length > 0 && data.every(row => selectedRows[row.id])}
172
192
  onChange={(e) => handleSelectAll(e.target.checked, flatData)}
@@ -176,9 +196,11 @@ function ReactDataTable({
176
196
  cell: ({ row }) => (
177
197
  <div className="flex items-center justify-center h-[40px]">
178
198
  <input
199
+ style={checkBoxStyle}
179
200
  type="checkbox"
180
201
  checked={!!selectedRows[row.id]}
181
- onChange={(e) => handleSelectRow(e.target.checked, row, flatData)}
202
+ onClick={(e) => e.stopPropagation()}
203
+ onChange={(e) => { e.stopPropagation(); handleSelectRow(e.target.checked, row, flatData) }}
182
204
  />
183
205
  </div>
184
206
  ),
@@ -201,16 +223,7 @@ function ReactDataTable({
201
223
  xmlns="http://www.w3.org/2000/svg"
202
224
  >
203
225
  <style>
204
- {`
205
- @keyframes spin {
206
- from {
207
- transform: rotate(0deg);
208
- }
209
- to {
210
- transform: rotate(360deg);
211
- }
212
- }
213
- `}
226
+ {`@keyframes spin {from {transform: rotate(0deg)} to {transform: rotate(360deg)}}`}
214
227
  </style>
215
228
  <circle
216
229
  style={{ opacity: 0.25 }}