UNPKG

@progress/kendo-react-treeview

Version:

React TreeView displays hierarchical data in a traditional tree structure, supports user interaction. KendoReact TreeView package

47 lines (46 loc) 1.33 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 { treeIdUtils as s, removeItem as R, addItem as l } from "@progress/kendo-react-common"; import { CHILDREN_FIELD as C } from "./utils/consts.mjs"; function N(u, f, v, o, n, r) { const t = r || C; if (!B()) return p(); const e = s.getItemById(u, f, t); if (!e) return p(); if (!n || n === f) { if (!y()) return p(); const d = R(u, t, f), m = l( e, v, t, s.getDecrementedItemIdAfterRemoval(u, o), d ); return n ? { sourceData: m, targetData: m } : m; } const F = R(u, t, f), _ = l(e, v, t, o, n); return { sourceData: F, targetData: _ }; function p() { return n ? { sourceData: f, targetData: n } : f; } function y() { return !`${o}_`.startsWith(`${u}_`); } function B() { if (!f || !f.length || !u || !o || n && !n.length) return !1; const d = !n || n === f ? f : n; return !!s.getItemById(o, d, t); } } export { N as moveTreeViewItem };