UNPKG

tdesign-mobile-vue

Version:
40 lines (36 loc) 1.27 kB
/** * tdesign v1.9.3 * (c) 2025 TDesign Group * @license MIT */ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray'; import _typeof from '@babel/runtime/helpers/typeof'; function findParentValues(options, targetValue, realValue, realChildren) { var currentTargetValue = targetValue; if (currentTargetValue != null && _typeof(currentTargetValue) === "object") { var _currentTargetValue; currentTargetValue = (_currentTargetValue = currentTargetValue) === null || _currentTargetValue === void 0 ? void 0 : _currentTargetValue[realValue]; } if (currentTargetValue == null) return []; function findPath(nodes, parentPath) { var result = null; nodes.some(function (node) { var newPath = [].concat(_toConsumableArray(parentPath), [node[realValue]]); if (node[realValue] === currentTargetValue) { result = parentPath; return true; } if (Array.isArray(node[realChildren]) && node[realChildren].length) { result = findPath(node[realChildren], newPath); if (result !== null) { return true; } } return false; }); return result; } return findPath(options, []) || []; } export { findParentValues }; //# sourceMappingURL=utils.js.map