UNPKG

@progress/kendo-vue-layout

Version:
90 lines (89 loc) 2.97 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 { templateRendering as l, getListeners as E } from "@progress/kendo-vue-common"; const S = function(t, { animation: n = !0, keepItemsMounted: e = !1, state: u, expanded: a, handleSelect: r, parentExpanded: d = !0, level: f = 0, parentPrivateKey: c = [] }) { return t.map(function(s, g) { let p, i = o(s, c, g); const x = l.call(this, s.content, E.call(this)), m = l.call(this, s.header, E.call(this)); if (s.items) { const F = { animation: n, keepItemsMounted: e, state: u, expanded: a, handleSelect: r, parentExpanded: (a || []).indexOf(i) > -1, level: f + 1, parentPrivateKey: [...c, i] }; p = S.call(this, s.items, F); } return { ...s, animation: s.animation !== void 0 ? s.animation : n, keepItemsMounted: e, id: s.id || `k-panelbar-item-default-${i}`, uniquePrivateKey: i, parentUniquePrivateKey: c, parentExpanded: d, level: f, expanded: (a || []).indexOf(i) > -1, focused: u.currentFocused === i && u.wrapperFocused, selected: u.currentSelected === i, items: p, content: x, header: m }; }, this); }, I = (t) => { const n = t.items[0]; return n ? o(n, [], 0) : ""; }, b = (t, n, e = { currentExpanded: t.expanded || [], currentSelected: t.selected || "", currentFocused: t.focused || "", wrapperFocused: !1 }, u = !0, a = []) => (t.items.forEach((r, d) => { let f = o(r, a, d); !r.disabled && u && (r.selected && (e.currentSelected = f), r.focused && (e.currentFocused = f), r.expanded && (n === "multiple" ? e.currentExpanded.push(f) : n === "single" && (e.currentExpanded = [f])), r.items && (e = b(r, n, e, !!r.expanded, [...a, f]))); }), e), o = (t, n, e) => t && t && t.id ? t.id : n.length ? n[n.length - 1] + `.${e}` : `.${e}`; function q(t, n = []) { return (t || []).forEach((e) => { e.disabled || (n.push(e), e.expanded && e.children && q(e.children, n)); }), n; } function $(t, n = []) { return t.forEach((e) => { e && e && !e.disabled && (n.push(e), e.items && $(e.items, n)); }), n; } function h(t, n = []) { return t.forEach((e) => { e && (e.expanded || e.parentExpanded) && (n.push(e), e.items && h(e.items, n)); }), n; } const O = (t) => t != null, v = (t, n) => t.length !== n.length ? !1 : t.every((e, u) => e === n[u]); export { $ as flatChildren, h as flatVisibleChildren, q as flatVisibleItems, I as getFirstId, b as getInitialState, v as isArrayEqual, O as isPresent, S as renderChildren };