bolt-table 0.1.14 → 0.1.15
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/README.md +1 -1478
- package/dist/index.d.mts +153 -1495
- package/dist/index.d.ts +153 -1495
- package/dist/index.js +380 -435
- package/dist/index.mjs +380 -435
- package/package.json +1 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -716,9 +716,6 @@ var DraggableHeader = import_react.default.memo(
|
|
|
716
716
|
)
|
|
717
717
|
] });
|
|
718
718
|
},
|
|
719
|
-
// ── Custom memo comparator ─────────────────────────────────────────────────
|
|
720
|
-
// Only re-render when props that actually affect this header's output change.
|
|
721
|
-
// This prevents a sort/filter change on one column from re-rendering all others.
|
|
722
719
|
(prevProps, nextProps) => {
|
|
723
720
|
return prevProps.column.width === nextProps.column.width && prevProps.column.key === nextProps.column.key && prevProps.column.pinned === nextProps.column.pinned && prevProps.column.sortable === nextProps.column.sortable && prevProps.column.filterable === nextProps.column.filterable && prevProps.column.sorter === nextProps.column.sorter && prevProps.column.filterFn === nextProps.column.filterFn && prevProps.visualIndex === nextProps.visualIndex && prevProps.stickyOffset === nextProps.stickyOffset && prevProps.isLastColumn === nextProps.isLastColumn && prevProps.sortDirection === nextProps.sortDirection && prevProps.filterValue === nextProps.filterValue;
|
|
724
721
|
}
|
|
@@ -1008,11 +1005,6 @@ var Cell = import_react3.default.memo(
|
|
|
1008
1005
|
}
|
|
1009
1006
|
);
|
|
1010
1007
|
},
|
|
1011
|
-
// ── Custom memo comparator ─────────────────────────────────────────────────
|
|
1012
|
-
// Minimizes re-renders:
|
|
1013
|
-
// - __select__ cells: re-render only when selection changes
|
|
1014
|
-
// - __expand__ cells: re-render only when expand state changes
|
|
1015
|
-
// - Normal cells: re-render only when value or rowIndex changes
|
|
1016
1008
|
(prev, next) => {
|
|
1017
1009
|
if (prev.isLoading !== next.isLoading) return false;
|
|
1018
1010
|
if (prev.column.key === "__select__") {
|
|
@@ -1131,64 +1123,52 @@ var TableBody = ({
|
|
|
1131
1123
|
const cellValue = row[col.dataIndex];
|
|
1132
1124
|
const isRowShimmer = isLoading || rowKey.startsWith("__shimmer_");
|
|
1133
1125
|
const recordFingerprint = hasRender && !isRowShimmer ? JSON.stringify(row) : void 0;
|
|
1134
|
-
return (
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
{
|
|
1148
|
-
"data-row-key": rowKey,
|
|
1149
|
-
"data-column-key": col.key,
|
|
1150
|
-
"data-bt-cell": "",
|
|
1151
|
-
"data-selected": isSelected || void 0,
|
|
1152
|
-
style: {
|
|
1153
|
-
position: "absolute",
|
|
1154
|
-
top: `${virtualRow.start}px`,
|
|
1155
|
-
left: 0,
|
|
1156
|
-
right: 0,
|
|
1157
|
-
height: `${virtualRow.size}px`
|
|
1158
|
-
},
|
|
1159
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1160
|
-
"div",
|
|
1161
|
-
{
|
|
1162
|
-
style: {
|
|
1163
|
-
height: `${rowHeight}px`,
|
|
1164
|
-
position: "relative"
|
|
1165
|
-
},
|
|
1166
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1167
|
-
Cell,
|
|
1168
|
-
{
|
|
1169
|
-
value: cellValue,
|
|
1170
|
-
record: row,
|
|
1171
|
-
column: col,
|
|
1172
|
-
rowIndex: virtualRow.index,
|
|
1173
|
-
classNames,
|
|
1174
|
-
styles,
|
|
1175
|
-
isSelected,
|
|
1176
|
-
isExpanded,
|
|
1177
|
-
rowSelection,
|
|
1178
|
-
normalizedSelectedKeys,
|
|
1179
|
-
rowKey,
|
|
1180
|
-
allData: allDataForSelection,
|
|
1181
|
-
getRowKey,
|
|
1182
|
-
accentColor,
|
|
1183
|
-
isLoading: isRowShimmer,
|
|
1184
|
-
recordFingerprint
|
|
1185
|
-
}
|
|
1186
|
-
)
|
|
1187
|
-
}
|
|
1188
|
-
)
|
|
1126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1127
|
+
"div",
|
|
1128
|
+
{
|
|
1129
|
+
"data-row-key": rowKey,
|
|
1130
|
+
"data-column-key": col.key,
|
|
1131
|
+
"data-bt-cell": "",
|
|
1132
|
+
"data-selected": isSelected || void 0,
|
|
1133
|
+
style: {
|
|
1134
|
+
position: "absolute",
|
|
1135
|
+
top: `${virtualRow.start}px`,
|
|
1136
|
+
left: 0,
|
|
1137
|
+
right: 0,
|
|
1138
|
+
height: `${virtualRow.size}px`
|
|
1189
1139
|
},
|
|
1190
|
-
|
|
1191
|
-
|
|
1140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1141
|
+
"div",
|
|
1142
|
+
{
|
|
1143
|
+
style: {
|
|
1144
|
+
height: `${rowHeight}px`,
|
|
1145
|
+
position: "relative"
|
|
1146
|
+
},
|
|
1147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1148
|
+
Cell,
|
|
1149
|
+
{
|
|
1150
|
+
value: cellValue,
|
|
1151
|
+
record: row,
|
|
1152
|
+
column: col,
|
|
1153
|
+
rowIndex: virtualRow.index,
|
|
1154
|
+
classNames,
|
|
1155
|
+
styles,
|
|
1156
|
+
isSelected,
|
|
1157
|
+
isExpanded,
|
|
1158
|
+
rowSelection,
|
|
1159
|
+
normalizedSelectedKeys,
|
|
1160
|
+
rowKey,
|
|
1161
|
+
allData: allDataForSelection,
|
|
1162
|
+
getRowKey,
|
|
1163
|
+
accentColor,
|
|
1164
|
+
isLoading: isRowShimmer,
|
|
1165
|
+
recordFingerprint
|
|
1166
|
+
}
|
|
1167
|
+
)
|
|
1168
|
+
}
|
|
1169
|
+
)
|
|
1170
|
+
},
|
|
1171
|
+
`${rowKey}-${col.key}`
|
|
1192
1172
|
);
|
|
1193
1173
|
})
|
|
1194
1174
|
},
|
|
@@ -1204,8 +1184,6 @@ var TableBody = ({
|
|
|
1204
1184
|
height: `${totalSize}px`,
|
|
1205
1185
|
position: "relative",
|
|
1206
1186
|
zIndex: 15,
|
|
1207
|
-
// pointerEvents: none on the overlay so hover/click pass through
|
|
1208
|
-
// to the cells below for rows that are NOT expanded
|
|
1209
1187
|
pointerEvents: "none"
|
|
1210
1188
|
},
|
|
1211
1189
|
children: virtualItems.map((virtualRow) => {
|
|
@@ -1237,7 +1215,6 @@ var TableBody = ({
|
|
|
1237
1215
|
{
|
|
1238
1216
|
style: {
|
|
1239
1217
|
position: "absolute",
|
|
1240
|
-
// Position immediately below the row's base height
|
|
1241
1218
|
top: virtualRow.start + rowHeight,
|
|
1242
1219
|
left: 0,
|
|
1243
1220
|
right: 0
|
|
@@ -1845,7 +1822,6 @@ function BoltTable({
|
|
|
1845
1822
|
areaRect,
|
|
1846
1823
|
headerLeftInContent,
|
|
1847
1824
|
40,
|
|
1848
|
-
// minimum column width
|
|
1849
1825
|
scrollTop,
|
|
1850
1826
|
scrollLeft,
|
|
1851
1827
|
headerLeftInContent + startWidth
|
|
@@ -2321,157 +2297,170 @@ function BoltTable({
|
|
|
2321
2297
|
flexGrow: 0
|
|
2322
2298
|
} : { flex: "1 1 0%" }
|
|
2323
2299
|
},
|
|
2324
|
-
children: layoutLoading ? (
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2300
|
+
children: layoutLoading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2301
|
+
"div",
|
|
2302
|
+
{
|
|
2303
|
+
style: {
|
|
2304
|
+
position: "absolute",
|
|
2305
|
+
inset: 0,
|
|
2306
|
+
overflow: "auto",
|
|
2307
|
+
contain: "layout paint"
|
|
2308
|
+
},
|
|
2309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2310
|
+
"div",
|
|
2311
|
+
{
|
|
2312
|
+
style: {
|
|
2313
|
+
display: "grid",
|
|
2314
|
+
gridTemplateColumns,
|
|
2315
|
+
gridTemplateRows: "36px auto",
|
|
2316
|
+
minWidth: `${totalTableWidth}px`,
|
|
2317
|
+
width: "100%",
|
|
2318
|
+
position: "relative"
|
|
2319
|
+
},
|
|
2320
|
+
children: [
|
|
2321
|
+
orderedColumns.map((column) => {
|
|
2322
|
+
const isPinned = !!column.pinned;
|
|
2323
|
+
const offset = columnOffsets.get(column.key);
|
|
2324
|
+
const isSystem = column.key === "__select__" || column.key === "__expand__";
|
|
2325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2326
|
+
"div",
|
|
2327
|
+
{
|
|
2328
|
+
className: isPinned ? classNames.pinnedHeader ?? "" : classNames.header ?? "",
|
|
2329
|
+
style: {
|
|
2330
|
+
display: "flex",
|
|
2331
|
+
height: 36,
|
|
2332
|
+
alignItems: "center",
|
|
2333
|
+
overflow: "hidden",
|
|
2334
|
+
textOverflow: "ellipsis",
|
|
2335
|
+
whiteSpace: "nowrap",
|
|
2336
|
+
borderBottom: "1px solid rgba(128,128,128,0.2)",
|
|
2337
|
+
backdropFilter: "blur(8px)",
|
|
2338
|
+
position: "sticky",
|
|
2339
|
+
top: 0,
|
|
2340
|
+
zIndex: isPinned ? 13 : 10,
|
|
2341
|
+
...isPinned ? {
|
|
2342
|
+
[column.pinned]: offset ?? 0,
|
|
2343
|
+
...styles.pinnedHeader
|
|
2344
|
+
} : styles.header,
|
|
2345
|
+
paddingLeft: isSystem ? 0 : 8,
|
|
2346
|
+
paddingRight: isSystem ? 0 : 8
|
|
2347
|
+
}
|
|
2348
|
+
},
|
|
2349
|
+
column.key
|
|
2350
|
+
);
|
|
2351
|
+
}),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { gridColumn: "1 / -1" }, children: Array.from({ length: shimmerCount }).map((_, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2353
|
+
"div",
|
|
2354
|
+
{
|
|
2355
|
+
style: {
|
|
2356
|
+
display: "grid",
|
|
2357
|
+
gridTemplateColumns,
|
|
2358
|
+
height: rowHeight
|
|
2359
|
+
},
|
|
2360
|
+
children: orderedColumns.map((column, colIndex) => {
|
|
2361
|
+
const isPinned = !!column.pinned;
|
|
2362
|
+
const offset = columnOffsets.get(column.key);
|
|
2363
|
+
const isSystem = column.key === "__select__" || column.key === "__expand__";
|
|
2364
|
+
const widthPercent = SHIMMER_WIDTHS2[(rowIndex * 7 + colIndex) % SHIMMER_WIDTHS2.length];
|
|
2365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2366
|
+
"div",
|
|
2367
|
+
{
|
|
2368
|
+
className: isPinned ? classNames.pinnedCell ?? "" : "",
|
|
2369
|
+
style: {
|
|
2370
|
+
display: "flex",
|
|
2371
|
+
alignItems: "center",
|
|
2372
|
+
borderBottom: "1px solid rgba(128,128,128,0.2)",
|
|
2373
|
+
...isPinned ? {
|
|
2374
|
+
position: "sticky",
|
|
2375
|
+
[column.pinned]: offset ?? 0,
|
|
2376
|
+
zIndex: 5,
|
|
2377
|
+
...styles.pinnedCell
|
|
2378
|
+
} : {},
|
|
2379
|
+
paddingLeft: isSystem ? 0 : 8,
|
|
2380
|
+
paddingRight: isSystem ? 0 : 8,
|
|
2381
|
+
justifyContent: isSystem ? "center" : void 0
|
|
2382
|
+
},
|
|
2383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2384
|
+
"div",
|
|
2385
|
+
{
|
|
2386
|
+
style: {
|
|
2387
|
+
backgroundColor: "rgba(100, 116, 139, 0.15)",
|
|
2388
|
+
animation: "bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
2389
|
+
borderRadius: isSystem ? 3 : 4,
|
|
2390
|
+
height: isSystem ? 16 : 14,
|
|
2391
|
+
width: isSystem ? 16 : `${widthPercent}%`,
|
|
2392
|
+
animationDelay: `${(rowIndex * 7 + colIndex) * 50}ms`
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
)
|
|
2396
|
+
},
|
|
2397
|
+
column.key
|
|
2398
|
+
);
|
|
2399
|
+
})
|
|
2400
|
+
},
|
|
2401
|
+
rowIndex
|
|
2402
|
+
)) })
|
|
2403
|
+
]
|
|
2404
|
+
}
|
|
2405
|
+
)
|
|
2406
|
+
}
|
|
2407
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2408
|
+
"div",
|
|
2409
|
+
{
|
|
2410
|
+
ref: tableAreaCallbackRef,
|
|
2411
|
+
style: {
|
|
2412
|
+
position: "absolute",
|
|
2413
|
+
inset: 0,
|
|
2414
|
+
overflow: "auto",
|
|
2415
|
+
contain: "layout paint"
|
|
2416
|
+
},
|
|
2417
|
+
children: [
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ResizeOverlay_default, { ref: resizeOverlayRef, accentColor }),
|
|
2419
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2341
2420
|
"div",
|
|
2342
2421
|
{
|
|
2343
2422
|
style: {
|
|
2344
2423
|
display: "grid",
|
|
2345
2424
|
gridTemplateColumns,
|
|
2346
|
-
gridTemplateRows: "36px
|
|
2425
|
+
gridTemplateRows: isEmpty ? "36px 1fr" : `36px ${virtualTotalSize}px`,
|
|
2347
2426
|
minWidth: `${totalTableWidth}px`,
|
|
2348
2427
|
width: "100%",
|
|
2349
|
-
position: "relative"
|
|
2428
|
+
position: "relative",
|
|
2429
|
+
...isEmpty ? { height: "100%" } : {}
|
|
2350
2430
|
},
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
"div",
|
|
2385
|
-
{
|
|
2386
|
-
style: {
|
|
2387
|
-
display: "grid",
|
|
2388
|
-
gridTemplateColumns,
|
|
2389
|
-
height: rowHeight
|
|
2390
|
-
},
|
|
2391
|
-
children: orderedColumns.map((column, colIndex) => {
|
|
2392
|
-
const isPinned = !!column.pinned;
|
|
2393
|
-
const offset = columnOffsets.get(column.key);
|
|
2394
|
-
const isSystem = column.key === "__select__" || column.key === "__expand__";
|
|
2395
|
-
const widthPercent = SHIMMER_WIDTHS2[(rowIndex * 7 + colIndex) % SHIMMER_WIDTHS2.length];
|
|
2396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2397
|
-
"div",
|
|
2398
|
-
{
|
|
2399
|
-
className: isPinned ? classNames.pinnedCell ?? "" : "",
|
|
2400
|
-
style: {
|
|
2401
|
-
display: "flex",
|
|
2402
|
-
alignItems: "center",
|
|
2403
|
-
borderBottom: "1px solid rgba(128,128,128,0.2)",
|
|
2404
|
-
...isPinned ? {
|
|
2405
|
-
position: "sticky",
|
|
2406
|
-
[column.pinned]: offset ?? 0,
|
|
2407
|
-
zIndex: 5,
|
|
2408
|
-
...styles.pinnedCell
|
|
2409
|
-
} : {},
|
|
2410
|
-
paddingLeft: isSystem ? 0 : 8,
|
|
2411
|
-
paddingRight: isSystem ? 0 : 8,
|
|
2412
|
-
justifyContent: isSystem ? "center" : void 0
|
|
2413
|
-
},
|
|
2414
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2415
|
-
"div",
|
|
2416
|
-
{
|
|
2417
|
-
style: {
|
|
2418
|
-
backgroundColor: "rgba(100, 116, 139, 0.15)",
|
|
2419
|
-
animation: "bt-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
2420
|
-
borderRadius: isSystem ? 3 : 4,
|
|
2421
|
-
height: isSystem ? 16 : 14,
|
|
2422
|
-
width: isSystem ? 16 : `${widthPercent}%`,
|
|
2423
|
-
animationDelay: `${(rowIndex * 7 + colIndex) * 50}ms`
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
)
|
|
2427
|
-
},
|
|
2428
|
-
column.key
|
|
2429
|
-
);
|
|
2430
|
-
})
|
|
2431
|
-
},
|
|
2432
|
-
rowIndex
|
|
2433
|
-
)) })
|
|
2434
|
-
]
|
|
2435
|
-
}
|
|
2436
|
-
)
|
|
2437
|
-
}
|
|
2438
|
-
)
|
|
2439
|
-
) : (
|
|
2440
|
-
/*
|
|
2441
|
-
* ── Main scroll container ────────────────────────────────────
|
|
2442
|
-
* absolute inset-0 so it fills whatever height the wrapper resolves to.
|
|
2443
|
-
* contain: layout paint — browser optimization hint that this element
|
|
2444
|
-
* is a layout and paint boundary (improves compositing performance).
|
|
2445
|
-
*/
|
|
2446
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2447
|
-
"div",
|
|
2448
|
-
{
|
|
2449
|
-
ref: tableAreaCallbackRef,
|
|
2450
|
-
style: {
|
|
2451
|
-
position: "absolute",
|
|
2452
|
-
inset: 0,
|
|
2453
|
-
overflow: "auto",
|
|
2454
|
-
contain: "layout paint"
|
|
2455
|
-
},
|
|
2456
|
-
children: [
|
|
2457
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ResizeOverlay_default, { ref: resizeOverlayRef, accentColor }),
|
|
2458
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2459
|
-
"div",
|
|
2460
|
-
{
|
|
2461
|
-
style: {
|
|
2462
|
-
display: "grid",
|
|
2463
|
-
gridTemplateColumns,
|
|
2464
|
-
gridTemplateRows: isEmpty ? "36px 1fr" : `36px ${virtualTotalSize}px`,
|
|
2465
|
-
minWidth: `${totalTableWidth}px`,
|
|
2466
|
-
width: "100%",
|
|
2467
|
-
position: "relative",
|
|
2468
|
-
...isEmpty ? { height: "100%" } : {}
|
|
2469
|
-
},
|
|
2470
|
-
onContextMenu: (e) => {
|
|
2471
|
-
const cell = e.target.closest("[data-bt-cell]");
|
|
2472
|
-
if (!cell) return;
|
|
2473
|
-
const rk = cell.dataset.rowKey;
|
|
2474
|
-
const ck = cell.dataset.columnKey;
|
|
2431
|
+
onContextMenu: (e) => {
|
|
2432
|
+
const cell = e.target.closest("[data-bt-cell]");
|
|
2433
|
+
if (!cell) return;
|
|
2434
|
+
const rk = cell.dataset.rowKey;
|
|
2435
|
+
const ck = cell.dataset.columnKey;
|
|
2436
|
+
if (!rk || !ck) return;
|
|
2437
|
+
const col = freshOrderedColumns.find(
|
|
2438
|
+
(c) => c.key === ck
|
|
2439
|
+
);
|
|
2440
|
+
const hasCopy = col?.copy;
|
|
2441
|
+
const hasRowPin = !!onRowPin;
|
|
2442
|
+
if (!hasCopy && !hasRowPin) return;
|
|
2443
|
+
e.preventDefault();
|
|
2444
|
+
setCellContextMenu({
|
|
2445
|
+
x: Math.min(e.clientX, window.innerWidth - 200),
|
|
2446
|
+
y: Math.min(e.clientY, window.innerHeight - 200),
|
|
2447
|
+
rowKey: rk,
|
|
2448
|
+
columnKey: ck
|
|
2449
|
+
});
|
|
2450
|
+
},
|
|
2451
|
+
onTouchStart: (e) => {
|
|
2452
|
+
cancelCellLongPress();
|
|
2453
|
+
const cell = e.target.closest("[data-bt-cell]");
|
|
2454
|
+
if (!cell) return;
|
|
2455
|
+
const touch = e.touches[0];
|
|
2456
|
+
cellTouchStart.current = {
|
|
2457
|
+
x: touch.clientX,
|
|
2458
|
+
y: touch.clientY
|
|
2459
|
+
};
|
|
2460
|
+
const rk = cell.dataset.rowKey;
|
|
2461
|
+
const ck = cell.dataset.columnKey;
|
|
2462
|
+
cellLongPressTimer.current = setTimeout(() => {
|
|
2463
|
+
cellLongPressTimer.current = null;
|
|
2475
2464
|
if (!rk || !ck) return;
|
|
2476
2465
|
const col = freshOrderedColumns.find(
|
|
2477
2466
|
(c) => c.key === ck
|
|
@@ -2479,254 +2468,211 @@ function BoltTable({
|
|
|
2479
2468
|
const hasCopy = col?.copy;
|
|
2480
2469
|
const hasRowPin = !!onRowPin;
|
|
2481
2470
|
if (!hasCopy && !hasRowPin) return;
|
|
2482
|
-
e.preventDefault();
|
|
2483
2471
|
setCellContextMenu({
|
|
2484
|
-
x: Math.min(
|
|
2485
|
-
y: Math.min(
|
|
2472
|
+
x: Math.min(touch.clientX, window.innerWidth - 200),
|
|
2473
|
+
y: Math.min(touch.clientY, window.innerHeight - 200),
|
|
2486
2474
|
rowKey: rk,
|
|
2487
2475
|
columnKey: ck
|
|
2488
2476
|
});
|
|
2489
|
-
},
|
|
2490
|
-
|
|
2477
|
+
}, 500);
|
|
2478
|
+
},
|
|
2479
|
+
onTouchMove: (e) => {
|
|
2480
|
+
if (!cellTouchStart.current) return;
|
|
2481
|
+
const touch = e.touches[0];
|
|
2482
|
+
const dx = touch.clientX - cellTouchStart.current.x;
|
|
2483
|
+
const dy = touch.clientY - cellTouchStart.current.y;
|
|
2484
|
+
if (Math.abs(dx) > 10 || Math.abs(dy) > 10)
|
|
2491
2485
|
cancelCellLongPress();
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
if (!cellTouchStart.current) return;
|
|
2520
|
-
const touch = e.touches[0];
|
|
2521
|
-
const dx = touch.clientX - cellTouchStart.current.x;
|
|
2522
|
-
const dy = touch.clientY - cellTouchStart.current.y;
|
|
2523
|
-
if (Math.abs(dx) > 10 || Math.abs(dy) > 10)
|
|
2524
|
-
cancelCellLongPress();
|
|
2525
|
-
},
|
|
2526
|
-
onTouchEnd: cancelCellLongPress,
|
|
2527
|
-
onTouchCancel: cancelCellLongPress,
|
|
2528
|
-
children: [
|
|
2529
|
-
orderedColumns.map((column, visualIndex) => {
|
|
2530
|
-
if (column.key === "__select__" && rowSelection) {
|
|
2531
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2532
|
-
"div",
|
|
2533
|
-
{
|
|
2534
|
-
className: `${classNames.header ?? ""} ${classNames.pinnedHeader ?? ""}`,
|
|
2535
|
-
style: {
|
|
2536
|
-
display: "flex",
|
|
2537
|
-
height: 36,
|
|
2538
|
-
alignItems: "center",
|
|
2539
|
-
justifyContent: "center",
|
|
2540
|
-
overflow: "hidden",
|
|
2541
|
-
textOverflow: "ellipsis",
|
|
2542
|
-
whiteSpace: "nowrap",
|
|
2543
|
-
borderBottom: "1px solid rgba(128,128,128,0.2)",
|
|
2544
|
-
backgroundColor: styles?.pinnedBg,
|
|
2545
|
-
position: "sticky",
|
|
2546
|
-
left: columnOffsets.get("__select__") ?? 0,
|
|
2547
|
-
top: 0,
|
|
2548
|
-
zIndex: 13,
|
|
2549
|
-
width: "48px",
|
|
2550
|
-
...styles.header,
|
|
2551
|
-
...styles.pinnedHeader
|
|
2552
|
-
},
|
|
2553
|
-
children: rowSelection.type !== "radio" && !rowSelection.hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2554
|
-
"input",
|
|
2555
|
-
{
|
|
2556
|
-
type: "checkbox",
|
|
2557
|
-
checked: data.length > 0 && normalizedSelectedKeys.length === data.length,
|
|
2558
|
-
ref: (input) => {
|
|
2559
|
-
if (input) {
|
|
2560
|
-
input.indeterminate = normalizedSelectedKeys.length > 0 && normalizedSelectedKeys.length < data.length;
|
|
2561
|
-
}
|
|
2562
|
-
},
|
|
2563
|
-
onChange: (e) => {
|
|
2564
|
-
if (e.target.checked) {
|
|
2565
|
-
const allKeys = data.map(
|
|
2566
|
-
(row, idx) => getRowKey(row, idx)
|
|
2567
|
-
);
|
|
2568
|
-
rowSelection.onSelectAll?.(
|
|
2569
|
-
true,
|
|
2570
|
-
data,
|
|
2571
|
-
data
|
|
2572
|
-
);
|
|
2573
|
-
rowSelection.onChange?.(allKeys, data, {
|
|
2574
|
-
type: "all"
|
|
2575
|
-
});
|
|
2576
|
-
} else {
|
|
2577
|
-
rowSelection.onSelectAll?.(false, [], data);
|
|
2578
|
-
rowSelection.onChange?.([], [], {
|
|
2579
|
-
type: "all"
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
},
|
|
2583
|
-
style: { cursor: "pointer", accentColor }
|
|
2584
|
-
}
|
|
2585
|
-
)
|
|
2486
|
+
},
|
|
2487
|
+
onTouchEnd: cancelCellLongPress,
|
|
2488
|
+
onTouchCancel: cancelCellLongPress,
|
|
2489
|
+
children: [
|
|
2490
|
+
orderedColumns.map((column, visualIndex) => {
|
|
2491
|
+
if (column.key === "__select__" && rowSelection) {
|
|
2492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2493
|
+
"div",
|
|
2494
|
+
{
|
|
2495
|
+
className: `${classNames.header ?? ""} ${classNames.pinnedHeader ?? ""}`,
|
|
2496
|
+
style: {
|
|
2497
|
+
display: "flex",
|
|
2498
|
+
height: 36,
|
|
2499
|
+
alignItems: "center",
|
|
2500
|
+
justifyContent: "center",
|
|
2501
|
+
overflow: "hidden",
|
|
2502
|
+
textOverflow: "ellipsis",
|
|
2503
|
+
whiteSpace: "nowrap",
|
|
2504
|
+
borderBottom: "1px solid rgba(128,128,128,0.2)",
|
|
2505
|
+
backgroundColor: styles?.pinnedBg,
|
|
2506
|
+
position: "sticky",
|
|
2507
|
+
left: columnOffsets.get("__select__") ?? 0,
|
|
2508
|
+
top: 0,
|
|
2509
|
+
zIndex: 13,
|
|
2510
|
+
width: "48px",
|
|
2511
|
+
...styles.header,
|
|
2512
|
+
...styles.pinnedHeader
|
|
2586
2513
|
},
|
|
2587
|
-
"
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2514
|
+
children: rowSelection.type !== "radio" && !rowSelection.hideSelectAll && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2515
|
+
"input",
|
|
2516
|
+
{
|
|
2517
|
+
type: "checkbox",
|
|
2518
|
+
checked: data.length > 0 && normalizedSelectedKeys.length === data.length,
|
|
2519
|
+
ref: (input) => {
|
|
2520
|
+
if (input) {
|
|
2521
|
+
input.indeterminate = normalizedSelectedKeys.length > 0 && normalizedSelectedKeys.length < data.length;
|
|
2522
|
+
}
|
|
2523
|
+
},
|
|
2524
|
+
onChange: (e) => {
|
|
2525
|
+
if (e.target.checked) {
|
|
2526
|
+
const allKeys = data.map(
|
|
2527
|
+
(row, idx) => getRowKey(row, idx)
|
|
2528
|
+
);
|
|
2529
|
+
rowSelection.onSelectAll?.(
|
|
2530
|
+
true,
|
|
2531
|
+
data,
|
|
2532
|
+
data
|
|
2533
|
+
);
|
|
2534
|
+
rowSelection.onChange?.(allKeys, data, {
|
|
2535
|
+
type: "all"
|
|
2536
|
+
});
|
|
2537
|
+
} else {
|
|
2538
|
+
rowSelection.onSelectAll?.(false, [], data);
|
|
2539
|
+
rowSelection.onChange?.([], [], {
|
|
2540
|
+
type: "all"
|
|
2541
|
+
});
|
|
2542
|
+
}
|
|
2543
|
+
},
|
|
2544
|
+
style: { cursor: "pointer", accentColor }
|
|
2612
2545
|
}
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2546
|
+
)
|
|
2547
|
+
},
|
|
2548
|
+
"__select__"
|
|
2549
|
+
);
|
|
2550
|
+
}
|
|
2551
|
+
if (column.key === "__expand__") {
|
|
2617
2552
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2618
|
-
|
|
2553
|
+
"div",
|
|
2619
2554
|
{
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
customContextMenuItems: columnContextMenuItems
|
|
2555
|
+
className: `${classNames.header ?? ""} ${classNames.pinnedHeader ?? ""}`,
|
|
2556
|
+
style: {
|
|
2557
|
+
display: "flex",
|
|
2558
|
+
height: 36,
|
|
2559
|
+
alignItems: "center",
|
|
2560
|
+
justifyContent: "center",
|
|
2561
|
+
overflow: "hidden",
|
|
2562
|
+
textOverflow: "ellipsis",
|
|
2563
|
+
whiteSpace: "nowrap",
|
|
2564
|
+
borderBottom: "1px solid rgba(128,128,128,0.2)",
|
|
2565
|
+
backgroundColor: styles?.pinnedBg,
|
|
2566
|
+
position: "sticky",
|
|
2567
|
+
left: columnOffsets.get("__expand__") ?? 0,
|
|
2568
|
+
top: 0,
|
|
2569
|
+
zIndex: 13,
|
|
2570
|
+
width: "40px",
|
|
2571
|
+
...styles.header,
|
|
2572
|
+
...styles.pinnedHeader
|
|
2573
|
+
}
|
|
2640
2574
|
},
|
|
2641
|
-
|
|
2575
|
+
"__expand__"
|
|
2642
2576
|
);
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2577
|
+
}
|
|
2578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2579
|
+
DraggableHeader_default,
|
|
2580
|
+
{
|
|
2581
|
+
column,
|
|
2582
|
+
accentColor,
|
|
2583
|
+
visualIndex,
|
|
2584
|
+
onResizeStart: handleResizeStart,
|
|
2585
|
+
onColumnDragStart: handleColumnDragStart,
|
|
2586
|
+
styles,
|
|
2587
|
+
classNames,
|
|
2588
|
+
gripIcon,
|
|
2589
|
+
hideGripIcon,
|
|
2590
|
+
icons,
|
|
2591
|
+
stickyOffset: columnOffsets.get(column.key),
|
|
2592
|
+
onTogglePin: handleTogglePin,
|
|
2593
|
+
onToggleHide: handleToggleHide,
|
|
2594
|
+
isLastColumn: visualIndex === orderedColumns.length - 1,
|
|
2595
|
+
sortDirection: sortState.key === column.key ? sortState.direction : null,
|
|
2596
|
+
onSort: handleSort,
|
|
2597
|
+
filterValue: columnFilters[column.key] ?? "",
|
|
2598
|
+
onFilter: handleColumnFilter,
|
|
2599
|
+
onClearFilter: handleClearFilter,
|
|
2600
|
+
customContextMenuItems: columnContextMenuItems
|
|
2601
|
+
},
|
|
2602
|
+
column.key
|
|
2603
|
+
);
|
|
2604
|
+
}),
|
|
2605
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2606
|
+
"div",
|
|
2607
|
+
{
|
|
2608
|
+
style: {
|
|
2609
|
+
gridColumn: "1 / -1",
|
|
2610
|
+
height: "100%",
|
|
2611
|
+
position: "relative"
|
|
2612
|
+
},
|
|
2613
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2655
2614
|
"div",
|
|
2656
2615
|
{
|
|
2657
2616
|
style: {
|
|
2658
|
-
|
|
2617
|
+
position: "sticky",
|
|
2618
|
+
left: 0,
|
|
2619
|
+
width: scrollAreaWidth > 0 ? `${scrollAreaWidth}px` : "100%",
|
|
2659
2620
|
height: "100%",
|
|
2660
|
-
|
|
2621
|
+
display: "flex",
|
|
2622
|
+
alignItems: "center",
|
|
2623
|
+
justifyContent: "center"
|
|
2661
2624
|
},
|
|
2662
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2625
|
+
children: emptyRenderer ?? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2663
2626
|
"div",
|
|
2664
2627
|
{
|
|
2665
2628
|
style: {
|
|
2666
|
-
position: "sticky",
|
|
2667
|
-
left: 0,
|
|
2668
|
-
width: scrollAreaWidth > 0 ? `${scrollAreaWidth}px` : "100%",
|
|
2669
|
-
height: "100%",
|
|
2670
2629
|
display: "flex",
|
|
2630
|
+
flexDirection: "column",
|
|
2671
2631
|
alignItems: "center",
|
|
2672
|
-
|
|
2632
|
+
gap: 8,
|
|
2633
|
+
paddingTop: 32,
|
|
2634
|
+
paddingBottom: 32,
|
|
2635
|
+
color: "GrayText"
|
|
2673
2636
|
},
|
|
2674
|
-
children:
|
|
2675
|
-
"div",
|
|
2676
|
-
{
|
|
2677
|
-
style: {
|
|
2678
|
-
display: "flex",
|
|
2679
|
-
flexDirection: "column",
|
|
2680
|
-
alignItems: "center",
|
|
2681
|
-
gap: 8,
|
|
2682
|
-
paddingTop: 32,
|
|
2683
|
-
paddingBottom: 32,
|
|
2684
|
-
color: "GrayText"
|
|
2685
|
-
},
|
|
2686
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 14 }, children: "No data" })
|
|
2687
|
-
}
|
|
2688
|
-
)
|
|
2637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 14 }, children: "No data" })
|
|
2689
2638
|
}
|
|
2690
2639
|
)
|
|
2691
2640
|
}
|
|
2692
2641
|
)
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
]
|
|
2728
|
-
}
|
|
2729
|
-
)
|
|
2642
|
+
}
|
|
2643
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2644
|
+
TableBody_default,
|
|
2645
|
+
{
|
|
2646
|
+
data: displayData,
|
|
2647
|
+
orderedColumns: freshOrderedColumns,
|
|
2648
|
+
rowVirtualizer,
|
|
2649
|
+
columnOffsets,
|
|
2650
|
+
styles,
|
|
2651
|
+
classNames,
|
|
2652
|
+
rowSelection: !showShimmer ? rowSelection : void 0,
|
|
2653
|
+
normalizedSelectedKeys,
|
|
2654
|
+
getRowKey,
|
|
2655
|
+
expandable: !showShimmer ? expandable : void 0,
|
|
2656
|
+
resolvedExpandedKeys,
|
|
2657
|
+
rowHeight,
|
|
2658
|
+
totalTableWidth,
|
|
2659
|
+
scrollAreaWidth,
|
|
2660
|
+
accentColor,
|
|
2661
|
+
scrollContainerRef: tableAreaRef,
|
|
2662
|
+
isLoading: showShimmer,
|
|
2663
|
+
onExpandedRowResize: handleExpandedRowResize,
|
|
2664
|
+
maxExpandedRowHeight,
|
|
2665
|
+
pinnedTopData: pinnedTopRows,
|
|
2666
|
+
pinnedBottomData: pinnedBottomRows,
|
|
2667
|
+
gridTemplateColumns,
|
|
2668
|
+
headerHeight: HEADER_HEIGHT
|
|
2669
|
+
}
|
|
2670
|
+
)
|
|
2671
|
+
]
|
|
2672
|
+
}
|
|
2673
|
+
)
|
|
2674
|
+
]
|
|
2675
|
+
}
|
|
2730
2676
|
)
|
|
2731
2677
|
}
|
|
2732
2678
|
),
|
|
@@ -3192,4 +3138,3 @@ function BoltTable({
|
|
|
3192
3138
|
ResizeOverlay,
|
|
3193
3139
|
TableBody
|
|
3194
3140
|
});
|
|
3195
|
-
//# sourceMappingURL=index.js.map
|