@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.93 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
const c = "", l = "0", r = "_";
function S(t, n, s) {
if (x(t))
return n[Number(t)];
const e = n[Number(f(t))], o = e && e[s] || [];
return o.length ? S(i(t), o, s) : void 0;
}
function f(t) {
return a(t) ? t : t.split(r)[0];
}
function i(t) {
if (a(t))
return t;
const n = t.indexOf(r);
return t.substring(n + 1);
}
function E(t) {
return O("0", t);
}
function O(t, n) {
return t = t.toString(), n ? n + r + t : t;
}
function h(t) {
const n = t.lastIndexOf(r);
return n < 0 ? c : t.substring(0, n);
}
function a(t) {
return t === c || t.indexOf(r) < 0;
}
function x(t) {
return t !== c && t.indexOf(r) < 0;
}
function P(t) {
return t.split(r);
}
function g(t) {
const n = t.lastIndexOf(r);
return n < 0 ? t : t.substring(n + 1);
}
function p(t) {
return g(t) === l;
}
function N(t, n) {
const s = n;
t = "r" + r + t, n = "r" + r + n;
const e = h(t) + r;
if (n.startsWith(e)) {
const o = n.substring(e.length);
if (o) {
const u = f(o);
if (Number(g(t)) < Number(u)) {
const b = e + (Number(u) - 1).toString() + o.substring(u.length);
return i(b);
}
}
}
return s;
}
export {
c as EMPTY_ID,
r as SEPARATOR,
l as ZERO_LEVEL_ZERO_NODE_ID,
O as createId,
P as getAllShortIds,
N as getDecrementedItemIdAfterRemoval,
h as getDirectParentId,
E as getFirstChildId,
i as getIdWithoutRootParentId,
S as getItemById,
f as getRootParentId,
g as getShortId,
a as isIdEmptyOrZeroLevel,
x as isIdZeroLevel,
p as isItemFirstFromSiblings
};