UNPKG

@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

50 lines (49 loc) 1.78 kB
/** * @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 e from "react"; import { ChipList as v } from "@progress/kendo-react-buttons"; import { useCustomComponent as x, canUseRef as h } from "@progress/kendo-react-common"; import { PivotGridConfiguratorEditorAxesContext as C } from "./EditorContext.mjs"; import { PivotGridAxisEditor as P } from "./AxisEditor.mjs"; const l = e.forwardRef( (i, m) => { const { value: c, field: d } = { ...n, ...i }, r = e.useRef(null), o = e.useRef(null), s = e.useRef(null), [a, u] = x( i.chipList || n.chipList ); e.useImperativeHandle( o, () => r.current && r.current.element ), e.useImperativeHandle(s, () => ({ props: i, element: o.current })), e.useImperativeHandle( m, () => s.current ); const p = c.filter((t) => t.name.length === 1 && t.name.every((f) => f.indexOf("&") === -1)).map((t) => ({ ...t, text: String(t.name) })); return /* @__PURE__ */ e.createElement(C.Provider, { value: { axes: d } }, /* @__PURE__ */ e.createElement( a, { ref: h(a) ? r : void 0, textField: "text", valueField: "name", data: p, chip: P, style: { position: "relative" }, className: i.className, selection: "none", ...u } )); } ), n = { value: [], chipList: v }; l.defaultProps = n; l.displayName = "KendoReactPivotGridAxesEditor"; export { l as PivotGridAxesEditor };