@progress/kendo-react-pivotgrid
Version:
React PivotGrid (also called Pivot Table) can be data-bound to an OLAP service and customized extensively. KendoReact PivotGrid package
62 lines (61 loc) • 3.11 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as d from "react";
import { useExpansion as N, EXPANSION_ACTION as D } from "./useExpansion.mjs";
import { compareFields as G } from "../utils/index.mjs";
import { PIVOT_CONFIGURATOR_ACTION as _, configuratorReducer as w } from "@progress/kendo-pivotgrid-common";
var m = /* @__PURE__ */ ((o) => (o.toggleExpansion = "PIVOT_CONFIGURATOR_ACTION_TOGGLE_EXPANSION", o))(m || {});
const E = {
..._,
...m
}, S = (o, x) => {
const t = o.valueGetter("rowAxes"), i = o.valueGetter("columnAxes"), s = o.valueGetter("measureAxes"), v = o.valueGetter("sort"), u = o.valueGetter("filter"), [g, f] = N([], void 0, x, G), [l, I] = d.useState(null), [n, T] = d.useState(null), [a, O] = d.useState(null), [A, p] = d.useState(null);
return [
{
dragItem: l,
dropTarget: a,
dropZone: n,
dropDirection: A,
columnAxes: i,
rowAxes: t,
measureAxes: s,
sort: v,
filter: u,
expanded: g
},
(e, C) => {
switch (e.type) {
case E.toggleExpansion: {
f({ type: D.toggle, payload: e.payload }, C);
break;
}
default:
const r = w(
{
filter: e.override && e.override.filter !== void 0 ? e.override.filter : u,
sort: e.override && e.override.sort !== void 0 ? e.override.sort : v,
rowAxes: e.override && e.override.rowAxes !== void 0 ? e.override.rowAxes : t,
columnAxes: e.override && e.override.columnAxes !== void 0 ? e.override.columnAxes : i,
measureAxes: e.override && e.override.measureAxes !== void 0 ? e.override.measureAxes : s,
dragItem: e.override && e.override.dragItem !== void 0 ? e.override.dragItem : l,
dropDirection: e.override && e.override.dropDirection !== void 0 ? e.override.dropDirection : A,
dropTarget: e.override && e.override.dropTarget !== void 0 ? e.override.dropTarget : a,
dropZone: e.override && e.override.dropZone !== void 0 ? e.override.dropZone : n
},
e
);
r.columnAxes !== void 0 && o.onChange("columnAxes", { value: r.columnAxes }), r.rowAxes !== void 0 && o.onChange("rowAxes", { value: r.rowAxes }), r.measureAxes !== void 0 && o.onChange("measureAxes", { value: r.measureAxes }), r.sort !== void 0 && o.onChange("sort", { value: r.sort }), r.filter !== void 0 && o.onChange("filter", { value: r.filter }), r.dropDirection !== void 0 && p(r.dropDirection), r.dropTarget !== void 0 && O(r.dropTarget), r.dropZone !== void 0 && T(r.dropZone), r.dragItem !== void 0 && I(r.dragItem);
break;
}
}
];
};
export {
E as PIVOT_CONFIGURATOR_ACTION,
S as usePivotConfiguratorEditor
};