@smallwebco/tinypivot-react 1.0.26 → 1.0.28
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 +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1568,6 +1568,7 @@ function PivotSkeleton({
|
|
|
1568
1568
|
rowFields,
|
|
1569
1569
|
columnFields,
|
|
1570
1570
|
valueFields,
|
|
1571
|
+
calculatedFields,
|
|
1571
1572
|
isConfigured,
|
|
1572
1573
|
draggingField,
|
|
1573
1574
|
pivotResult,
|
|
@@ -1585,6 +1586,17 @@ function PivotSkeleton({
|
|
|
1585
1586
|
onReorderColumnFields
|
|
1586
1587
|
}) {
|
|
1587
1588
|
const { showWatermark, canUsePivot, isDemo } = useLicense();
|
|
1589
|
+
const getValueFieldDisplayName = (0, import_react8.useCallback)((field) => {
|
|
1590
|
+
if (field.startsWith("calc:")) {
|
|
1591
|
+
const calcId = field.replace("calc:", "");
|
|
1592
|
+
const calcField = calculatedFields?.find((c) => c.id === calcId);
|
|
1593
|
+
return calcField?.name || field;
|
|
1594
|
+
}
|
|
1595
|
+
return field;
|
|
1596
|
+
}, [calculatedFields]);
|
|
1597
|
+
const isCalculatedField = (0, import_react8.useCallback)((field) => {
|
|
1598
|
+
return field.startsWith("calc:");
|
|
1599
|
+
}, []);
|
|
1588
1600
|
const [dragOverArea, setDragOverArea] = (0, import_react8.useState)(null);
|
|
1589
1601
|
const [reorderDragSource, setReorderDragSource] = (0, import_react8.useState)(null);
|
|
1590
1602
|
const [reorderDropTarget, setReorderDropTarget] = (0, import_react8.useState)(null);
|
|
@@ -1626,7 +1638,7 @@ function PivotSkeleton({
|
|
|
1626
1638
|
if (!pivotResult || pivotResult.headers.length === 0) {
|
|
1627
1639
|
return [
|
|
1628
1640
|
valueFields.map((vf) => ({
|
|
1629
|
-
label: `${vf.field} (${(0, import_tinypivot_core7.getAggregationLabel)(vf.aggregation)})`,
|
|
1641
|
+
label: `${getValueFieldDisplayName(vf.field)} (${(0, import_tinypivot_core7.getAggregationLabel)(vf.aggregation)})`,
|
|
1630
1642
|
colspan: 1
|
|
1631
1643
|
}))
|
|
1632
1644
|
];
|
|
@@ -1994,10 +2006,10 @@ function PivotSkeleton({
|
|
|
1994
2006
|
valueFields.map((vf) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1995
2007
|
"div",
|
|
1996
2008
|
{
|
|
1997
|
-
className:
|
|
2009
|
+
className: `vpg-mini-chip vpg-value-chip${isCalculatedField(vf.field) ? " vpg-calc-chip" : ""}`,
|
|
1998
2010
|
children: [
|
|
1999
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "vpg-agg-symbol", children: (0, import_tinypivot_core7.getAggregationSymbol)(vf.aggregation) }),
|
|
2000
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "vpg-mini-name", children: vf.field }),
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "vpg-agg-symbol", children: isCalculatedField(vf.field) ? "\u0192" : (0, import_tinypivot_core7.getAggregationSymbol)(vf.aggregation) }),
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "vpg-mini-name", children: getValueFieldDisplayName(vf.field) }),
|
|
2001
2013
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2002
2014
|
"button",
|
|
2003
2015
|
{
|
|
@@ -3034,6 +3046,7 @@ function DataGrid({
|
|
|
3034
3046
|
rowFields: pivotRowFields,
|
|
3035
3047
|
columnFields: pivotColumnFields,
|
|
3036
3048
|
valueFields: pivotValueFields,
|
|
3049
|
+
calculatedFields: pivotCalculatedFields,
|
|
3037
3050
|
isConfigured: pivotIsConfigured,
|
|
3038
3051
|
draggingField,
|
|
3039
3052
|
pivotResult,
|