@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.d.cts
CHANGED
|
@@ -98,6 +98,7 @@ interface PivotSkeletonProps {
|
|
|
98
98
|
rowFields: string[];
|
|
99
99
|
columnFields: string[];
|
|
100
100
|
valueFields: PivotValueField[];
|
|
101
|
+
calculatedFields?: CalculatedField[];
|
|
101
102
|
isConfigured: boolean;
|
|
102
103
|
draggingField: string | null;
|
|
103
104
|
pivotResult: PivotResult | null;
|
|
@@ -115,7 +116,7 @@ interface PivotSkeletonProps {
|
|
|
115
116
|
onReorderRowFields: (fields: string[]) => void;
|
|
116
117
|
onReorderColumnFields: (fields: string[]) => void;
|
|
117
118
|
}
|
|
118
|
-
declare function PivotSkeleton({ rowFields, columnFields, valueFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
119
|
+
declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
119
120
|
|
|
120
121
|
interface ExcelGridOptions<T> {
|
|
121
122
|
data: T[];
|
package/dist/index.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ interface PivotSkeletonProps {
|
|
|
98
98
|
rowFields: string[];
|
|
99
99
|
columnFields: string[];
|
|
100
100
|
valueFields: PivotValueField[];
|
|
101
|
+
calculatedFields?: CalculatedField[];
|
|
101
102
|
isConfigured: boolean;
|
|
102
103
|
draggingField: string | null;
|
|
103
104
|
pivotResult: PivotResult | null;
|
|
@@ -115,7 +116,7 @@ interface PivotSkeletonProps {
|
|
|
115
116
|
onReorderRowFields: (fields: string[]) => void;
|
|
116
117
|
onReorderColumnFields: (fields: string[]) => void;
|
|
117
118
|
}
|
|
118
|
-
declare function PivotSkeleton({ rowFields, columnFields, valueFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
119
|
+
declare function PivotSkeleton({ rowFields, columnFields, valueFields, calculatedFields, isConfigured, draggingField, pivotResult, fontSize, activeFilters, totalRowCount, filteredRowCount, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField, onReorderRowFields, onReorderColumnFields, }: PivotSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
119
120
|
|
|
120
121
|
interface ExcelGridOptions<T> {
|
|
121
122
|
data: T[];
|
package/dist/index.js
CHANGED
|
@@ -1553,6 +1553,7 @@ function PivotSkeleton({
|
|
|
1553
1553
|
rowFields,
|
|
1554
1554
|
columnFields,
|
|
1555
1555
|
valueFields,
|
|
1556
|
+
calculatedFields,
|
|
1556
1557
|
isConfigured,
|
|
1557
1558
|
draggingField,
|
|
1558
1559
|
pivotResult,
|
|
@@ -1570,6 +1571,17 @@ function PivotSkeleton({
|
|
|
1570
1571
|
onReorderColumnFields
|
|
1571
1572
|
}) {
|
|
1572
1573
|
const { showWatermark, canUsePivot, isDemo } = useLicense();
|
|
1574
|
+
const getValueFieldDisplayName = useCallback8((field) => {
|
|
1575
|
+
if (field.startsWith("calc:")) {
|
|
1576
|
+
const calcId = field.replace("calc:", "");
|
|
1577
|
+
const calcField = calculatedFields?.find((c) => c.id === calcId);
|
|
1578
|
+
return calcField?.name || field;
|
|
1579
|
+
}
|
|
1580
|
+
return field;
|
|
1581
|
+
}, [calculatedFields]);
|
|
1582
|
+
const isCalculatedField = useCallback8((field) => {
|
|
1583
|
+
return field.startsWith("calc:");
|
|
1584
|
+
}, []);
|
|
1573
1585
|
const [dragOverArea, setDragOverArea] = useState8(null);
|
|
1574
1586
|
const [reorderDragSource, setReorderDragSource] = useState8(null);
|
|
1575
1587
|
const [reorderDropTarget, setReorderDropTarget] = useState8(null);
|
|
@@ -1611,7 +1623,7 @@ function PivotSkeleton({
|
|
|
1611
1623
|
if (!pivotResult || pivotResult.headers.length === 0) {
|
|
1612
1624
|
return [
|
|
1613
1625
|
valueFields.map((vf) => ({
|
|
1614
|
-
label: `${vf.field} (${getAggregationLabel2(vf.aggregation)})`,
|
|
1626
|
+
label: `${getValueFieldDisplayName(vf.field)} (${getAggregationLabel2(vf.aggregation)})`,
|
|
1615
1627
|
colspan: 1
|
|
1616
1628
|
}))
|
|
1617
1629
|
];
|
|
@@ -1979,10 +1991,10 @@ function PivotSkeleton({
|
|
|
1979
1991
|
valueFields.map((vf) => /* @__PURE__ */ jsxs4(
|
|
1980
1992
|
"div",
|
|
1981
1993
|
{
|
|
1982
|
-
className:
|
|
1994
|
+
className: `vpg-mini-chip vpg-value-chip${isCalculatedField(vf.field) ? " vpg-calc-chip" : ""}`,
|
|
1983
1995
|
children: [
|
|
1984
|
-
/* @__PURE__ */ jsx4("span", { className: "vpg-agg-symbol", children: getAggregationSymbol2(vf.aggregation) }),
|
|
1985
|
-
/* @__PURE__ */ jsx4("span", { className: "vpg-mini-name", children: vf.field }),
|
|
1996
|
+
/* @__PURE__ */ jsx4("span", { className: "vpg-agg-symbol", children: isCalculatedField(vf.field) ? "\u0192" : getAggregationSymbol2(vf.aggregation) }),
|
|
1997
|
+
/* @__PURE__ */ jsx4("span", { className: "vpg-mini-name", children: getValueFieldDisplayName(vf.field) }),
|
|
1986
1998
|
/* @__PURE__ */ jsx4(
|
|
1987
1999
|
"button",
|
|
1988
2000
|
{
|
|
@@ -3019,6 +3031,7 @@ function DataGrid({
|
|
|
3019
3031
|
rowFields: pivotRowFields,
|
|
3020
3032
|
columnFields: pivotColumnFields,
|
|
3021
3033
|
valueFields: pivotValueFields,
|
|
3034
|
+
calculatedFields: pivotCalculatedFields,
|
|
3022
3035
|
isConfigured: pivotIsConfigured,
|
|
3023
3036
|
draggingField,
|
|
3024
3037
|
pivotResult,
|