UNPKG

@progress/kendo-react-grid

Version:

React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package

111 lines (110 loc) 4.05 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use client"; import g from "react"; const M = g.createContext([{}, () => { }, {}]), ht = () => g.useContext(M), dt = (e) => { var E, k, m, G, H, D, P, F, _, R, T, b, j, q, w, y, z, A, B, I, J, K, L; const { children: N, onEditChange: u, onFilterChange: h, onSortChange: d, onSearchChange: o, onPageChange: i, onGroupChange: c, onDataStateChange: S, onSelectionChange: r, onDetailExpandChange: s, onGroupExpandChange: x, onHeaderSelectionChange: C, onColumnsStateChange: f } = e, [n, l] = g.useState({ edit: (E = e.defaultEdit) != null ? E : e.edit, filter: (k = e.defaultFilter) != null ? k : e.filter, highlight: e.highlight, select: (m = e.defaultSelect) != null ? m : e.select, search: (G = e.defaultSearch) != null ? G : e.search, sort: (H = e.defaultSort) != null ? H : e.sort, take: (D = e.defaultTake) != null ? D : e.take, skip: (P = e.defaultSkip) != null ? P : e.skip, group: (F = e.defaultGroup) != null ? F : e.group, detailExpand: (_ = e.defaultDetailExpand) != null ? _ : e.detailExpand, groupExpand: (R = e.defaultGroupExpand) != null ? R : e.groupExpand, columnsState: (T = e.defaultColumnsState) != null ? T : e.columnsState }), O = { edit: (b = e.edit) != null ? b : n.edit, filter: (j = e.filter) != null ? j : n.filter, highlight: (q = e.highlight) != null ? q : n.highlight, search: (w = e.search) != null ? w : n.search, sort: (y = e.sort) != null ? y : n.sort, take: (z = e.take) != null ? z : n.take, skip: (A = e.skip) != null ? A : n.skip, group: (B = e.group) != null ? B : n.group, select: (I = e.select) != null ? I : n.select, detailExpand: (J = e.detailExpand) != null ? J : n.detailExpand, groupExpand: (K = e.groupExpand) != null ? K : n.groupExpand, columnsState: (L = e.columnsState) != null ? L : n.columnsState }, Q = (t) => { }, U = (t) => { l((a) => ({ ...a, edit: t.edit })), u == null || u(t); }, V = (t) => { l((a) => ({ ...a, filter: t.filter })), h == null || h(t); }, W = (t) => { l((a) => ({ ...a, highlight: t.highlight })), e.onHighlightChange && e.onHighlightChange(t); }, X = (t) => { l((a) => ({ ...a, search: t.search })), o == null || o(t); }, Y = (t) => { l((a) => ({ ...a, sort: t.sort })), d == null || d(t); }, Z = (t) => { l((a) => ({ ...a, ...t.page })), i == null || i(t); }, $ = (t) => { l((a) => ({ ...a, group: t.group })), c == null || c(t); }, v = (t) => { l((a) => ({ ...a, ...t.dataState })), S == null || S(t); }, p = (t) => { l((a) => ({ ...a, select: t.select })), r == null || r(t); }, tt = (t) => { l((a) => ({ ...a, select: t.select })), C == null || C(t); }, et = (t) => { l((a) => ({ ...a, detailExpand: t.detailExpand })), s == null || s(t); }, at = (t) => { l((a) => ({ ...a, groupExpand: t.groupExpand })), x == null || x(t); }, lt = (t) => { l((a) => ({ ...a, columnsState: t.columnsState })), f == null || f(t); }; return /* @__PURE__ */ g.createElement( M.Provider, { value: [ O, Q, { onEditChange: U, onFilterChange: h && V, onSearchChange: X, onHighlightChange: W, onSortChange: d && Y, onPageChange: i && Z, onGroupChange: c && $, onDataStateChange: v, onSelectionChange: p, onHeaderSelectionChange: tt, onDetailExpandChange: et, onGroupExpandChange: at, onColumnsStateChange: lt } ] }, N ); }; export { dt as GridClientStateProvider, ht as useGridState };