@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
83 lines (82 loc) • 1.95 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
const P = "", a = "0", g = "_";
function f(t, n, o) {
if (S(t))
return n[Number(t)];
const r = n[Number(u(t))], e = r && r[o] || [];
return e.length ? f(R(t), e, o) : void 0;
}
function u(t) {
return E(t) ? t : t.split("_")[0];
}
function R(t) {
if (E(t))
return t;
const n = t.indexOf("_");
return t.substring(n + 1);
}
function T(t) {
return O("0", t);
}
function O(t, n) {
return t = t.toString(), n ? n + "_" + t : t;
}
function i(t) {
const n = t.lastIndexOf("_");
return n < 0 ? "" : t.substring(0, n);
}
function E(t) {
return t === "" || t.indexOf("_") < 0;
}
function S(t) {
return t !== "" && t.indexOf("_") < 0;
}
function b(t) {
return t.split("_");
}
function A(t) {
const n = t.lastIndexOf("_");
return n < 0 ? t : t.substring(n + 1);
}
function _(t) {
return A(t) === "0";
}
function l(t, n) {
const o = n;
t = "r_" + t, n = "r_" + n;
const r = i(t) + "_";
if (n.startsWith(r)) {
const e = n.substring(r.length);
if (e) {
const s = u(e);
if (Number(A(t)) < Number(s)) {
const c = r + (Number(s) - 1).toString() + e.substring(s.length);
return R(c);
}
}
}
return o;
}
export {
P as EMPTY_ID,
g as SEPARATOR,
a as ZERO_LEVEL_ZERO_NODE_ID,
O as createId,
b as getAllShortIds,
l as getDecrementedItemIdAfterRemoval,
i as getDirectParentId,
T as getFirstChildId,
R as getIdWithoutRootParentId,
f as getItemById,
u as getRootParentId,
A as getShortId,
E as isIdEmptyOrZeroLevel,
S as isIdZeroLevel,
_ as isItemFirstFromSiblings
};