UNPKG

@progress/kendo-react-data-tools

Version:

Includes React Pager & React Filter component, an intuitive interface to create complex filter descriptions. KendoReact Data Tools package

59 lines (58 loc) 1.53 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 { useRemoteDataSource as n } from "./use-remote-data-source.mjs"; import { validatePackage as c, deepMerge as r, clone as s } from "@progress/kendo-react-common"; import { toODataString as u } from "@progress/kendo-data-query"; import { packageMetadata as m } from "../package-metadata.mjs"; const i = { create: { contentType: "application/json", method: "POST" }, read: { parameterMap: (t) => `$count=true&$format=json&${u(t)}`, method: "GET" }, update: { contentType: "application/json", method: "PUT" }, delete: { method: "DELETE" } }, o = (t) => { const e = s(t); for (const a in e) a.startsWith("@odata") && delete e[a]; return e; }, p = { data: (t) => { if (Array.isArray(t)) return t.map((a) => o(a)); const e = o(t); return "value" in e ? e.value : [e]; }, total: (t) => t["@odata.count"] }, D = (t) => { c(m, { component: "useODataDataSource" }); const e = r( {}, i, t.transport ), a = r({}, p, t.schema); return n({ serverGrouping: !1, ...t, transport: e, schema: a }); }; export { D as useODataDataSource };