@smallwebco/tinypivot-react 1.0.48 → 1.0.49
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/dist/index.cjs +33 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2305,6 +2305,14 @@ function PivotSkeleton({
|
|
|
2305
2305
|
[reorderDropTarget]
|
|
2306
2306
|
);
|
|
2307
2307
|
const currentFontSize = fontSize;
|
|
2308
|
+
const rowHeaderWidth = 180;
|
|
2309
|
+
const rowHeaderColWidth = useMemo9(() => {
|
|
2310
|
+
const numCols = Math.max(rowFields.length, 1);
|
|
2311
|
+
return Math.max(rowHeaderWidth / numCols, 80);
|
|
2312
|
+
}, [rowFields.length]);
|
|
2313
|
+
const getRowHeaderLeftOffset = useCallback9((fieldIdx) => {
|
|
2314
|
+
return fieldIdx * rowHeaderColWidth;
|
|
2315
|
+
}, [rowHeaderColWidth]);
|
|
2308
2316
|
return /* @__PURE__ */ jsxs5(
|
|
2309
2317
|
"div",
|
|
2310
2318
|
{
|
|
@@ -2585,18 +2593,20 @@ function PivotSkeleton({
|
|
|
2585
2593
|
] }) }),
|
|
2586
2594
|
isConfigured && pivotResult && /* @__PURE__ */ jsx5("div", { className: "vpg-table-container", children: /* @__PURE__ */ jsxs5("table", { className: "vpg-pivot-table", children: [
|
|
2587
2595
|
/* @__PURE__ */ jsx5("thead", { children: columnHeaderCells.map((headerRow, levelIdx) => /* @__PURE__ */ jsxs5("tr", { className: "vpg-column-header-row", children: [
|
|
2588
|
-
levelIdx === 0 && /* @__PURE__ */ jsx5(
|
|
2596
|
+
levelIdx === 0 && (rowFields.length > 0 ? rowFields : ["Rows"]).map((field, fieldIdx) => /* @__PURE__ */ jsx5(
|
|
2589
2597
|
"th",
|
|
2590
2598
|
{
|
|
2591
2599
|
className: "vpg-row-header-label",
|
|
2592
2600
|
rowSpan: columnHeaderCells.length,
|
|
2601
|
+
style: { width: `${rowHeaderColWidth}px`, minWidth: "80px", left: `${getRowHeaderLeftOffset(fieldIdx)}px` },
|
|
2593
2602
|
onClick: () => toggleSort("row"),
|
|
2594
2603
|
children: /* @__PURE__ */ jsxs5("div", { className: "vpg-header-content", children: [
|
|
2595
|
-
/* @__PURE__ */ jsx5("span", { children:
|
|
2596
|
-
/* @__PURE__ */ jsx5("span", { className: `vpg-sort-indicator ${sortTarget === "row" ? "active" : ""}`, children: sortTarget === "row" ? sortDirection === "asc" ? "\u2191" : "\u2193" : "\u21C5" })
|
|
2604
|
+
/* @__PURE__ */ jsx5("span", { children: field }),
|
|
2605
|
+
(fieldIdx === rowFields.length - 1 || rowFields.length === 0) && /* @__PURE__ */ jsx5("span", { className: `vpg-sort-indicator ${sortTarget === "row" ? "active" : ""}`, children: sortTarget === "row" ? sortDirection === "asc" ? "\u2191" : "\u2193" : "\u21C5" })
|
|
2597
2606
|
] })
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2607
|
+
},
|
|
2608
|
+
`row-header-${fieldIdx}`
|
|
2609
|
+
)),
|
|
2600
2610
|
headerRow.map((cell, idx) => /* @__PURE__ */ jsx5(
|
|
2601
2611
|
"th",
|
|
2602
2612
|
{
|
|
@@ -2614,7 +2624,15 @@ function PivotSkeleton({
|
|
|
2614
2624
|
] }, `header-${levelIdx}`)) }),
|
|
2615
2625
|
/* @__PURE__ */ jsxs5("tbody", { children: [
|
|
2616
2626
|
sortedRowIndices.map((sortedIdx) => /* @__PURE__ */ jsxs5("tr", { className: "vpg-data-row", children: [
|
|
2617
|
-
|
|
2627
|
+
pivotResult.rowHeaders[sortedIdx].map((val, idx) => /* @__PURE__ */ jsx5(
|
|
2628
|
+
"th",
|
|
2629
|
+
{
|
|
2630
|
+
className: "vpg-row-header-cell",
|
|
2631
|
+
style: { width: `${rowHeaderColWidth}px`, minWidth: "80px", left: `${getRowHeaderLeftOffset(idx)}px` },
|
|
2632
|
+
children: val
|
|
2633
|
+
},
|
|
2634
|
+
`row-${sortedIdx}-${idx}`
|
|
2635
|
+
)),
|
|
2618
2636
|
pivotResult.data[sortedIdx].map((cell, colIdx) => {
|
|
2619
2637
|
const displayRowIdx = sortedRowIndices.indexOf(sortedIdx);
|
|
2620
2638
|
return /* @__PURE__ */ jsx5(
|
|
@@ -2631,7 +2649,15 @@ function PivotSkeleton({
|
|
|
2631
2649
|
pivotResult.rowTotals[sortedIdx] && /* @__PURE__ */ jsx5("td", { className: "vpg-data-cell vpg-total-cell", children: pivotResult.rowTotals[sortedIdx].formattedValue })
|
|
2632
2650
|
] }, sortedIdx)),
|
|
2633
2651
|
pivotResult.columnTotals.length > 0 && /* @__PURE__ */ jsxs5("tr", { className: "vpg-totals-row", children: [
|
|
2634
|
-
/* @__PURE__ */ jsx5(
|
|
2652
|
+
/* @__PURE__ */ jsx5(
|
|
2653
|
+
"th",
|
|
2654
|
+
{
|
|
2655
|
+
className: "vpg-row-header-cell vpg-total-label",
|
|
2656
|
+
colSpan: Math.max(rowFields.length, 1),
|
|
2657
|
+
style: { width: `${rowHeaderWidth}px` },
|
|
2658
|
+
children: "Total"
|
|
2659
|
+
}
|
|
2660
|
+
),
|
|
2635
2661
|
pivotResult.columnTotals.map((cell, colIdx) => /* @__PURE__ */ jsx5("td", { className: "vpg-data-cell vpg-total-cell", children: cell.formattedValue }, colIdx)),
|
|
2636
2662
|
pivotResult.rowTotals.length > 0 && /* @__PURE__ */ jsx5("td", { className: "vpg-data-cell vpg-grand-total-cell", children: pivotResult.grandTotal.formattedValue })
|
|
2637
2663
|
] })
|